Closed Bug 1140294 Opened 10 years ago Closed 10 years ago

focused_chrome_window_handle fails if there is no active window

Categories

(Testing :: Firefox UI Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla39

People

(Reporter: whimboo, Assigned: whimboo)

References

()

Details

(Keywords: intermittent-failure, Whiteboard: [test-failure])

Attachments

(1 file)

53 bytes, text/x-github-pull-request
chmanchester
: review+
chmanchester
: feedback+
Details | Review
Today we got the first report from Travis about a broken test. Looks like an intermittent failure given that we haven't seen it before. Details can be found at: https://travis-ci.org/mozilla/firefox-ui-tests/jobs/53308218 Traceback: 0:42.46 TEST_START: MainThread test_windows.py TestBaseWindow.test_open_close 0:43.28 TEST_END: MainThread ERROR, expected PASS Traceback (most recent call last): File "/home/travis/build/mozilla/firefox-ui-tests/client/marionette/marionette_test.py", line 290, in run testMethod() File "/home/travis/build/mozilla/firefox-ui-tests/firefox_puppeteer/tests/test_windows.py", line 114, in test_open_close self.assertTrue(win1.focused) File "/home/travis/build/mozilla/firefox-ui-tests/firefox_puppeteer/ui/windows.py", line 203, in focused return self.handle == self._windows.focused_chrome_window_handle File "/home/travis/build/mozilla/firefox-ui-tests/firefox_puppeteer/ui/windows.py", line 50, in focused_chrome_window_handle """) File "/home/travis/.venv/local/lib/python2.7/site-packages/marionette_driver-0.2-py2.7.egg/marionette_driver/marionette.py", line 1369, in execute_script filename=os.path.basename(frame[0])) File "/home/travis/.venv/local/lib/python2.7/site-packages/marionette_driver-0.2-py2.7.egg/marionette_driver/decorators.py", line 36, in _ return func(*args, **kwargs) File "/home/travis/.venv/local/lib/python2.7/site-packages/marionette_driver-0.2-py2.7.egg/marionette_driver/marionette.py", line 670, in _send_message self._handle_error(response) File "/home/travis/.venv/local/lib/python2.7/site-packages/marionette_driver-0.2-py2.7.egg/marionette_driver/marionette.py", line 725, in _handle_error raise errors.JavascriptException(message=message, status=status, stacktrace=stacktrace) JavascriptException: JavascriptException: TypeError: win is null stacktrace: execute_script @windows.py, line 50 inline javascript, line 3 src: " return win.QueryInterface(Ci.nsIInterfaceRequestor)" Code responsible for failures: https://github.com/mozilla/firefox-ui-tests/blob/master/firefox_puppeteer/ui/windows.py#L43 What I think is that at this specific moment we may not have an active window? My suggestion would be to return None in case of win is null.
Pretty interesting race condition. So our test catches a time when the focus is moving from window to the next one as it looks like. So activeWindow returns null. We can simply return None for focused_chrome_window_handle() in such a case.
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Attachment #8573784 - Flags: review?(cmanchester)
Comment on attachment 8573784 [details] [review] github_pull_request.txt Question in github.
Attachment #8573784 - Flags: review?(cmanchester) → feedback+
Comment on attachment 8573784 [details] [review] github_pull_request.txt Updated the PR given your feedback comments. I also added a new parameter to the open_window() method which implicitly checks for the focus state. I think that is way better then having each single test doing it on its own.
Attachment #8573784 - Flags: review?(cmanchester)
Comment on attachment 8573784 [details] [review] github_pull_request.txt I had a question about the API for open_window, but it's not really a blocker.
Attachment #8573784 - Flags: review?(cmanchester) → review+
We clarified the remaining items on IRC. So the final PR got merged as: https://github.com/mozilla/firefox-ui-tests/commit/f1123c7a4f3b9902e40a771e5bbab7c8eb2fc8ea
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
OS: Linux → All
Resolution: --- → FIXED
Target Milestone: --- → Firefox 39
Product: Mozilla QA → Testing
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: