Closed Bug 1335085 Opened 7 years ago Closed 5 years ago

"WebDriver:SwitchToWindow" has to wait for the "activate" and "focus" events before returning

Categories

(Remote Protocol :: Marionette, defect, P1)

Version 3
defect

Tracking

(firefox68 fixed, firefox69 fixed)

RESOLVED FIXED
mozilla69
Tracking Status
firefox68 --- fixed
firefox69 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(3 files)

While writing the patch for 1124604 I noticed a case where Marionette fails to correctly focus a window/tab. While the current handles are updated correctly, the focus doesn't change. Which means we operate with the tab in the background.

The steps for the test are:
* Open a new tab
* Switch to this tab
* Open a new window
* Switch to the tab in the new window
* Switch back to the second tab in the first window

With the last step the focus doesn't change.

For now I will exclude this specific test from my patch on bug 1124604.
Priority: -- → P3
This is actually a race because the command doesn't wait until the target window has focus and is activated. My patch on bug 1504756 will add a couple of helpers which will make those checks easier to perform.
Blocks: webdriver
Depends on: 1504756
Summary: Under some conditions switch_to_window() does not focus the window/tab even requested so → "WebDriver:SwitchToWindow" has to wait for the "activate" and "focus" events before returning
Blocks: 1504201
Blocks: 1511875
Blocks: 1214191
Blocks: 1305822
Blocks: 1499082

To remove the race condition which can result in intermittent failures we should get this bug fixed. Also because it has visibility through geckodriver.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Priority: P3 → P1

Selecting a different tab is asynchronous, and as such Marionette has
to wait for the "TabSelect" event to be emitted. Further the chrome
window also needs to be focused.

Depends on D33689

Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e1387e00703d
[marionette] Make use of "WebDriver:NewWindow" in firefox-puppeteer. r=webdriver-reviewers,ato
https://hg.mozilla.org/integration/autoland/rev/252fc1ac18cc
[marionette] Fix "WebDriver:SwitchToWindow" for tab and window focus switching. r=webdriver-reviewers,ato
https://hg.mozilla.org/integration/autoland/rev/5dc349bb1690
[marionette] Simplify focus handling for window classes in firefox-puppeteer. r=webdriver-reviewers,ato

I would like to keep it on the radar for the Firefox 68 release, given that it massively improves the stability and reduces the risk of race conditions. If there are no regressions in the next couple of days, lets get it uplifted to beta.

Blocks: 1330560
Blocks: 1511970
No longer blocks: 1511970
Depends on: 1557232
Blocks: 1535598
Whiteboard: [

I haven't seen any regressions from landing this patch on mozilla-central. To improve the reliability of Marionette and external tools like Selenium using geckodriver I would like to see this test-only patch uplifted to beta for the ESR release. Thanks.

Whiteboard: [ → [checkin-needed-beta]
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: