Open Bug 1121698 Opened 5 years ago Updated 6 months ago

Allow to wait for observer notifications when opening new chrome windows

Categories

(Testing :: Marionette, defect, P3)

Version 2
defect

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

References

Details

(Keywords: pi-marionette-firefox-puppeteer, Whiteboard: [lib])

Marionette is only able to return a list of open chrome windows. But it is not clear in which state such a window is. Especially when tests are opening or closing chrome windows, they have to wait until the window has e.g. been completely loaded. This can be done by listening for the appropriate observer notifications.

Currently we have this implemented in our mozmill-tests repository in the windows module:

http://hg.mozilla.org/qa/mozmill-tests/file/default/lib/windows.js

To be able to get started we need the feature to work with observers. This is being worked on in bug 1121691.
Depends on: 1123401
No longer blocks: 1119715
Product: Mozilla QA → Testing
Blocks: 1523133

Seeing more and more code being asynchronous it is getting more important to get this bug fixed. Otherwise race conditions can occur.

Implementing this is actually not that easy. We would have to setup some listener Promise first, which checks for new chrome windows to get opened. Then some code has been run, which triggers the opening of the window. This is mostly a callback in Python code. Then an async execute script call has to wait for the formerly setup Promise to be fulfilled.

As an example how the server code would look like the open browser window command can be used:
https://searchfox.org/mozilla-central/rev/78cd247b5d7a08832f87d786541d3e2204842e8e/testing/marionette/browser.js#307

This would all be a lot of work to do. Seeing that the Marionette client is fading away, firefox-puppeteer would also go away.

As such it may be helpful to just have bug 1507771 fixed, which let us open the window by a chrome URL, and then wait for appropriate events and observer notifications. The only problem with this approach is, that openDialog() and passing over arguments is needed. And that is actually not ideal, because the browser itself should decide which arguments to pass over.

https://searchfox.org/mozilla-central/rev/78cd247b5d7a08832f87d786541d3e2204842e8e/browser/base/content/browser.js#2601,2618-2619

Component: Firefox UI Tests → Marionette
QA Contact: hskupin
Summary: Implement fail-safe handling of chrome windows → Allow to wait for observer notifications when opening new chrome windows

To be able to use promises I have to get bug 1398095 fixed first.

Depends on: 1398095
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.