Bug 1275273 - Fix attribute vs. property conflation in Firefox UI tests; r?whimboo draft
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 17 Nov 2016 13:08:29 +0000
changeset 440366 b4c37f204cea652c1c15623345e7f03bb1cd9138
parent 440365 1c4cf5a67ad44a9c73d740628542e9b8cebacf9c
child 537362 e7efa58c05164e0989d88af1ac07dc4ac2e54a77
push id36212
push userbmo:ato@mozilla.com
push dateThu, 17 Nov 2016 13:09:23 +0000
reviewerswhimboo
bugs1275273
milestone53.0a1
Bug 1275273 - Fix attribute vs. property conflation in Firefox UI tests; r?whimboo MozReview-Commit-ID: 8LLs3PYHOeR
testing/firefox-ui/tests/functional/security/test_dv_certificate.py
testing/firefox-ui/tests/functional/security/test_ev_certificate.py
testing/firefox-ui/tests/functional/security/test_mixed_script_content_blocking.py
testing/firefox-ui/tests/puppeteer/test_toolbars.py
testing/firefox-ui/tests/puppeteer/test_update_wizard.py
--- a/testing/firefox-ui/tests/functional/security/test_dv_certificate.py
+++ b/testing/firefox-ui/tests/functional/security/test_dv_certificate.py
@@ -24,29 +24,29 @@ class TestDVCertificate(PuppeteerMixin, 
             self.puppeteer.windows.close_all([self.browser])
         finally:
             super(TestDVCertificate, self).tearDown()
 
     def test_dv_cert(self):
         with self.marionette.using_context('content'):
             self.marionette.navigate(self.url)
 
-        self.assertEqual(self.locationbar.identity_box.get_attribute('className'),
+        self.assertEqual(self.locationbar.identity_box.get_property('className'),
                          'verifiedDomain')
 
         # Open the identity popup
         self.locationbar.open_identity_popup()
 
         # Check the identity popup doorhanger
         self.assertEqual(self.identity_popup.element.get_attribute('connection'), 'secure')
 
         cert = self.browser.tabbar.selected_tab.certificate
 
         # The shown host equals to the certificate
-        self.assertEqual(self.identity_popup.view.main.host.get_attribute('textContent'),
+        self.assertEqual(self.identity_popup.view.main.host.get_property('textContent'),
                          cert['commonName'])
 
         # Only the secure label is visible in the main view
         secure_label = self.identity_popup.view.main.secure_connection_label
         self.assertNotEqual(secure_label.value_of_css_property('display'), 'none')
 
         insecure_label = self.identity_popup.view.main.insecure_connection_label
         self.assertEqual(insecure_label.value_of_css_property('display'), 'none')
@@ -57,27 +57,27 @@ class TestDVCertificate(PuppeteerMixin, 
         # Only the secure label is visible in the security view
         secure_label = self.identity_popup.view.security.secure_connection_label
         self.assertNotEqual(secure_label.value_of_css_property('display'), 'none')
 
         insecure_label = self.identity_popup.view.security.insecure_connection_label
         self.assertEqual(insecure_label.value_of_css_property('display'), 'none')
 
         verifier_label = self.browser.get_property('identity.identified.verifier')
-        self.assertEqual(self.identity_popup.view.security.verifier.get_attribute('textContent'),
+        self.assertEqual(self.identity_popup.view.security.verifier.get_property('textContent'),
                          verifier_label.replace("%S", cert['issuerOrganization']))
 
         def opener(mn):
             self.identity_popup.view.security.more_info_button.click()
 
         page_info_window = self.browser.open_page_info_window(opener)
         deck = page_info_window.deck
 
         self.assertEqual(deck.selected_panel, deck.security)
 
-        self.assertEqual(deck.security.domain.get_attribute('value'),
+        self.assertEqual(deck.security.domain.get_property('value'),
                          cert['commonName'])
 
-        self.assertEqual(deck.security.owner.get_attribute('value'),
+        self.assertEqual(deck.security.owner.get_property('value'),
                          page_info_window.get_property('securityNoOwner'))
 
-        self.assertEqual(deck.security.verifier.get_attribute('value'),
+        self.assertEqual(deck.security.verifier.get_property('value'),
                          cert['issuerOrganization'])
--- a/testing/firefox-ui/tests/functional/security/test_ev_certificate.py
+++ b/testing/firefox-ui/tests/functional/security/test_ev_certificate.py
@@ -25,17 +25,17 @@ class TestEVCertificate(PuppeteerMixin, 
         finally:
             super(TestEVCertificate, self).tearDown()
 
     def test_ev_certificate(self):
         with self.marionette.using_context('content'):
             self.marionette.navigate(self.url)
 
         # Check the identity box
-        self.assertEqual(self.locationbar.identity_box.get_attribute('className'),
+        self.assertEqual(self.locationbar.identity_box.get_property('className'),
                          'verifiedIdentity')
 
         # Get the information from the certificate
         cert = self.browser.tabbar.selected_tab.certificate
         address = self.puppeteer.security.get_address_from_certificate(cert)
 
         # Check the identity popup label displays
         self.assertEqual(self.locationbar.identity_organization_label.get_attribute('value'),
@@ -45,71 +45,73 @@ class TestEVCertificate(PuppeteerMixin, 
 
         # Open the identity popup
         self.locationbar.open_identity_popup()
 
         # Check the idenity popup doorhanger
         self.assertEqual(self.identity_popup.element.get_attribute('connection'), 'secure-ev')
 
         # For EV certificates no hostname but the organization name is shown
-        self.assertEqual(self.identity_popup.view.main.host.get_attribute('textContent'),
+        self.assertEqual(self.identity_popup.view.main.host.get_property('textContent'),
                          cert['organization'])
 
         # Only the secure label is visible in the main view
         secure_label = self.identity_popup.view.main.secure_connection_label
         self.assertNotEqual(secure_label.value_of_css_property('display'), 'none')
 
         insecure_label = self.identity_popup.view.main.insecure_connection_label
         self.assertEqual(insecure_label.value_of_css_property('display'), 'none')
 
         self.identity_popup.view.main.expander.click()
+        print "identity_popup.view.security=%s" % self.identity_popup.view.security
+        print "selected=%s" % self.identity_popup.view.security.selected
         Wait(self.marionette).until(lambda _: self.identity_popup.view.security.selected)
 
         security_view = self.identity_popup.view.security
 
         # Only the secure label is visible in the security view
         secure_label = security_view.secure_connection_label
         self.assertNotEqual(secure_label.value_of_css_property('display'), 'none')
 
         insecure_label = security_view.insecure_connection_label
         self.assertEqual(insecure_label.value_of_css_property('display'), 'none')
 
         # Check the organization name
-        self.assertEqual(security_view.owner.get_attribute('textContent'),
+        self.assertEqual(security_view.owner.get_property('textContent'),
                          cert['organization'])
 
         # Check the owner location string
         # More information:
         # hg.mozilla.org/mozilla-central/file/eab4a81e4457/browser/base/content/browser.js#l7012
         location = self.browser.get_property('identity.identified.state_and_country')
         location = location.replace('%S', address['state'], 1).replace('%S', address['country'])
         location = address['city'] + '\n' + location
-        self.assertEqual(security_view.owner_location.get_attribute('textContent'),
+        self.assertEqual(security_view.owner_location.get_property('textContent'),
                          location)
 
         # Check the verifier
         l10n_verifier = self.browser.get_property('identity.identified.verifier')
         l10n_verifier = l10n_verifier.replace('%S', cert['issuerOrganization'])
-        self.assertEqual(security_view.verifier.get_attribute('textContent'),
+        self.assertEqual(security_view.verifier.get_property('textContent'),
                          l10n_verifier)
 
         # Open the Page Info window by clicking the More Information button
         page_info = self.browser.open_page_info_window(
             lambda _: self.identity_popup.view.security.more_info_button.click())
 
         try:
             # Verify that the current panel is the security panel
             self.assertEqual(page_info.deck.selected_panel, page_info.deck.security)
 
             # Verify the domain listed on the security panel
             self.assertIn(cert['commonName'],
-                          page_info.deck.security.domain.get_attribute('value'))
+                          page_info.deck.security.domain.get_property('value'))
 
             # Verify the owner listed on the security panel
-            self.assertEqual(page_info.deck.security.owner.get_attribute('value'),
+            self.assertEqual(page_info.deck.security.owner.get_property('value'),
                              cert['organization'])
 
             # Verify the verifier listed on the security panel
-            self.assertEqual(page_info.deck.security.verifier.get_attribute('value'),
+            self.assertEqual(page_info.deck.security.verifier.get_property('value'),
                              cert['issuerOrganization'])
         finally:
             page_info.close()
             self.browser.focus()
--- a/testing/firefox-ui/tests/functional/security/test_mixed_script_content_blocking.py
+++ b/testing/firefox-ui/tests/functional/security/test_mixed_script_content_blocking.py
@@ -41,17 +41,17 @@ class TestMixedScriptContentBlocking(Pup
             color, identity, state = (
                 'rgb(255, 0, 0)',
                 'unknownIdentity mixedActiveContent',
                 'unblocked'
             )
 
         # First call to Wait() needs a longer timeout due to the reload of the web page.
         Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
-            lambda _: self.locationbar.identity_box.get_attribute('className') == identity,
+            lambda _: self.locationbar.identity_box.get_property('className') == identity,
             message='Expected identity "{}" not found'.format(identity)
         )
 
         with self.marionette.using_context('content'):
             for identifier, description in self.test_elements:
                 el = self.marionette.find_element(By.ID, identifier)
                 Wait(self.marionette).until(
                     lambda mn: el.value_of_css_property('color') == color,
--- a/testing/firefox-ui/tests/puppeteer/test_toolbars.py
+++ b/testing/firefox-ui/tests/puppeteer/test_toolbars.py
@@ -21,21 +21,21 @@ class TestNavBar(PuppeteerMixin, Marione
 
         # TODO: check why self.puppeteer.places.remove_all_history() does not work here
         self.marionette.execute_script("""
             let count = gBrowser.sessionHistory.count;
             gBrowser.sessionHistory.PurgeHistory(count);
         """)
 
     def test_elements(self):
-        self.assertEqual(self.navbar.back_button.get_attribute('localName'), 'toolbarbutton')
-        self.assertEqual(self.navbar.forward_button.get_attribute('localName'), 'toolbarbutton')
-        self.assertEqual(self.navbar.home_button.get_attribute('localName'), 'toolbarbutton')
-        self.assertEqual(self.navbar.menu_button.get_attribute('localName'), 'toolbarbutton')
-        self.assertEqual(self.navbar.toolbar.get_attribute('localName'), 'toolbar')
+        self.assertEqual(self.navbar.back_button.get_property('localName'), 'toolbarbutton')
+        self.assertEqual(self.navbar.forward_button.get_property('localName'), 'toolbarbutton')
+        self.assertEqual(self.navbar.home_button.get_property('localName'), 'toolbarbutton')
+        self.assertEqual(self.navbar.menu_button.get_property('localName'), 'toolbarbutton')
+        self.assertEqual(self.navbar.toolbar.get_property('localName'), 'toolbar')
 
     def test_buttons(self):
         self.marionette.set_context('content')
 
         # Load initial web page
         self.marionette.navigate(self.url)
         Wait(self.marionette).until(expected.element_present(lambda m:
                                     m.find_element(By.ID, 'mozilla_logo')))
@@ -80,34 +80,34 @@ class TestNavBar(PuppeteerMixin, Marione
 class TestLocationBar(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestLocationBar, self).setUp()
 
         self.locationbar = self.browser.navbar.locationbar
 
     def test_elements(self):
-        self.assertEqual(self.locationbar.urlbar.get_attribute('localName'), 'textbox')
-        self.assertIn('urlbar-input', self.locationbar.urlbar_input.get_attribute('className'))
+        self.assertEqual(self.locationbar.urlbar.get_property('localName'), 'textbox')
+        self.assertIn('urlbar-input', self.locationbar.urlbar_input.get_property('className'))
 
-        self.assertEqual(self.locationbar.connection_icon.get_attribute('localName'), 'image')
-        self.assertEqual(self.locationbar.identity_box.get_attribute('localName'), 'box')
-        self.assertEqual(self.locationbar.identity_country_label.get_attribute('localName'),
+        self.assertEqual(self.locationbar.connection_icon.get_property('localName'), 'image')
+        self.assertEqual(self.locationbar.identity_box.get_property('localName'), 'box')
+        self.assertEqual(self.locationbar.identity_country_label.get_property('localName'),
                          'label')
-        self.assertEqual(self.locationbar.identity_organization_label.get_attribute('localName'),
+        self.assertEqual(self.locationbar.identity_organization_label.get_property('localName'),
                          'label')
-        self.assertEqual(self.locationbar.identity_icon.get_attribute('localName'), 'image')
-        self.assertEqual(self.locationbar.history_drop_marker.get_attribute('localName'),
+        self.assertEqual(self.locationbar.identity_icon.get_property('localName'), 'image')
+        self.assertEqual(self.locationbar.history_drop_marker.get_property('localName'),
                          'dropmarker')
-        self.assertEqual(self.locationbar.reload_button.get_attribute('localName'),
+        self.assertEqual(self.locationbar.reload_button.get_property('localName'),
                          'toolbarbutton')
-        self.assertEqual(self.locationbar.stop_button.get_attribute('localName'),
+        self.assertEqual(self.locationbar.stop_button.get_property('localName'),
                          'toolbarbutton')
 
-        self.assertEqual(self.locationbar.contextmenu.get_attribute('localName'), 'menupopup')
+        self.assertEqual(self.locationbar.contextmenu.get_property('localName'), 'menupopup')
         self.assertEqual(self.locationbar.get_contextmenu_entry('paste').get_attribute('cmd'),
                          'cmd_paste')
 
     def test_reload(self):
         event_types = ["shortcut", "shortcut2", "button"]
         for event in event_types:
             # TODO: Until we have waitForPageLoad, this only tests API
             # compatibility.
@@ -157,17 +157,17 @@ class TestAutoCompleteResults(PuppeteerM
         # in the default profile.
         self.assertFalse(self.autocomplete_results.is_open)
         self.browser.navbar.locationbar.urlbar.send_keys('a')
         results = self.autocomplete_results.results
         Wait(self.marionette).until(lambda _: self.autocomplete_results.is_complete)
         visible_result_count = len(self.autocomplete_results.visible_results)
         self.assertTrue(visible_result_count > 0)
         self.assertEqual(visible_result_count,
-                         int(results.get_attribute('itemCount')))
+                         int(results.get_property('itemCount')))
 
     def test_close(self):
         self.browser.navbar.locationbar.urlbar.send_keys('a')
         Wait(self.marionette).until(lambda _: self.autocomplete_results.is_open)
         # The Wait in the library implementation will fail this if this doesn't
         # end up closing.
         self.autocomplete_results.close()
 
@@ -221,49 +221,49 @@ class TestIdentityPopup(PuppeteerMixin, 
         finally:
             super(TestIdentityPopup, self).tearDown()
 
     def test_elements(self):
         self.locationbar.open_identity_popup()
 
         # Test main view elements
         main = self.identity_popup.view.main
-        self.assertEqual(main.element.get_attribute('localName'), 'panelview')
+        self.assertEqual(main.element.get_property('localName'), 'panelview')
 
-        self.assertEqual(main.expander.get_attribute('localName'), 'button')
-        self.assertEqual(main.host.get_attribute('localName'), 'label')
-        self.assertEqual(main.insecure_connection_label.get_attribute('localName'),
+        self.assertEqual(main.expander.get_property('localName'), 'button')
+        self.assertEqual(main.host.get_property('localName'), 'label')
+        self.assertEqual(main.insecure_connection_label.get_property('localName'),
                          'description')
-        self.assertEqual(main.internal_connection_label.get_attribute('localName'),
+        self.assertEqual(main.internal_connection_label.get_property('localName'),
                          'description')
-        self.assertEqual(main.secure_connection_label.get_attribute('localName'),
+        self.assertEqual(main.secure_connection_label.get_property('localName'),
                          'description')
 
-        self.assertEqual(main.permissions.get_attribute('localName'), 'vbox')
+        self.assertEqual(main.permissions.get_property('localName'), 'vbox')
 
         # Test security view elements
         security = self.identity_popup.view.security
-        self.assertEqual(security.element.get_attribute('localName'), 'panelview')
+        self.assertEqual(security.element.get_property('localName'), 'panelview')
 
-        self.assertEqual(security.host.get_attribute('localName'), 'label')
-        self.assertEqual(security.insecure_connection_label.get_attribute('localName'),
+        self.assertEqual(security.host.get_property('localName'), 'label')
+        self.assertEqual(security.insecure_connection_label.get_property('localName'),
                          'description')
-        self.assertEqual(security.secure_connection_label.get_attribute('localName'),
+        self.assertEqual(security.secure_connection_label.get_property('localName'),
                          'description')
 
-        self.assertEqual(security.owner.get_attribute('localName'), 'description')
-        self.assertEqual(security.owner_location.get_attribute('localName'), 'description')
-        self.assertEqual(security.verifier.get_attribute('localName'), 'description')
+        self.assertEqual(security.owner.get_property('localName'), 'description')
+        self.assertEqual(security.owner_location.get_property('localName'), 'description')
+        self.assertEqual(security.verifier.get_property('localName'), 'description')
 
-        self.assertEqual(security.disable_mixed_content_blocking_button.get_attribute('localName'),
+        self.assertEqual(security.disable_mixed_content_blocking_button.get_property('localName'),
                          'button')
-        self.assertEqual(security.enable_mixed_content_blocking_button.get_attribute('localName'),
+        self.assertEqual(security.enable_mixed_content_blocking_button.get_property('localName'),
                          'button')
 
-        self.assertEqual(security.more_info_button.get_attribute('localName'), 'button')
+        self.assertEqual(security.more_info_button.get_property('localName'), 'button')
 
     def test_open_close(self):
         with self.marionette.using_context('content'):
             self.marionette.navigate(self.url)
 
         self.assertFalse(self.identity_popup.is_open)
 
         self.locationbar.open_identity_popup()
--- a/testing/firefox-ui/tests/puppeteer/test_update_wizard.py
+++ b/testing/firefox-ui/tests/puppeteer/test_update_wizard.py
@@ -31,32 +31,32 @@ class TestUpdateWizard(PuppeteerMixin, M
 
     def test_basic(self):
         self.assertEqual(self.dialog.window_type, 'Update:Wizard')
         self.assertNotEqual(self.dialog.dtds, [])
         self.assertNotEqual(self.dialog.properties, [])
 
     def test_elements(self):
         """Test correct retrieval of elements."""
-        self.assertEqual(self.wizard.element.get_attribute('localName'), 'wizard')
+        self.assertEqual(self.wizard.element.get_property('localName'), 'wizard')
 
         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'),
+            self.assertEqual(getattr(self.wizard, button).get_property('localName'),
                              'button')
 
         panels = ('checking', 'downloading', 'dummy', 'error_patching', 'error',
                   'error_extra', 'finished', 'finished_background',
                   'manual_update', 'no_updates_found', 'updates_found_basic',
                   )
         for panel in panels:
-            self.assertEqual(getattr(self.wizard, panel).element.get_attribute('localName'),
+            self.assertEqual(getattr(self.wizard, panel).element.get_property('localName'),
                              'wizardpage')
 
         # elements of the checking panel
-        self.assertEqual(self.wizard.checking.progress.get_attribute('localName'),
+        self.assertEqual(self.wizard.checking.progress.get_property('localName'),
                          'progressmeter')
 
         # elements of the downloading panel
-        self.assertEqual(self.wizard.downloading.progress.get_attribute('localName'),
+        self.assertEqual(self.wizard.downloading.progress.get_property('localName'),
                          'progressmeter')