Bug 1304656 - Firefox UI update tests have to use the restart buttons. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 13 Apr 2017 09:41:43 +0200
changeset 564713 45363ab9935fb123dc0e963d62d0a61315399b8b
parent 564712 de83c85b86ecacfeeef588b59db09eded4b6ca25
child 624809 51895a98774caf3ff2aa5e19abb0edbc00a377dd
push id54672
push userbmo:hskupin@gmail.com
push dateTue, 18 Apr 2017 21:56:46 +0000
bugs1304656
milestone55.0a1
Bug 1304656 - Firefox UI update tests have to use the restart buttons. To ensure that we correctly restart Firefox for update tests, the restart button in the about window or the old software update window have to be clicked. MozReview-Commit-ID: 7acl1DcA85d
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
@@ -307,17 +307,17 @@ class UpdateTestCase(PuppeteerMixin, Mar
         finally:
             self.update_status['patch'] = self.patch_info
 
         if force_fallback:
             # Set the downloaded update into failed state
             self.software_update.force_fallback()
 
         # Restart Firefox to apply the downloaded update
-        self.restart()
+        self.restart(callback=lambda: about_window.deck.apply.button.click())
 
     def download_and_apply_forced_update(self):
         self.check_update_not_applied()
 
         # The update wizard dialog opens automatically after the restart but with a short delay
         dialog = Wait(self.marionette, ignored_exceptions=[NoSuchWindowException]).until(
             lambda _: self.puppeteer.windows.switch_to(lambda win: type(win) is UpdateWizardDialog)
         )
@@ -336,32 +336,36 @@ class UpdateTestCase(PuppeteerMixin, Mar
                 self.assertTrue(update_available,
                                 'Available update has been found')
 
                 # Download update and wait until it has been applied
                 self.download_update(about_window)
                 self.wait_for_update_applied(about_window)
 
             finally:
-                if about_window:
-                    self.update_status['patch'] = self.patch_info
+                self.update_status['patch'] = self.patch_info
 
+            # Restart Firefox to apply the downloaded fallback update
+            self.assertIsNotNone(about_window)
+            self.restart(callback=lambda: about_window.deck.apply.button.click())
+
+        # For a broken partial update, the software update window is used
         else:
             try:
                 self.assertEqual(dialog.wizard.selected_panel,
                                  dialog.wizard.error_patching)
 
                 # Start downloading the fallback update
                 self.download_update(dialog)
 
             finally:
                 self.update_status['patch'] = self.patch_info
 
-        # Restart Firefox to apply the update
-        self.restart()
+            # Restart Firefox to apply the downloaded fallback update
+            self.restart(callback=lambda: dialog.wizard.finish_button.click())
 
     def read_update_log(self):
         """Read the content of the update log file for the last update attempt."""
         path = os.path.join(os.path.dirname(self.software_update.staging_directory),
                             'last-update.log')
         try:
             with open(path, 'rb') as f:
                 return f.read().splitlines()