Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
1
gaia/tests/python/gaia-ui-tests/gaiatest/form_controls/__init__.py
Executable file
1
gaia/tests/python/gaia-ui-tests/gaiatest/form_controls/__init__.py
Executable file
|
|
@ -0,0 +1 @@
|
|||
|
||||
66
gaia/tests/python/gaia-ui-tests/gaiatest/form_controls/binarycontrol.py
Executable file
66
gaia/tests/python/gaia-ui-tests/gaiatest/form_controls/binarycontrol.py
Executable file
|
|
@ -0,0 +1,66 @@
|
|||
# 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, abstractproperty
|
||||
from marionette_driver import Wait, expected
|
||||
from gaiatest.form_controls.form_control import Widget
|
||||
|
||||
|
||||
class BinaryControl(Widget):
|
||||
# This represent elements like Switches and Checkboxes
|
||||
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
@abstractproperty
|
||||
def is_checked(self):
|
||||
pass
|
||||
|
||||
@abstractproperty
|
||||
def is_enabled(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def is_displayed(self):
|
||||
return self.root_element.is_displayed()
|
||||
|
||||
def enable(self):
|
||||
self._toggle_and_verify_state(final_state=True)
|
||||
|
||||
def disable(self):
|
||||
self._toggle_and_verify_state(final_state=False)
|
||||
|
||||
def wait_to_be_ready(self):
|
||||
Wait(self.marionette).until(expected.element_displayed(self.root_element))
|
||||
Wait(self.marionette).until(lambda m: self.is_enabled)
|
||||
|
||||
def _toggle_and_verify_state(self, final_state):
|
||||
self.wait_to_be_ready()
|
||||
Wait(self.marionette).until(lambda m: self.is_checked is not final_state)
|
||||
self._toggle()
|
||||
Wait(self.marionette).until(lambda m: self.is_checked is final_state)
|
||||
self.wait_to_be_ready()
|
||||
|
||||
def _toggle(self):
|
||||
self.root_element.tap()
|
||||
|
||||
|
||||
class GaiaBinaryControl(BinaryControl):
|
||||
@property
|
||||
def is_checked(self):
|
||||
# Change for a more standard method, once Bug 1113742 lands
|
||||
return self.marionette.execute_script('return arguments[0].wrappedJSObject.checked', [self.root_element])
|
||||
|
||||
@property
|
||||
def is_enabled(self):
|
||||
# Change for a more standard method, once Bug 1113742 lands
|
||||
return self.marionette.execute_script('return arguments[0].wrappedJSObject.disabled != true', [self.root_element])
|
||||
|
||||
class HtmlBinaryControl(BinaryControl):
|
||||
@property
|
||||
def is_checked(self):
|
||||
return self.root_element.is_selected()
|
||||
|
||||
@property
|
||||
def is_enabled(self):
|
||||
return self.root_element.is_enabled()
|
||||
15
gaia/tests/python/gaia-ui-tests/gaiatest/form_controls/form_control.py
Executable file
15
gaia/tests/python/gaia-ui-tests/gaiatest/form_controls/form_control.py
Executable file
|
|
@ -0,0 +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 expected, Wait
|
||||
from gaiatest.apps.base import PageRegion
|
||||
|
||||
|
||||
class Widget(PageRegion):
|
||||
def __init__(self, marionette, locator):
|
||||
if type(locator) is tuple:
|
||||
element = Wait(marionette).until(expected.element_present(*locator))
|
||||
else:
|
||||
element = locator
|
||||
PageRegion.__init__(self, marionette, element)
|
||||
34
gaia/tests/python/gaia-ui-tests/gaiatest/form_controls/header.py
Executable file
34
gaia/tests/python/gaia-ui-tests/gaiatest/form_controls/header.py
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
# 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, expected
|
||||
from gaiatest.form_controls.form_control import Widget
|
||||
|
||||
|
||||
class GaiaHeader(Widget):
|
||||
|
||||
_back_button_locator = (By.CSS_SELECTOR, 'button.action-button')
|
||||
_close_button_locator = (By.CSS_SELECTOR, 'button[type="reset"]')
|
||||
|
||||
def go_back(self,app=None, exit_app=False, statusbar=False):
|
||||
Wait(self.marionette).until(expected.element_enabled(self.root_element) and
|
||||
expected.element_displayed(self.root_element))
|
||||
self.marionette.switch_to_shadow_root(self.root_element)
|
||||
element = self.marionette.find_element(*self._back_button_locator)
|
||||
_back_button_present = True
|
||||
|
||||
if not element.is_displayed(): # This header has a close button instead of a back button
|
||||
self.marionette.switch_to_shadow_root()
|
||||
element = self.root_element.find_element(*self._close_button_locator)
|
||||
_back_button_present = False
|
||||
|
||||
if exit_app:
|
||||
self.tap_element_from_system_app(element, statusbar)
|
||||
app.wait_to_not_be_displayed()
|
||||
self.apps.switch_to_displayed_app()
|
||||
else:
|
||||
element.tap()
|
||||
if _back_button_present:
|
||||
self.marionette.switch_to_shadow_root()
|
||||
Wait(self.marionette).until(expected.element_not_displayed(self.root_element))
|
||||
Loading…
Reference in a new issue