Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS Alert Tests Failing in TravisCI Only #43

Closed
erik-whiting opened this issue Oct 14, 2019 · 2 comments
Closed

JS Alert Tests Failing in TravisCI Only #43

erik-whiting opened this issue Oct 14, 2019 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@erik-whiting
Copy link
Owner

There are three tests in tests/test_other_pages.py which test the functionality of interacting with Alert elements (JS alerts, prompts, confirms) which are failing in TravisCI. They are test_javascript_alert, test_javascript_confirm, and test_javascript_prompt.

These tests pass locally, but something about TravisCI does not like what's happening. Please note, element functionality was recently refactored, however this functionality wasn't touched. Travis is throwing the following exception:

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 108, in test_javascript_alert
    bp.close()
  File "/home/travis/build/erik-whiting/LuluTest/page/page.py", line 23, in close
    self.page.close()
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 688, in close
    self.execute(Command.CLOSE)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 241, in check_response
    raise exception_class(message, screen, stacktrace, alert_text)
**selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: I am a JS Alert
Message: unexpected alert open: {Alert text : I am a JS Alert}
  (Session info: headless chrome=77.0.3865.120)**
----------------------------------------------------------------------

My guess is that there is a timing issue where the test case is not waiting long enough for the alert boxes to show up. I found a promising looking StackOverflow issue that we may be able to implement to get it working again:
[Check if any alert exists using selenium python](https://stackoverflow.com/questions/19003003/check-if-any-alert-exists-using-selenium-with-with python)

If you are able to figure it out, please remove the the @unittest.skip lines above the test cases.

Most recent build failure

@erik-whiting erik-whiting added bug Something isn't working help wanted Extra attention is needed labels Oct 14, 2019
@ddrm86
Copy link
Contributor

ddrm86 commented Oct 15, 2019

It is not just Travis some update broke these tests. I just checkout to an old commit #39 and it works in my local computer, but with the up-to-date development branch, I get the "UnexpectedAlertPresentException" in my local computer, even if I add some big manual wait like time.sleep(5), and I can visually confirm that the alert appears by removing the "headless" option.

@ddrm86
Copy link
Contributor

ddrm86 commented Oct 15, 2019

Should be fixed by #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants