Bug 1313312 - Refactor puppeteer module for UI base lib classes. draft
authorHenrik Skupin <mail@hskupin.info>
Fri, 04 Nov 2016 16:00:20 +0100
changeset 434821 b693673578be7952596020d0dd4021d0425a038e
parent 434636 908557c762f798605a2f96e4c943791cbada1b50
child 434822 1382eb83ab8e9d8043ed2850de155d781f67e14b
child 434828 800ba2b14e0ffff430c1dbc78af7d43e406de5f8
child 434947 a4144888d83c5a0f9f0bf7d83e23771c61c1f542
push id34839
push userbmo:hskupin@gmail.com
push dateMon, 07 Nov 2016 14:03:33 +0000
bugs1313312
milestone52.0a1
Bug 1313312 - Refactor puppeteer module for UI base lib classes. MozReview-Commit-ID: Kd1VHzCnT2X
testing/puppeteer/firefox/firefox_puppeteer/__init__.py
testing/puppeteer/firefox/firefox_puppeteer/ui/about_window/deck.py
testing/puppeteer/firefox/firefox_puppeteer/ui/base.py
testing/puppeteer/firefox/firefox_puppeteer/ui/browser/notifications.py
testing/puppeteer/firefox/firefox_puppeteer/ui/browser/tabbar.py
testing/puppeteer/firefox/firefox_puppeteer/ui/browser/toolbars.py
testing/puppeteer/firefox/firefox_puppeteer/ui/deck.py
testing/puppeteer/firefox/firefox_puppeteer/ui/menu.py
testing/puppeteer/firefox/firefox_puppeteer/ui/pageinfo/deck.py
testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
testing/puppeteer/firefox/firefox_puppeteer/ui_base_lib.py
--- a/testing/puppeteer/firefox/firefox_puppeteer/__init__.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/__init__.py
@@ -1,14 +1,12 @@
 # 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 marionette_driver.marionette import HTMLElement
-
 from decorators import use_class_as_property
 
 
 __version__ = '52.0.0'
 
 
 class Puppeteer(object):
     """The puppeteer class is used to expose libraries to test cases.
@@ -85,28 +83,8 @@ class Puppeteer(object):
 
     @use_class_as_property('ui.windows.Windows')
     def windows(self):
         """
         Provides shortcuts to the top-level windows.
 
         See the :class:`~ui.window.Windows` reference.
         """
-
-
-class DOMElement(HTMLElement):
-    """
-    Class that inherits from HTMLElement and provides a way for subclasses to
-    expose new api's.
-    """
-
-    def __new__(cls, element):
-        instance = object.__new__(cls)
-        instance.__dict__ = element.__dict__.copy()
-        setattr(instance, 'inner', element)
-
-        return instance
-
-    def __init__(self, element):
-        pass
-
-    def get_marionette(self):
-        return self.marionette
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/about_window/deck.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/about_window/deck.py
@@ -1,15 +1,15 @@
 # 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 marionette_driver import By
 
-from firefox_puppeteer.ui_base_lib import UIBaseLib
+from firefox_puppeteer.ui.base import UIBaseLib
 from firefox_puppeteer.ui.deck import Panel
 
 
 class Deck(UIBaseLib):
 
     def _create_panel_for_id(self, panel_id):
         """Creates an instance of :class:`Panel` for the specified panel id.
 
rename from testing/puppeteer/firefox/firefox_puppeteer/ui_base_lib.py
rename to testing/puppeteer/firefox/firefox_puppeteer/ui/base.py
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui_base_lib.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/base.py
@@ -30,8 +30,28 @@ class UIBaseLib(BaseLib):
 
     @property
     def window(self):
         """Returns the reference to the chrome window.
 
         :returns: :class:`BaseWindow` instance of the chrome window.
         """
         return self._window
+
+
+class DOMElement(HTMLElement):
+    """
+    Class that inherits from HTMLElement and provides a way for subclasses to
+    expose new api's.
+    """
+
+    def __new__(cls, element):
+        instance = object.__new__(cls)
+        instance.__dict__ = element.__dict__.copy()
+        setattr(instance, 'inner', element)
+
+        return instance
+
+    def __init__(self, element):
+        pass
+
+    def get_marionette(self):
+        return self.marionette
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/notifications.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/notifications.py
@@ -1,17 +1,17 @@
 # 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 abc import ABCMeta
 
 from marionette_driver import By
 
-from firefox_puppeteer.ui_base_lib import UIBaseLib
+from firefox_puppeteer.ui.base import UIBaseLib
 
 
 class BaseNotification(UIBaseLib):
     """Abstract base class for any kind of notification."""
 
     __metaclass__ = ABCMeta
 
     @property
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/tabbar.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/tabbar.py
@@ -5,19 +5,18 @@
 from marionette_driver import (
     By, Wait
 )
 
 from marionette_driver.errors import NoSuchElementException
 
 import firefox_puppeteer.errors as errors
 
-from firefox_puppeteer import DOMElement
 from firefox_puppeteer.api.security import Security
-from firefox_puppeteer.ui_base_lib import UIBaseLib
+from firefox_puppeteer.ui.base import UIBaseLib, DOMElement
 
 
 class TabBar(UIBaseLib):
     """Wraps the tabs toolbar DOM element inside a browser window."""
 
     # Properties for visual elements of the tabs toolbar #
 
     @property
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/toolbars.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/toolbars.py
@@ -1,15 +1,15 @@
 # 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 marionette_driver import By, keys, Wait
 
-from firefox_puppeteer.ui_base_lib import UIBaseLib
+from firefox_puppeteer.ui.base import UIBaseLib
 
 
 class NavBar(UIBaseLib):
     """Provides access to the DOM elements contained in the
     navigation bar as well as the location bar."""
 
     def __init__(self, *args, **kwargs):
         UIBaseLib.__init__(self, *args, **kwargs)
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/deck.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/deck.py
@@ -1,13 +1,13 @@
 # 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.ui_base_lib import UIBaseLib
+from firefox_puppeteer.ui.base import UIBaseLib
 
 
 class Panel(UIBaseLib):
 
     def __eq__(self, other):
         return self.element.get_attribute('id') == other.element.get_attribute('id')
 
     def __ne__(self, other):
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/menu.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/menu.py
@@ -1,17 +1,17 @@
 # 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 marionette_driver import By
 from marionette_driver.errors import NoSuchElementException
 
-from firefox_puppeteer import DOMElement
 from firefox_puppeteer.base import BaseLib
+from firefox_puppeteer.ui.base import DOMElement
 
 
 class MenuBar(BaseLib):
     """Wraps the menubar DOM element inside a browser window."""
 
     @property
     def menus(self):
         """A list of :class:`MenuElement` instances corresponding to
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/pageinfo/deck.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/pageinfo/deck.py
@@ -1,15 +1,15 @@
 # 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 marionette_driver import By, Wait
 
-from firefox_puppeteer.ui_base_lib import UIBaseLib
+from firefox_puppeteer.ui.base import UIBaseLib
 from firefox_puppeteer.ui.deck import Panel
 
 
 class Deck(UIBaseLib):
 
     def _create_panel_for_id(self, panel_id):
         """Creates an instance of :class:`Panel` for the specified panel id.
 
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
@@ -1,15 +1,15 @@
 # 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 marionette_driver import By, Wait
 
-from firefox_puppeteer.ui_base_lib import UIBaseLib
+from firefox_puppeteer.ui.base import UIBaseLib
 from firefox_puppeteer.ui.deck import Panel
 
 
 class Wizard(UIBaseLib):
 
     def __init__(self, *args, **kwargs):
         UIBaseLib.__init__(self, *args, **kwargs)