erik-whiting/LuluTest

Fix flaky tests

Opened this issue · 2 comments

The following two tests in test_other_pages.py fail sporadically.

test_file_upload
test_script_execution

Example failure:

======================================================================
ERROR: test_javascript_alert (test_other_pages.TestOtherPages)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/erik-whiting/LuluTest/tests/test_other_pages.py", line 50, in test_javascript_alert
    actions.go(page)
  File "/home/travis/build/erik-whiting/LuluTest/LuluTest/action/page_actions_decorator.py", line 36, in method
    return self.set_page_loaded(func, *args)
  File "/home/travis/build/erik-whiting/LuluTest/LuluTest/action/page_actions_decorator.py", line 46, in set_page_loaded
    getattr(self.model, func)(*args)
  File "/home/travis/build/erik-whiting/LuluTest/LuluTest/action/page_actions.py", line 7, in go
    self.driver.get(page.url)
  File "/home/travis/virtualenv/python3.8.7/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "/home/travis/virtualenv/python3.8.7/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/travis/virtualenv/python3.8.7/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
  (Session info: headless chrome=90.0.4430.85)

If this can get fixed preferably by finding the root cause or employing a new strategy, that would be great because flakey tests here mean flakey tests for users.

Hello Erik,
How can we reproduce this issue?

I have completed all the steps from setup guide and all the test cases are running from development branch.

Test Cases Passed
Thank You

Hi @RaunakJalan , thanks for taking a look at this issue. the problem with this test is that it randomly fails in the build server. maybe 1 out of every 6 times.

I believe the problem is a timing issue, but I don't want to use explicit waits. if you have any thoughts on more robustly waiting for JavaScript to finish, I'm all ears.