How to use gaiatest - 10 common examples

To help you get started, we’ve selected a few gaiatest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / music / regions / tile_view.py View on Github external
# 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, By, Wait

from gaiatest.apps.base import Base
from gaiatest.apps.music.regions.player_view import PlayerView


class TileView(Base):

    _active_view_locator = (By.CSS_SELECTOR, 'iframe.active[src*="/views/home/index.html"]')
    _tile_group_locator = (By.ID, 'tiles')

    def __init__(self, marionette):
        Base.__init__(self, marionette)

        # there are two type of tiles - main and sub.  There should be at least one main tile
        self.marionette.switch_to_frame(self.marionette.find_element(*self._active_view_locator))
        Wait(self.marionette).until(expected.element_displayed(*self._tile_group_locator))
        self.apps.switch_to_displayed_app()

    def tap_song(self, filename):
        self.marionette.switch_to_frame(self.marionette.find_element(*self._active_view_locator))
        _pick_tile_locator = (By.CSS_SELECTOR, '.tile[data-file-path$="{}"]'.format(filename))
        self.marionette.find_element(*_pick_tile_locator).tap()
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / settings / regions / privacy_controls.py View on Github external
self.marionette.find_element(*self._about_back_header_locator).tap(25, 25)
        Wait(self.marionette).until(expected.element_displayed(*self._location_accuracy_menu_locator))

    def tap_loc_accuracy(self):
        self.marionette.find_element(*self._location_accuracy_menu_locator).tap()
        return self.LocationAccuracy(self.marionette)

    def tap_remote_protect(self):
        self.marionette.find_element(*self._remote_protection_menu_locator).tap()
        return self.RemoteProtection(self.marionette)

    def tap_trans_control(self):
        self.marionette.find_element(*self._trans_control_locator).tap()
        return self.TransparencyControl(self.marionette)

    class LocationAccuracy(Base):
        _page_locator = (By.ID, 'ala-main')
        _app_locator = (By.CSS_SELECTOR, '[data-manifest-name="Privacy Controls"]')
        _loc_adjust_enable_locator = (By.CLASS_NAME, 'show-when-geolocation-on')
        _loc_selection_locator = (By.NAME, 'geolocation.type')
        _ok_locator = (By.CLASS_NAME, 'value-option-confirm')
        _add_exceptions_menu_locator = (By.CSS_SELECTOR, '[data-l10n-id="add-exceptions"]')
        _exception_app_list = (By.ID, 'ala-exceptions')
        _first_app_locator = (By.CSS_SELECTOR, '#app-list > li:nth-child(2) > a:nth-child(1)')
        _app_info_locator = (By.CLASS_NAME, 'app-info')
        _app_view_locator = (By.ID, 'ala-exception')

        # no choice since the unique ID is being reused
        _global_settings_locator = \
            (By.CSS_SELECTOR,
             '#ala-exception > div:nth-child(2) > ul:nth-child(1) > '
             'li:nth-child(3) > p:nth-child(1) > span:nth-child(1)')
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / phone / regions / attention_screen.py View on Github external
# 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, By, Wait

from gaiatest.apps.base import Base


class AttentionScreen(Base):

    _message_locator = (By.ID, 'message')

    def __init__(self, marionette):
        Base.__init__(self, marionette)
        Wait(self.marionette).until(
            expected.element_displayed(*self._message_locator))

    @property
    def message(self):
        return self.marionette.find_element(*self._message_locator).text
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / system / regions / facebook.py View on Github external
# 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, By, Wait

from gaiatest.apps.base import Base


class FacebookLogin(Base):

    _iframe_locator = (By.CSS_SELECTOR, 'iframe[data-url*="m.facebook.com"]')
    _div_locator = (By.CSS_SELECTOR, 'div')
    _email_locator = (By.CSS_SELECTOR, 'input[placeholder^="Email"]')
    _password_locator = (By.CSS_SELECTOR, 'input[placeholder^="Password"]')
    _submit_locator = (By.CSS_SELECTOR, '*[type="submit"]')

    def __init__(self, marionette):
        Base.__init__(self, marionette)
        self.marionette.switch_to_frame()

        # wait for the pop up screen to open
        view = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._iframe_locator))
        Wait(self.marionette).until(expected.element_displayed(view))
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / email / regions / setup.py View on Github external
# 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, By, Wait

from gaiatest.apps.base import Base


class SetupEmail(Base):

    _name_locator = (By.CSS_SELECTOR, 'cards-setup-account-info input.sup-info-name')
    _email_locator = (By.CSS_SELECTOR, 'cards-setup-account-info input.sup-info-email')
    _next_locator = (By.CSS_SELECTOR, '.sup-info-next-btn')
    _continue_button_locator = ('class name', 'sup-show-mail-btn sup-form-btn recommend')
    _check_for_new_messages_locator = (By.CSS_SELECTOR, '.tng-account-check-interval.mail-select')
    _account_prefs_section_locator = (By.CSS_SELECTOR, 'cards-setup-account-prefs section')
    _account_prefs_next_locator = (By.CSS_SELECTOR, 'cards-setup-account-prefs .sup-info-next-btn')
    _done_section_locator = (By.CSS_SELECTOR, 'cards-setup-done section')

    def __init__(self, marionette):
        Base.__init__(self, marionette)
        Wait(self.marionette).until(expected.element_displayed(
            Wait(self.marionette).until(expected.element_present(
                *self._name_locator))))
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / email / regions / new_email.py View on Github external
def __init__(self, marionette):
        Base.__init__(self, marionette)
        view = self.marionette.find_element(*self._view_locator)
        Wait(self.marionette).until(lambda m: view.location['x'] == 0)
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / cost_control / regions / ftu_step1.py View on Github external
def __init__(self, marionette):
        Base.__init__(self, marionette)
        title = self.marionette.find_element(*self._welcome_title_locator)
        Wait(self.marionette).until(lambda m: title.location['x'] == 0)
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / settings / regions / keyboard.py View on Github external
def __init__(self, marionette):
        Base.__init__(self, marionette)
        section = self.marionette.find_element(*self._section_locator)
        Wait(self.marionette).until(lambda m: section.location['x'] == 0)
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / messages / regions / messaging_settings.py View on Github external
def __init__(self, marionette):
        Base.__init__(self, marionette)
        Wait(self.marionette).until(expected.element_displayed(
            Wait(self.marionette).until(expected.element_present(
                *self._messaging_settings_locator))))
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / music / regions / sublist_view.py View on Github external
def __init__(self, marionette):
        Base.__init__(self, marionette)
        element = self.marionette.find_element(*self._song_number_locator)
        Wait(self.marionette).until(lambda m: element.location['x'] == 0)