Bug 1274943 - Ensure to wait for the update dialog after a forced fallback. r?maja_zf draft
authorHenrik Skupin <mail@hskupin.info>
Tue, 06 Sep 2016 11:55:54 +0200
changeset 410149 219cb1ba67b3eb31acc97383f1a3faa1aa27f786
parent 409737 dbe4b47941c7b3d6298a0ead5e40dd828096c808
child 530509 a8450401e725aee90fcf0fbdd30141b69f8777fd
push id28660
push userbmo:hskupin@gmail.com
push dateTue, 06 Sep 2016 09:56:13 +0000
reviewersmaja_zf
bugs1274943
milestone51.0a1
Bug 1274943 - Ensure to wait for the update dialog after a forced fallback. r?maja_zf MozReview-Commit-ID: 7i9SwSbm0p0
testing/firefox-ui/harness/firefox_ui_harness/testcases.py
--- a/testing/firefox-ui/harness/firefox_ui_harness/testcases.py
+++ b/testing/firefox-ui/harness/firefox_ui_harness/testcases.py
@@ -5,16 +5,17 @@
 import os
 import pprint
 from datetime import datetime
 
 import mozfile
 
 from marionette import MarionetteTestCase
 from marionette_driver import Wait
+from marionette_driver.errors import NoSuchWindowException
 
 from firefox_puppeteer.api.prefs import Preferences
 from firefox_puppeteer.api.software_update import SoftwareUpdate
 from firefox_puppeteer.testcases import BaseFirefoxTestCase
 from firefox_puppeteer.ui.update_wizard import UpdateWizardDialog
 
 
 class FirefoxTestCase(BaseFirefoxTestCase, MarionetteTestCase):
@@ -313,18 +314,20 @@ class UpdateTestCase(FirefoxTestCase):
         if force_fallback:
             # Set the downloaded update into failed state
             self.software_update.force_fallback()
 
         # Restart Firefox to apply the downloaded update
         self.restart()
 
     def download_and_apply_forced_update(self):
-        # The update wizard dialog opens automatically after the restart
-        dialog = self.windows.switch_to(lambda win: type(win) is UpdateWizardDialog)
+        # The update wizard dialog opens automatically after the restart but with a short delay
+        dialog = Wait(self.marionette, ignored_exceptions=[NoSuchWindowException]).until(
+            lambda _: self.windows.switch_to(lambda win: type(win) is UpdateWizardDialog)
+        )
 
         # In case of a broken complete update the about window has to be used
         if self.updates[self.current_update_index]['patch']['is_complete']:
             about_window = None
             try:
                 self.assertEqual(dialog.wizard.selected_panel,
                                  dialog.wizard.error)
                 dialog.close()