Bug 1270256 - Update UpdateWizard class for removal of incompatible add-ons check. r?maja_zf draft
authorHenrik Skupin <mail@hskupin.info>
Fri, 06 May 2016 18:51:43 +0200
changeset 364430 0006b3aa31a0d86f461fbdf1960c8a0ab1ea66d8
parent 364426 c7b7c9a6438d5d76913faf5973e12df166a21564
child 520277 8d33ab3333da20450c3611cb3e908430d910d9ce
push id17449
push userbmo:hskupin@gmail.com
push dateFri, 06 May 2016 16:54:53 +0000
reviewersmaja_zf
bugs1270256
milestone49.0a1
Bug 1270256 - Update UpdateWizard class for removal of incompatible add-ons check. r?maja_zf MozReview-Commit-ID: 8kDS0vtmcFM
testing/firefox-ui/harness/firefox_ui_harness/testcases.py
testing/firefox-ui/tests/puppeteer/test_update_wizard.py
testing/puppeteer/firefox/firefox_puppeteer/api/utils.py
testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
--- a/testing/firefox-ui/harness/firefox_ui_harness/testcases.py
+++ b/testing/firefox-ui/harness/firefox_ui_harness/testcases.py
@@ -222,18 +222,20 @@ class UpdateTestCase(FirefoxTestCase):
                 # If updates have already been found, proceed to download
                 if dialog.wizard.selected_panel in [dialog.wizard.updates_found_basic,
                                                     dialog.wizard.updates_found_billboard,
                                                     dialog.wizard.error_patching,
                                                     ]:
                     dialog.select_next_page()
 
                 # If incompatible add-on are installed, skip over the wizard page
-                if dialog.wizard.selected_panel == dialog.wizard.incompatible_list:
-                    dialog.select_next_page()
+                # TODO: Remove once we no longer support version Firefox 45.0ESR
+                if self.utils.compare_version(self.appinfo.version, '49.0a1') == -1:
+                    if dialog.wizard.selected_panel == dialog.wizard.incompatible_list:
+                        dialog.select_next_page()
 
                 # Updates were stored in the cache, so no download is necessary
                 if dialog.wizard.selected_panel in [dialog.wizard.finished,
                                                     dialog.wizard.finished_background,
                                                     ]:
                     pass
 
                 # Download the update
@@ -265,19 +267,19 @@ class UpdateTestCase(FirefoxTestCase):
         if window.deck.selected_panel == window.deck.download_and_install:
             window.deck.download_and_install.button.click()
 
             # Wait for the download to start
             Wait(self.marionette).until(lambda _: (
                 window.deck.selected_panel != window.deck.download_and_install),
                 message='Download of the update has been started.')
 
-        # If there are incompatible addons, handle the update via the old software update dialog
+        # In case of update failures, clicking the update button will open the
+        # old update wizard dialog.
         if window.deck.selected_panel == window.deck.apply_billboard:
-            # Clicking the update button will open the old update wizard dialog
             dialog = self.browser.open_window(
                 callback=lambda _: window.deck.update_button.click(),
                 expected_window_class=UpdateWizardDialog
             )
             Wait(self.marionette).until(
                 lambda _: dialog.wizard.selected_panel == dialog.wizard.updates_found_basic,
                 message='An update has been found.')
 
--- a/testing/firefox-ui/tests/puppeteer/test_update_wizard.py
+++ b/testing/firefox-ui/tests/puppeteer/test_update_wizard.py
@@ -40,28 +40,23 @@ class TestUpdateWizard(FirefoxTestCase):
         buttons = ('cancel_button', 'extra1_button', 'extra2_button',
                    'finish_button', 'next_button', 'previous_button',
                    )
         for button in buttons:
             self.assertEqual(getattr(self.wizard, button).get_attribute('localName'),
                              'button')
 
         panels = ('checking', 'downloading', 'dummy', 'error_patching', 'error',
-                  'error_extra', 'finished', 'finished_background', 'incompatible_check',
-                  'incompatible_list', 'installed', 'license', 'manual_update',
-                  'no_updates_found', 'plugin_updates_found', 'updates_found_basic',
-                  'updates_found_billboard',
+                  'error_extra', 'finished', 'finished_background', 'installed',
+                  'manual_update', 'no_updates_found', 'plugin_updates_found',
+                  'updates_found_basic', 'updates_found_billboard',
                   )
         for panel in panels:
             self.assertEqual(getattr(self.wizard, panel).element.get_attribute('localName'),
                              'wizardpage')
 
         # elements of the checking panel
         self.assertEqual(self.wizard.checking.progress.get_attribute('localName'),
                          'progressmeter')
 
         # elements of the downloading panel
         self.assertEqual(self.wizard.downloading.progress.get_attribute('localName'),
                          'progressmeter')
-
-        # elements of the incompatible check panel
-        self.assertEqual(self.wizard.incompatible_check.progress.get_attribute('localName'),
-                         'progressmeter')
--- a/testing/puppeteer/firefox/firefox_puppeteer/api/utils.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/api/utils.py
@@ -5,16 +5,29 @@
 from marionette_driver.errors import MarionetteException
 
 from firefox_puppeteer.base import BaseLib
 
 
 class Utils(BaseLib):
     """Low-level access to utility actions."""
 
+    def compare_version(self, a, b):
+        """Compare two version strings.
+
+        :param a: The first version.
+        :param b: The second version.
+
+        :returns: -1 if a is smaller than b, 0 if equal, and 1 if larger.
+        """
+        return self.marionette.execute_script("""
+          Components.utils.import("resource://gre/modules/Services.jsm");
+          return Services.vc.compare(arguments[0], arguments[1]);
+        """, script_args=[a, b])
+
     def remove_perms(self, host, permission):
         """Remove permission for web host.
 
         Permissions include safe-browsing, install, geolocation, and others described here:
         https://dxr.mozilla.org/mozilla-central/source/browser/modules/SitePermissions.jsm#144
         and elsewhere.
 
         :param host: The web host whose permission will be removed.
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
@@ -27,25 +27,26 @@ class Wizard(UIBaseLib):
         mapping = {'checking': CheckingPanel,
                    'downloading': DownloadingPanel,
                    'dummy': DummyPanel,
                    'errorpatching': ErrorPatchingPanel,
                    'errors': ErrorPanel,
                    'errorextra': ErrorExtraPanel,
                    'finished': FinishedPanel,
                    'finishedBackground': FinishedBackgroundPanel,
-                   'incompatibleCheck': IncompatibleCheckPanel,
-                   'incompatibleList': IncompatibleListPanel,
                    'installed': InstalledPanel,
-                   'license': LicensePanel,
                    'manualUpdate': ManualUpdatePanel,
                    'noupdatesfound': NoUpdatesFoundPanel,
                    'pluginupdatesfound': PluginUpdatesFoundPanel,
                    'updatesfoundbasic': UpdatesFoundBasicPanel,
                    'updatesfoundbillboard': UpdatesFoundBillboardPanel,
+
+                   # TODO: Remove once we no longer support version Firefox 45.0ESR
+                   'incompatibleCheck': IncompatibleCheckPanel,
+                   'incompatibleList': IncompatibleListPanel,
                    }
 
         panel = self.element.find_element(By.ID, panel_id)
         return mapping.get(panel_id, Panel)(lambda: self.marionette, self.window, panel)
 
     # Properties for visual buttons of the wizard #
 
     @property
@@ -162,24 +163,16 @@ class Wizard(UIBaseLib):
     def installed(self):
         """The installed panel.
 
         :returns: :class:`InstalledPanel` instance.
         """
         return self._create_panel_for_id('installed')
 
     @property
-    def license(self):
-        """The license panel.
-
-        :returns: :class:`LicensePanel` instance.
-        """
-        return self._create_panel_for_id('license')
-
-    @property
     def manual_update(self):
         """The manual update panel.
 
         :returns: :class:`ManualUpdatePanel` instance.
         """
         return self._create_panel_for_id('manualUpdate')
 
     @property
@@ -312,20 +305,16 @@ class IncompatibleCheckPanel(Panel):
 class IncompatibleListPanel(Panel):
     pass
 
 
 class InstalledPanel(Panel):
     pass
 
 
-class LicensePanel(Panel):
-    pass
-
-
 class ManualUpdatePanel(Panel):
     pass
 
 
 class NoUpdatesFoundPanel(Panel):
     pass