Closed Bug 1726462 Opened 3 years ago Closed 2 years ago

Add automated testing for No Window Update Restarts

Categories

(Toolkit :: Application Update, task, P3)

task

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: bytesized, Assigned: bytesized)

References

Details

(Whiteboard: [fidedi-ope])

Attachments

(2 files, 1 obsolete file)

This bug will track adding automated testing for No Window Update Restarts (Bug 1720742).

I am currently planning to land the No Window Update Restarts feature without automated testing. See Bug 1726460 for an explanation of why it is not feasible to add them now.

Depends on: 1726465
Priority: P3 → P1
Priority: P1 → P3
Whiteboard: [fidedi-ope]
Assignee: nobody → bytesized

This is a stripped down testcase illustrating the problem that I'm having getting this test working. The test works fine if I remove this:

self.marionette.delete_session()
self.marionette.start_session({"moz:windowless": True})

But with it, the test fails with

 0:12.77 WARNING Failed to gather test failure debug: Browsing context has been discarded
stacktrace:
  WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:188:5
  NoSuchWindowError@chrome://remote/content/shared/webdriver/Errors.jsm:442:5
  assert.that/<@chrome://remote/content/shared/webdriver/Assert.jsm:493:13
  assert.open@chrome://remote/content/shared/webdriver/Assert.jsm:155:4
  GeckoDriver.prototype.takeScreenshot@chrome://remote/content/marionette/driver.js:2331:15
  despatch@chrome://remote/content/marionette/server.js:304:40
  execute@chrome://remote/content/marionette/server.js:277:16
  onPacket/<@chrome://remote/content/marionette/server.js:250:20
  onPacket@chrome://remote/content/marionette/server.js:251:9
  _onJSONObjectReady/<@chrome://remote/content/marionette/transport.js:502:20

 0:12.77 TEST_END: ERROR, expected PASS - marionette_driver.errors.NoSuchWindowException: Browsing context has been discarded
stacktrace:
  WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:188:5
  NoSuchWindowError@chrome://remote/content/shared/webdriver/Errors.jsm:442:5
  assert.that/<@chrome://remote/content/shared/webdriver/Assert.jsm:493:13
  assert.open@chrome://remote/content/shared/webdriver/Assert.jsm:155:4
  GeckoDriver.prototype.execute_@chrome://remote/content/marionette/driver.js:752:15
  GeckoDriver.prototype.executeScript@chrome://remote/content/marionette/driver.js:665:30
  despatch@chrome://remote/content/marionette/server.js:304:40
  execute@chrome://remote/content/marionette/server.js:277:16
  onPacket/<@chrome://remote/content/marionette/server.js:250:20
  onPacket@chrome://remote/content/marionette/server.js:251:9
  _onJSONObjectReady/<@chrome://remote/content/marionette/transport.js:502:20
Traceback (most recent call last):
  File "/Users/tester/mozilla-central/testing/marionette/harness/marionette_harness/marionette_test/testcases.py", line 183, in run
    self.setUp()
  File "/Users/tester/mozilla-central/toolkit/mozapps/update/tests/marionette/test_no_window_update_restart.py", line 16, in setUp
    self.marionette.execute_script("""
  File "/Users/tester/mozilla-central/testing/marionette/client/marionette_driver/marionette.py", line 1716, in execute_script
    rv = self._send_message("WebDriver:ExecuteScript", body, key="value")
  File "/Users/tester/mozilla-central/testing/marionette/client/marionette_driver/decorators.py", line 27, in _
    return func(*args, **kwargs)
  File "/Users/tester/mozilla-central/testing/marionette/client/marionette_driver/marionette.py", line 668, in _send_message
    self._handle_error(err)
  File "/Users/tester/mozilla-central/testing/marionette/client/marionette_driver/marionette.py", line 680, in _handle_error
    raise errors.lookup(error)(message, stacktrace=stacktrace)
Flags: needinfo?(hskupin)

Yes, the problem is that when a session is started with moz:windowless there is no window selected by Marionette itself. Instead you would have to find open windows and select one yourself like:

        window = self.marionette.window_handles[0]
        self.marionette.switch_to_window(window)

It might be fine as well to let Marionette check for an already open browser window (as it would be the case for your test) and select it before the test gets started. I filed bug 1777956 for that, but the workaround should be fine for you right now.

Flags: needinfo?(hskupin)
Depends on: 1657445

It seems that the "browser-lastwindow-close-granted" observer is not entirely reliable about notifying when the last window was closed. Instead we will rely on "domwindowclosed" and checking if that was the last window, which seems to be more reliable.

Attachment #9283540 - Attachment is obsolete: true
Assignee: nobody → bytesized
Attachment #9285528 - Attachment description: WIP: Bug 1726462 - Add test for the "no window update restart" feature r=whimboo,bhearsum → Bug 1726462 - Add test for the "no window update restart" feature r=whimboo,bhearsum
Attachment #9285527 - Attachment description: WIP: Bug 1726462 - Fix No Window Auto Restart feature to rely on more dependable observer r=bhearsum → Bug 1726462 - Fix No Window Auto Restart feature to rely on more dependable observer r=bhearsum
No longer depends on: 1657445
Pushed by ksteuber@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/44e6f14f69e1 Fix No Window Auto Restart feature to rely on more dependable observer r=bhearsum https://hg.mozilla.org/integration/autoland/rev/b787e5b41e0e Add test for the "no window update restart" feature r=webdriver-reviewers,bhearsum,whimboo
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: