Bug 1313312 - Refactor puppeteer module for UI base lib classes. r=maja_zf

MozReview-Commit-ID: Kd1VHzCnT2X

--HG--
rename : testing/puppeteer/firefox/firefox_puppeteer/ui_base_lib.py => testing/puppeteer/firefox/firefox_puppeteer/ui/base.py
extra : rebase_source : a3a450c5425c3cfc1d6e2ef39a1dc0ab07b58f77
This commit is contained in:
Henrik Skupin 2016-11-04 16:00:20 +01:00
Родитель 4ce68bc581
Коммит d26e078627
10 изменённых файлов: 28 добавлений и 31 удалений

Просмотреть файл

@ -2,8 +2,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file, # 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/. # You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver.marionette import HTMLElement
from decorators import use_class_as_property from decorators import use_class_as_property
@ -90,23 +88,3 @@ class Puppeteer(object):
See the :class:`~ui.window.Windows` reference. 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

Просмотреть файл

@ -4,7 +4,7 @@
from marionette_driver import By 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 from firefox_puppeteer.ui.deck import Panel

Просмотреть файл

@ -35,3 +35,23 @@ class UIBaseLib(BaseLib):
:returns: :class:`BaseWindow` instance of the chrome window. :returns: :class:`BaseWindow` instance of the chrome window.
""" """
return self._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

Просмотреть файл

@ -6,7 +6,7 @@ from abc import ABCMeta
from marionette_driver import By from marionette_driver import By
from firefox_puppeteer.ui_base_lib import UIBaseLib from firefox_puppeteer.ui.base import UIBaseLib
class BaseNotification(UIBaseLib): class BaseNotification(UIBaseLib):

Просмотреть файл

@ -10,9 +10,8 @@ from marionette_driver.errors import NoSuchElementException
import firefox_puppeteer.errors as errors import firefox_puppeteer.errors as errors
from firefox_puppeteer import DOMElement
from firefox_puppeteer.api.security import Security 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): class TabBar(UIBaseLib):

Просмотреть файл

@ -4,7 +4,7 @@
from marionette_driver import By, keys, Wait 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): class NavBar(UIBaseLib):

Просмотреть файл

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file, # 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/. # 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): class Panel(UIBaseLib):

Просмотреть файл

@ -5,8 +5,8 @@
from marionette_driver import By from marionette_driver import By
from marionette_driver.errors import NoSuchElementException from marionette_driver.errors import NoSuchElementException
from firefox_puppeteer import DOMElement
from firefox_puppeteer.base import BaseLib from firefox_puppeteer.base import BaseLib
from firefox_puppeteer.ui.base import DOMElement
class MenuBar(BaseLib): class MenuBar(BaseLib):

Просмотреть файл

@ -4,7 +4,7 @@
from marionette_driver import By, Wait 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 from firefox_puppeteer.ui.deck import Panel

Просмотреть файл

@ -4,7 +4,7 @@
from marionette_driver import By, Wait 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 from firefox_puppeteer.ui.deck import Panel