Closed Bug 786094 Opened 8 years ago Closed 8 years ago

Tests that open new browser windows can get out of sync


(Testing :: Marionette, defect)

Not set


(Not tracked)



(Reporter: jgriffin, Assigned: jgriffin)



(1 file)

Tests that open new browser windows and then perform chrome actions on them can get out of sync.  This is because almost all of the chrome functions operate on the window returned by getCurrentWindow(), which just returns Services.wm.getMostRecentWindow() if no specific frame is active.

So, a test can switch to a window, and then do something, but that new window might not be the one returned by Services.wm.getMostRecentWindow, since it takes some amount of time for a new window to be opened and put on top of the list used by getMostRecentWindow.

We should really be tracking the current window across a session, instead of always attempting to use whatever window happens to be returned by getMostRecentWindow.
This patch lets Marionette track chrome windows during a session, instead of always using the topmost window.  This means we don't have to worry about timing issues when opening new windows, but we do have to explicitly call switch_to_window() after opening a new window if we want to operate on it.

A nice side effect of this is we no longer have to focus windows to force them to the top of the getMostRecentWindow list, so when running tests, Firefox doesn't need to be in the foreground.
Attachment #655826 - Flags: review?(mdas)
Comment on attachment 655826 [details] [diff] [review]
Track the current chrome window during a session,  DONTBUILD because NPOTB

Review of attachment 655826 [details] [diff] [review]:

love it! Should be good to go once we add the "self.assertNotEqual(, self.marionette.current_window_handle)" line to all the setUp functions.
Attachment #655826 - Flags: review?(mdas) → review+
Review comments addressed and pushed as
Assignee: nobody → jgriffin
Target Milestone: --- → mozilla18
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.