How to use the gaiatest.apps.phone.app.Phone function in gaiatest

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 / phone / regions / keypad.py View on Github external
expected.element_present(*self._call_bar_locator))
        Wait(self.marionette).until(expected.element_enabled(element))
        element.tap()
        if switch_to_call_screen:
            return CallScreen(self.marionette)

    def a11y_click_call_button(self, switch_to_call_screen=True):
        self.accessibility.click(self.marionette.find_element(*self._call_bar_locator))
        if switch_to_call_screen:
            return CallScreen(self.marionette)


from gaiatest.apps.phone.app import Phone


class Keypad(BaseKeypad, Phone):

    _add_new_contact_button_locator = (By.ID, 'keypad-callbar-add-contact')
    _search_popup_locator = (By.CSS_SELECTOR, '#suggestion-bar .js-suggestion-item')
    _suggested_contact_name_locator = (By.CSS_SELECTOR, '#suggestion-bar .js-suggestion-item .js-name')
    _suggested_contact_phone_number_locator = (By.CSS_SELECTOR, '#suggestion-bar .js-suggestion-item .js-tel')

    def __init__(self, marionette):
        Phone.__init__(self, marionette)
        self.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()
        keypad_toolbar_button = self.marionette.find_element(*self._keypad_toolbar_button_locator)
        Wait(self.marionette).until(lambda m: 'toolbar-option-selected' in keypad_toolbar_button.get_attribute('class'))

    def tap_add_contact(self):
        self.marionette.find_element(*self._add_new_contact_button_locator).tap()
        return AddNewNumber(self.marionette)
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / phone / regions / call_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 marionette_driver.marionette import Actions

from gaiatest.apps.phone.app import Phone


class CallScreen(Phone):

    MAX_NUMBER_OF_DISPLAYED_DIGITS = 22

    _call_screen_locator = (By.CSS_SELECTOR, "iframe[name='call_screen']")
    # The name of this ID is due to historical reason, back in the time when
    # the CallScreen was not an attention screen. We need to update it once
    # bug 1118787 lands.
    _main_window_locator = (By.ID, 'call-screen')
    _call_options_locator = (By.ID, 'call-options')
    _calling_contact_locator = (By.CSS_SELECTOR, 'div.number')
    _calling_contact_information_locator = (By.CSS_SELECTOR, 'div.additionalContactInfo')
    _outgoing_call_locator = (By.CSS_SELECTOR, '.handled-call.outgoing')
    _incoming_call_locator = (By.CSS_SELECTOR, '.handled-call.incoming')
    _hangup_bar_locator = (By.ID, 'callbar-hang-up')
    _answer_bar_locator = (By.ID, 'callbar-answer')
    _lockscreen_handle_locator = (By.ID, 'lockscreen-area-slide')
github mozilla-b2g / gaia / tests / python / gaia-ui-tests / gaiatest / apps / phone / regions / call_log.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 marionette_driver.errors import StaleElementException

from gaiatest.apps.phone.app import Phone
from gaiatest.apps.base import PageRegion
from gaiatest.form_controls.binarycontrol import HtmlBinaryControl


class CallLog(Phone):

    _upgrade_progress_locator = (By.ID, 'call-log-upgrading')
    _call_log_edit_button_locator = (By.ID, 'call-log-icon-edit')
    _call_log_header_locator = (By.ID, 'header-edit-mode-text')
    _no_logs_message_locator = (By.ID, 'no-result-msg1')

    _call_log_groups_locator = (By.CSS_SELECTOR, '#call-log-container section')

    _call_log_edit_dialog_locator = (By.ID, 'edit-mode')
    _call_log_edit_delete_button_locator = (By.ID, 'delete-button')
    _call_log_edit_close_button_locator = (By.ID, 'call-log-icon-close')
    _call_log_edit_deselect_all_button_locator = (By.ID, 'deselect-all-threads')
    _call_log_edit_select_all_button_locator = (By.ID, 'select-all-threads')

    _call_log_delete_confirmation_locator = (By.CSS_SELECTOR, 'button.danger[data-l10n-id="delete"]')