Bug 1326236 - Use get_property() to retrieve the selectedIndex of decks and wizards. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 29 Dec 2016 20:02:57 +0100
changeset 454670 f071218bd87fd28124cf061928700c0590f05ec3
parent 454520 87efd66165ddaa1b97608b92cd651b73c11aca6f
child 540770 2a65206107c0ba00a14a3b37c4801451309b1690
push id39996
push userbmo:hskupin@gmail.com
push dateThu, 29 Dec 2016 21:49:14 +0000
bugs1326236, 1277090
milestone53.0a1
Bug 1326236 - Use get_property() to retrieve the selectedIndex of decks and wizards. Fix for a regression as introduced by bug 1277090. get_attribute() no longer returns values of Element properties. For the latter get_property() has to be used now. MozReview-Commit-ID: K45rcHDM6YC
testing/firefox-ui/tests/puppeteer/test_about_window.py
testing/firefox-ui/tests/puppeteer/test_update_wizard.py
testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/about_window/deck.py
testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
--- a/testing/firefox-ui/tests/puppeteer/test_about_window.py
+++ b/testing/firefox-ui/tests/puppeteer/test_about_window.py
@@ -1,13 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from firefox_puppeteer import PuppeteerMixin
+from firefox_puppeteer.ui.deck import Panel
 from marionette_harness import MarionetteTestCase
 
 
 class TestAboutWindow(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestAboutWindow, self).setUp()
 
@@ -48,16 +49,20 @@ class TestAboutWindow(PuppeteerMixin, Ma
         self.assertEqual(panel.button.get_property('localName'), 'button')
 
         # download_failed panel
         self.assertEqual(self.deck.download_failed.element.get_property('localName'), 'hbox')
 
         # downloading panel
         self.assertEqual(self.deck.downloading.element.get_property('localName'), 'hbox')
 
+        # check deck attributes
+        self.assertIsInstance(self.deck.selected_index, int)
+        self.assertIsInstance(self.deck.selected_panel, Panel)
+
     def test_open_window(self):
         """Test various opening strategies."""
         def opener(win):
             self.browser.menubar.select_by_id('helpMenu', 'aboutName')
 
         open_strategies = ('menu',
                            opener,
                            )
--- a/testing/firefox-ui/tests/puppeteer/test_update_wizard.py
+++ b/testing/firefox-ui/tests/puppeteer/test_update_wizard.py
@@ -1,13 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from firefox_puppeteer import PuppeteerMixin
+from firefox_puppeteer.ui.deck import Panel
 from firefox_puppeteer.ui.update_wizard import UpdateWizardDialog
 from marionette_harness import MarionetteTestCase
 
 
 class TestUpdateWizard(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestUpdateWizard, self).setUp()
@@ -55,8 +56,12 @@ class TestUpdateWizard(PuppeteerMixin, M
 
         # elements of the checking panel
         self.assertEqual(self.wizard.checking.progress.get_property('localName'),
                          'progressmeter')
 
         # elements of the downloading panel
         self.assertEqual(self.wizard.downloading.progress.get_property('localName'),
                          'progressmeter')
+
+        # check wizard attributes
+        self.assertIsInstance(self.wizard.selected_index, int)
+        self.assertIsInstance(self.wizard.selected_panel, Panel)
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/about_window/deck.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/about_window/deck.py
@@ -109,17 +109,17 @@ class Deck(UIBaseLib):
         return [self._create_panel_for_id(panel) for panel in panels]
 
     @property
     def selected_index(self):
         """The index of the currently selected panel.
 
         :return: Index of the selected panel.
         """
-        return int(self.element.get_attribute('selectedIndex'))
+        return int(self.element.get_property('selectedIndex'))
 
     @property
     def selected_panel(self):
         """A :class:`Panel` instance of the currently selected panel.
 
         :returns: :class:`Panel` instance.
         """
         return self.panels[self.selected_index]
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
@@ -202,17 +202,17 @@ class Wizard(UIBaseLib):
         return [self._create_panel_for_id(panel) for panel in panels]
 
     @property
     def selected_index(self):
         """The index of the currently selected panel.
 
         :return: Index of the selected panel.
         """
-        return int(self.element.get_attribute('pageIndex'))
+        return int(self.element.get_property('pageIndex'))
 
     @property
     def selected_panel(self):
         """A :class:`Panel` instance of the currently selected panel.
 
         :returns: :class:`Panel` instance.
         """
         return self._create_panel_for_id(self.element.get_attribute('currentpageid'))