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:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,344 @@
# 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.form_controls.header import GaiaHeader
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class Settings(Base):
name = 'Settings'
_header_locator = (By.CSS_SELECTOR, '.current gaia-header')
_page_locator = (By.ID, 'root')
_header_text_locator = (By.CSS_SELECTOR, '#root > gaia-header > h1')
_data_text_locator = (By.ID, 'data-desc')
_wifi_text_locator = (By.ID, 'wifi-desc')
_battery_text_locator = (By.ID, 'battery-desc')
_application_storage_text_locator = (By.CSS_SELECTOR, '.application-storage-desc')
_media_storage_text_locator = (By.ID, 'media-storage-desc')
_usb_storage_text_locator = (By.CSS_SELECTOR, '.usb-desc')
_screen_lock_text_locator = (By.CSS_SELECTOR, '.screenLock-desc')
_language_text_locator = (By.ID, 'language-desc')
_bluetooth_text_locator = (By.CSS_SELECTOR, '.bluetooth-desc')
_app_loaded_locator = (By.CSS_SELECTOR, 'body[data-ready="true"]')
_airplane_switch_locator = (By.CSS_SELECTOR, 'gaia-switch.airplaneMode-input')
_usb_storage_switch_locator = (By.CSS_SELECTOR, ".pack-split.usb-item .pack-switch")
_usb_storage_checkbox_locator = (By.CSS_SELECTOR, ".usb-switch")
_usb_storage_confirm_button_locator = (By.CSS_SELECTOR, "button.ums-confirm-option")
_usb_storage_cancel_button_locator = (By.CSS_SELECTOR, "button.ums-cancel-option")
_gps_switch_locator = (By.CSS_SELECTOR, 'gaia-switch[name="geolocation.enabled"]')
# Following menu item list matches the menu item order in the settings app
_wifi_menu_item_locator = (By.ID, 'menuItem-wifi')
_sim_manager_menu_item_locator = (By.ID, 'menuItem-simManager')
_call_settings_menu_item_locator = (By.ID, 'menuItem-callSettings')
_message_settings_menu_item_locator = (By.ID, 'menuItem-messagingSettings')
_cell_data_menu_item_locator = (By.ID, 'menuItem-cellularAndData')
_bluetooth_menu_item_locator = (By.ID, 'menuItem-bluetooth')
_internet_sharing_menu_item_locator = (By.ID, 'menuItem-internetSharing')
_sound_menu_item_locator = (By.ID, 'menuItem-sound')
_display_menu_item_locator = (By.ID, 'menuItem-display')
_homescreen_menu_item_locator = (By.ID, 'menuItem-homescreens')
_search_menu_item_locator = (By.ID, 'menuItem-search')
_navigation_menu_item_locator = (By.ID, 'menuItem-navigation')
_notification_menu_item_locator = (By.ID, 'menuItem-notifications')
_date_and_time_menu_item_locator = (By.ID, 'menuItem-dateAndTime')
_language_menu_item_locator = (By.CSS_SELECTOR, '.menuItem-languageAndRegion')
_keyboard_menu_item_locator = (By.ID, "menuItem-keyboard")
_theme_menu_item_locator = (By.ID, "menuItem-themes")
_addon_menu_item_locator = (By.ID, "menuItem-addons")
_achievements_menu_item_locator = (By.ID, "achievements-section")
_firefox_accounts_menu_item_locator = (By.ID, "menuItem-fxa")
_findmydevice_locator = (By.ID, 'menuItem-findmydevice')
_screen_lock_menu_item_locator = (By.ID, 'menuItem-screenLock')
_app_permission_menu_item_locator = (By.ID, 'menuItem-appPermissions')
_do_not_track_menu_item_locator = (By.ID, 'menuItem-doNotTrack')
_browsing_privacy_item_locator = (By.ID, 'menuItem-browsingPrivacy')
_privacy_controls_item_locator = (By.ID, 'menuItem-privacyPanel')
_usb_storage_menu_item_locator = (By.CSS_SELECTOR, '.menuItem-enableStorage')
_media_storage_menu_item_locator = (By.CSS_SELECTOR, '.menuItem-mediaStorage')
_application_storage_menu_item_locator = (By.CSS_SELECTOR, '.menuItem-applicationStorage')
_device_info_menu_item_locator = (By.ID, 'menuItem-deviceInfo')
_downloads_menu_item_locator = (By.ID, 'menuItem-downloads')
_battery_menu_item_locator = (By.CSS_SELECTOR, '.menuItem-battery')
_accessibility_menu_item_locator = (By.ID, 'menuItem-accessibility')
_developer_menu_item_locator = (By.ID, 'menuItem-developer')
_improve_menu_item_locator = (By.ID, 'menuItem-improveBrowserOS')
_help_menu_item_locator = (By.ID, 'menuItem-help')
_main_title_locator = (By.ID, 'main-list-title')
def __init__(self, marionette):
Base.__init__(self, marionette)
def launch(self):
Base.launch(self)
Wait(self.marionette).until(
expected.element_present(*self._app_loaded_locator))
# Airplane mode is the latest item to be ready
self.wait_for_airplane_mode_ready()
def switch_to_settings_app(self):
self.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
def enable_airplane_mode(self):
self._airplane_checkbox.enable()
def disable_airplane_mode(self):
self._airplane_checkbox.disable()
def wait_for_airplane_mode_ready(self):
self._airplane_checkbox.wait_to_be_ready()
def wait_until_wifi_is_connected_to(self, ssid):
wifi_status_label = self.marionette.find_element(*self._wifi_text_locator)
Wait(self.marionette).until(lambda m: wifi_status_label.get_attribute('data-l10n-id') == 'full-status-connected' and ssid in wifi_status_label.get_attribute('data-l10n-args'))
@property
def is_airplane_mode_displayed(self):
return self._airplane_checkbox.is_displayed
@property
def _airplane_checkbox(self):
return GaiaBinaryControl(self.marionette, self._airplane_switch_locator)
def enable_gps(self):
return self._gps_checkbox.enable()
def disable_gps(self):
return self._gps_checkbox.disable()
@property
def _gps_checkbox(self):
return GaiaBinaryControl(self.marionette, self._gps_switch_locator)
@property
def header_text(self):
return self.marionette.find_element(*self._header_text_locator).text
@property
def cell_data_menu_item_description(self):
return self.marionette.find_element(*self._data_text_locator).text
@property
def wifi_menu_item_description(self):
return self.marionette.find_element(*self._wifi_text_locator).text
@property
def battery_menu_item_description(self):
return self.marionette.find_element(*self._battery_text_locator).text
@property
def application_storage_menu_item_description(self):
return self.marionette.find_element(*self._application_storage_text_locator).text
@property
def media_storage_menu_item_description(self):
return self.marionette.find_element(*self._media_storage_text_locator).text
@property
def usb_storage_menu_item_description(self):
return self.marionette.find_element(*self._usb_storage_text_locator).text
@property
def screen_lock_menu_item_description(self):
return self.marionette.find_element(*self._screen_lock_text_locator).text
@property
def language_menu_item_description(self):
return self.marionette.find_element(*self._language_text_locator).text
@property
def bluetooth_menu_item_description(self):
return self.marionette.find_element(*self._bluetooth_text_locator).text
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def title(self):
return self.marionette.find_element(*self._main_title_locator)
@property
def current_view(self):
return self.marionette.find_element(By.CLASS_NAME, 'current').get_attribute('id')
def open_wifi(self):
return self._open_subpage(self._wifi_menu_item_locator, 'wifi', 'Wifi')
def open_sim_manager(self):
return self._open_subpage(self._sim_manager_menu_item_locator, 'sim_manager', 'SimManager')
def open_call(self):
return self._open_subpage(self._call_settings_menu_item_locator, 'call_settings', 'CallSettings')
def open_message(self):
return self._open_subpage(self._message_settings_menu_item_locator, 'message', 'Message')
def open_cell_and_data(self):
return self._open_subpage(self._cell_data_menu_item_locator, 'cell_data', 'CellData')
def open_cell_and_data_dual_sim(self):
return self._open_subpage(self._cell_data_menu_item_locator, 'cell_data', 'CellDataDualSim')
def open_bluetooth(self):
return self._open_subpage(self._bluetooth_menu_item_locator, 'bluetooth', 'Bluetooth')
def open_internet_sharing(self):
return self._open_subpage(self._internet_sharing_menu_item_locator, 'internet_sharing', 'InternetSharing')
def open_sound(self):
return self._open_subpage(self._sound_menu_item_locator, 'sound', 'Sound')
def open_display(self):
return self._open_subpage(self._display_menu_item_locator, 'display', 'Display')
def open_homescreen(self):
return self._open_subpage(self._homescreen_menu_item_locator, 'homescreen_settings',
'HomescreenSettings')
def open_search(self):
return self._open_subpage(self._search_menu_item_locator, 'search', 'Search')
def open_navigation(self):
return self._open_subpage(self._navigation_menu_item_locator, 'navigation', 'Navigation')
def open_notification(self):
return self._open_subpage(self._notification_menu_item_locator, 'notifications', 'Notifications')
def open_date_and_time(self):
return self._open_subpage(self._date_and_time_menu_item_locator, 'date_and_time', 'DateAndTime')
def open_language(self):
language_menu = self._open_subpage(self._language_menu_item_locator, 'language', 'Language')
language_menu.wait_for_languages_to_load()
return language_menu
def open_keyboard(self):
return self._open_subpage(self._keyboard_menu_item_locator, 'keyboard', 'Keyboard')
def open_themes(self):
return self._open_subpage(self._theme_menu_item_locator, 'themes', 'Themes')
def open_addons(self):
return self._open_subpage(self._addon_menu_item_locator, 'addons', 'Addons')
def open_achievements(self):
return self._open_subpage(self._achievements_menu_item_locator)
def open_firefox_accounts(self):
return self._open_subpage(self._firefox_accounts_menu_item_locator)
def open_findmydevice(self):
return self._open_subpage(self._findmydevice_locator, 'findmydevice', 'FindMyDevice')
def open_screen_lock(self):
return self._open_subpage(self._screen_lock_menu_item_locator, 'screen_lock', 'ScreenLock')
def open_app_permissions(self):
return self._open_subpage(self._app_permission_menu_item_locator, 'app_permission', 'AppPermission')
def open_do_not_track(self):
return self._open_subpage(self._do_not_track_menu_item_locator, 'do_not_track', 'DoNotTrack')
def open_browsing_privacy(self):
return self._open_subpage(self._browsing_privacy_item_locator, 'browsing_privacy', 'BrowsingPrivacy')
def open_privacy_controls(self):
return self._open_subpage(self._privacy_controls_item_locator, 'privacy_controls', 'PrivacyControls')
def open_usb_storage(self):
return self._open_subpage(self._usb_storage_menu_item_locator, 'usb_storage', 'USBStorage')
def open_media_storage(self):
return self._open_subpage(self._media_storage_menu_item_locator, 'media_storage', 'MediaStorage')
def open_application_storage(self):
return self._open_subpage(self._application_storage_menu_item_locator)
def open_device_info(self):
return self._open_subpage(self._device_info_menu_item_locator, 'device_info', 'DeviceInfo')
def open_downloads(self):
return self._open_subpage(self._downloads_menu_item_locator, 'downloads', 'Downloads')
def open_battery(self):
return self._open_subpage(self._battery_menu_item_locator, 'battery', 'Battery')
def open_accessibility(self):
return self._open_subpage(self._accessibility_menu_item_locator, 'accessibility', 'Accessibility')
def open_developer(self):
return self._open_subpage(self._developer_menu_item_locator)
def open_improve(self):
return self._open_subpage(self._improve_menu_item_locator, 'improve', 'Improve')
def open_help(self):
return self._open_subpage(self._help_menu_item_locator)
def _open_subpage(self, locator, file_name = None, class_name = None):
self._tap_menu_item(locator)
class_object = self._get_class_by_name(file_name, class_name)
if class_object is not None:
return class_object(self.marionette)
def _get_class_by_name(self, file_name = None, class_name = None):
if file_name is not None:
package_path = 'gaiatest.apps.settings.regions.{}'.format(file_name.lower())
mod = __import__(package_path, fromlist = [class_name])
class_defn = getattr(mod, class_name)
return class_defn
@property
def is_wifi_menu_visible(self):
return self.is_element_displayed(*self._wifi_menu_item_locator)
@property
def is_cell_data_menu_visible(self):
return self.is_element_displayed(*self._cell_data_menu_item_locator)
def _wait_for_menu_item(self, menu_item_locator):
menu_item = self.marionette.find_element(*menu_item_locator)
# Some menu items require some async setup to be completed
element = menu_item.find_element(By.XPATH, 'ancestor::li')
Wait(self.marionette).until(
lambda m: not element.get_attribute('aria-disabled'))
return menu_item
def _wait_for_parent_section_not_displayed(self, menu_item):
section = menu_item.find_element(By.XPATH, 'ancestor::section')
Wait(self.marionette).until(
lambda m: abs(section.location['x']) == abs(section.size['width']))
def _tap_menu_item(self, menu_item_locator):
menu_item = self._wait_for_menu_item(menu_item_locator)
menu_item.tap()
if menu_item_locator != self._privacy_controls_item_locator:
self._wait_for_parent_section_not_displayed(menu_item)
def _a11y_click_menu_item(self, menu_item_locator):
menu_item = self._wait_for_menu_item(menu_item_locator)
self.accessibility.click(menu_item)
self._wait_for_parent_section_not_displayed(menu_item)
def return_to_prev_menu(self, parent_view, exit_view):
GaiaHeader(self.marionette, exit_view.find_element(*self._header_locator)).go_back()
Wait(self.marionette).until(lambda m: 'current' not in exit_view.get_attribute('class'))
Wait(self.marionette).until(lambda m: parent_view.rect['x'] == 0)
Wait(self.marionette).until(lambda m: 'current' in parent_view.get_attribute('class'))

View file

@ -0,0 +1,158 @@
# 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 Accessibility(Base):
_accessibility_screenreader_menu_item_locator = (
By.CSS_SELECTOR, '[href="#accessibility-screenreader"]')
_accessibility_colors_menu_item_locator = (
By.CSS_SELECTOR, '[href="#accessibility-colors"]')
_accessibility_audio_menu_item_locator = (
By.CSS_SELECTOR, '[href="#accessibility-audio"]')
_accessibility_input_menu_item_locator = (
By.CSS_SELECTOR, '[href="#accessibility-input"]')
_page_locator = (By.ID, 'accessibility')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def a11y_open_screenreader_settings(self):
el = self.marionette.find_element(
*self._accessibility_screenreader_menu_item_locator)
self.accessibility.click(el)
return AccessibilityScreenreader(self.marionette)
def a11y_open_color_settings(self):
el = self.marionette.find_element(
*self._accessibility_colors_menu_item_locator)
self.accessibility.click(el)
return AccessibilityColors(self.marionette)
def open_color_settings(self): #non-a11y method
self.marionette.find_element(*self._accessibility_colors_menu_item_locator).tap()
return AccessibilityColors(self.marionette)
def open_audio_settings(self):
self.marionette.find_element(*self._accessibility_audio_menu_item_locator).tap()
return AccessibilityAudio(self.marionette)
def open_input_settings(self):
self.marionette.find_element(*self._accessibility_input_menu_item_locator).tap()
return AccessibilityInput(self.marionette)
class AccessibilityScreenreader(Base):
_screen_reader_captions_locator = (
By.CSS_SELECTOR, 'input[name="accessibility.screenreader-captions"]')
_screen_reader_volume_slider_locator = (
By.CSS_SELECTOR, 'input[name="accessibility.screenreader-volume"]')
_screen_reader_rate_slider_locator = (
By.CSS_SELECTOR, 'input[name="accessibility.screenreader-rate"]')
def a11y_toggle_captions(self):
self.accessibility.click(self.marionette.find_element(
*self._screen_reader_captions_locator))
class AccessibilityColors(Base):
_page_locator = (By.ID, 'accessibility-colors')
_filter_enable_switch_locator = (
By.CSS_SELECTOR, '[name="accessibility.colors.enable"]')
_invert_switch_locator = (
By.CSS_SELECTOR, '[name="accessibility.colors.invert"]')
_grayscale_switch_locator = (
By.CSS_SELECTOR, '[name="accessibility.colors.grayscale"]')
_contrast_slider_locator = (
By.CSS_SELECTOR, 'input[name="accessibility.colors.contrast"]')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def invert_switch_visible(self):
return self.check_switch_for_a11y_state("isVisible", self.marionette.find_element(
*self._invert_switch_locator))
@property
def grayscale_switch_visible(self):
return self.check_switch_for_a11y_state("isVisible", self.marionette.find_element(
*self._grayscale_switch_locator))
@property
def invert_switch_hidden(self):
return self.check_switch_for_a11y_state("isHidden", self.marionette.find_element(
*self._invert_switch_locator))
@property
def grayscale_switch_hidden(self):
return self.check_switch_for_a11y_state("isHidden", self.marionette.find_element(
*self._grayscale_switch_locator))
def check_switch_for_a11y_state(self, state, switch):
return self.accessibility.execute_async_script("""return Accessibility.%s(
arguments[0].shadowRoot.querySelector('#switch-label'));""" % state, [switch])
def a11y_toggle_switch(self, switch):
return self.accessibility.execute_async_script(
"Accessibility.click(arguments[0].shadowRoot.querySelector('#switch-label'));",
[switch])
def a11y_toggle_filters(self):
self.a11y_toggle_switch(self.marionette.find_element(*self._filter_enable_switch_locator))
def toggle_filters(self):
element = self.marionette.find_element(*self._filter_enable_switch_locator)
Wait(self.marionette).until(
expected.element_displayed(element))
element.tap()
def a11y_toggle_invert(self):
self.a11y_toggle_switch(self.marionette.find_element(*self._invert_switch_locator))
def a11y_toggle_grayscale(self):
self.a11y_toggle_switch(self.marionette.find_element(*self._grayscale_switch_locator))
class AccessibilityAudio(Base):
_page_locator = (By.ID, 'accessibility-audio')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
class AccessibilityInput(Base):
_page_locator = (By.ID, 'accessibility-input')
_delay_locator =(By.CSS_SELECTOR, '[name="ui.click_hold_context_menus.delay"]')
_confirm_delay_change_locator =(By.CSS_SELECTOR, 'button[data-l10n-id="ok"]')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def tap_change_delay(self):
element = Wait(self.marionette).until(
expected.element_present(*self._delay_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(*self._confirm_delay_change_locator))
def tap_confirm_delay(self):
element = Wait(self.marionette).until(
expected.element_present(*self._confirm_delay_change_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._delay_locator))

View file

@ -0,0 +1,51 @@
# 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 PageRegion
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class AddonDetails(PageRegion):
_details_page_locator = (By.ID, 'addon-details')
_affected_apps_locator = (By.CLASS_NAME, 'addon-targets')
_state_toggle_locator = (By.CSS_SELECTOR, '#addon-details .addon-details-body gaia-switch')
_description_locator = (By.CSS_SELECTOR, '.addon-description-text')
_reboot_required_locator = (By.CSS_SELECTOR, '[data-l10n-id="addon-reboot-required"]')
def __init__(self, marionette):
root = marionette.find_element(*self._details_page_locator)
PageRegion.__init__(self, marionette, root)
Wait(self.marionette).until(expected.element_displayed(
self.root_element.find_element(*self._affected_apps_locator)))
Wait(self.marionette).until(expected.element_displayed(
self.root_element.find_element(*self._state_toggle_locator)))
# workaround for bug 1202246. Need to call this method after frame switching
def refresh_root_element(self):
self.root_element = self.marionette.find_element(*self._details_page_locator)
@property
def _checkbox(self):
return GaiaBinaryControl(self.marionette, self._state_toggle_locator)
@property
def is_enabled(self):
return self._checkbox.is_checked
def enable(self):
self._checkbox.enable()
def disable(self):
self._checkbox.disable()
@property
def affected_apps(self):
return self.root_element.find_element(*self._affected_apps_locator).text
@property
def description(self):
return self.root_element.find_element(*self._description_locator).text

View 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 marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
from gaiatest.apps.base import PageRegion
from gaiatest.apps.settings.regions.addon_details import AddonDetails
class Addons(Base):
_page_locator = (By.ID, 'addons')
_items_locator = (By.CSS_SELECTOR, '.addon-list .menu-item')
_details_page_locator = (By.ID, 'addon-details')
_affected_apps_locator = (By.CLASS_NAME, 'addon-targets')
_state_toggle_locator = (By.CSS_SELECTOR, '.addon-details-body gaia-switch')
_addon_header = (By.CLASS_NAME, 'addon-details-header')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(
expected.element_displayed(*self._page_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def details_screen_element(self):
return self.marionette.find_element(*self._details_page_locator)
@property
def items(self):
return [Addon(self.marionette, element)
for element in self.marionette.find_elements(*self._items_locator)]
@property
def is_addon_enabled(self):
return self.marionette.find_element(*self._state_toggle_locator).is_selected()
def tap_item(self,item_index):
self.items[item_index].tap()
Wait(self.marionette).until(expected.element_displayed(
self.marionette.find_element(*self._affected_apps_locator)))
Wait(self.marionette).until(expected.element_displayed(
self.marionette.find_element(*self._state_toggle_locator)))
def toggle_addon_status(self):
self.marionette.find_element(*self._state_toggle_locator).tap()
class Addon(PageRegion):
_name_locator = (By.CSS_SELECTOR, 'span')
@property
def name(self):
return self.root_element.find_element(*self._name_locator).text
def tap(self):
self.root_element.tap()
return AddonDetails(self.marionette)

View file

@ -0,0 +1,46 @@
# 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 AppPermission(Base):
_page_locator = (By.ID, 'appPermissions')
_permission_detail_locator = (By.ID, 'appPermissions-details')
_camera_app_locator = (By.CSS_SELECTOR, '[class="menu-item"] img[src^="app://camera.gaiamobile.org"] + span')
_geolocation_selector_locator = (By.CSS_SELECTOR, '[data-l10n-id="perm-geolocation"]')
_geolocation_ok_button_locator = (By.CLASS_NAME, 'value-option-confirm')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(
expected.element_displayed(*self._page_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def details_screen_element(self):
return self.marionette.find_element(*self._permission_detail_locator)
def tap_camera_app(self):
self.marionette.find_element(*self._camera_app_locator).tap()
Wait(self.marionette).until(expected.element_displayed(
self.marionette.find_element(*self._permission_detail_locator)))
def tap_geolocation_selection(self):
self.marionette.find_element(*self._geolocation_selector_locator).tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(
self.marionette.find_element(*self._geolocation_ok_button_locator)))
def exit_geolocation_selection(self):
self.marionette.find_element(*self._geolocation_ok_button_locator).tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(
self.marionette.find_element(*self._permission_detail_locator)))

View file

@ -0,0 +1,37 @@
# 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/.
import time
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class Battery(Base):
_page_locator = (By.ID, 'battery')
_power_save_checkbox_locator = (By.CSS_SELECTOR, 'gaia-switch[name="powersave.enabled"]')
_power_save_turn_on_auto_locator = (By.CSS_SELECTOR, 'select[name="powersave.threshold"]')
def enable_power_save_mode(self):
GaiaBinaryControl(self.marionette, self._power_save_checkbox_locator).enable()
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def tap_turn_on_auto(self):
element = Wait(self.marionette).until(
expected.element_present(*self._power_save_turn_on_auto_locator))
element.tap()
def confirm_turnon_options(self):
self.marionette.switch_to_frame()
close_btn = self.marionette.find_element(By.CSS_SELECTOR, 'button.value-option-confirm')
close_btn.tap()
Wait(self.marionette).until(expected.element_not_displayed(close_btn))
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._power_save_checkbox_locator))

View file

@ -0,0 +1,109 @@
# 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 PageRegion
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class Bluetooth(PageRegion):
_root_locator = (By.ID, 'bluetooth')
_bluetooth_checkbox_locator = (By.CSS_SELECTOR,
'#bluetooth .bluetooth-status gaia-switch')
_bluetooth_label_locator = (By.CSS_SELECTOR, '[data-l10n-id="bluetooth"]')
_visible_to_all_checkbox_locator = (By.CSS_SELECTOR,
'#bluetooth .device-visible gaia-switch')
_visible_to_all_label_locator = (By.CSS_SELECTOR, '[data-l10n-id="bluetooth-visible-to-all"]')
_device_name_locator = (By.CSS_SELECTOR, '.bluetooth-device-name')
_rename_my_device_button_locator = (By.CSS_SELECTOR, 'button.rename-device')
_update_device_name_input_locator = (By.CSS_SELECTOR, 'input.settings-dialog-input')
_update_device_name_ok_locator = (By.CSS_SELECTOR, '#settings-prompt-dialog .recommend')
_search_for_devices_locator = (By.CSS_SELECTOR, 'button.search-device')
_device_list_locator = (By.CLASS_NAME, "bluetooth-device")
_bt_device_name_locator = (By.CSS_SELECTOR, "bdi")
_confirm_dialog_locator = (By.ID, 'settings-confirm-dialog')
_confirm_button_locator = (By.CLASS_NAME, 'danger')
def __init__(self, marionette):
root = marionette.find_element(*self._root_locator)
PageRegion.__init__(self, marionette, root)
Wait(self.marionette).until(expected.element_displayed(*self._bluetooth_label_locator))
@property
def screen_element(self):
return self.root_element
@property
def is_bluetooth_enabled(self):
return self._bluetooth_switch.is_checked
def enable_bluetooth(self):
self._bluetooth_switch.enable()
rename_device = self.root_element.find_element(*self._rename_my_device_button_locator)
Wait(self.marionette).until(expected.element_enabled(rename_device))
@property
def _bluetooth_switch(self):
return GaiaBinaryControl(self.marionette, self._bluetooth_checkbox_locator)
@property
def is_visible_enabled(self):
return self._is_visible_switch.is_checked
def enable_visible_to_all(self):
self._is_visible_switch.enable()
@property
def _is_visible_switch(self):
return GaiaBinaryControl(self.marionette, self._visible_to_all_checkbox_locator)
@property
def device_name(self):
return self.root_element.find_element(*self._device_name_locator).text
# workaround for bug 1202246. Need to call this method after frame switching
def refresh_root_element(self):
self.root_element = self.marionette.find_element(*self._root_locator)
def disable_bluetooth(self):
self._bluetooth_switch.disable()
def tap_rename_my_device(self):
self.root_element.find_element(*self._rename_my_device_button_locator).tap()
Wait(self.marionette).until(
expected.element_displayed(*self._update_device_name_input_locator))
def type_phone_name(self, name):
element = self.marionette.find_element(*self._update_device_name_input_locator)
element.clear()
element.send_keys(name)
def tap_update_device_name_ok(self):
element = self.marionette.find_element(*self._update_device_name_ok_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_not_displayed(element))
def tap_search_for_devices(self):
element = self.root_element.find_element(*self._search_for_devices_locator)
element.tap()
Wait(self.marionette).until(expected.element_not_enabled(element))
Wait(self.marionette).until(expected.element_enabled(element))
def tap_device(self, name):
elements = self.root_element.find_elements(*self._device_list_locator)
for element in elements:
child = element.find_element(*self._bt_device_name_locator)
if child.text == name:
child.tap()
return True
return False
def tap_confirm_unpair_device(self):
confirm_dialog = self.marionette.find_element(*self._confirm_dialog_locator)
confirm_dialog.find_element(*self._confirm_button_locator).tap()

View file

@ -0,0 +1,63 @@
# 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.base import PageRegion
class BrowsingPrivacy(Base):
_page_locator = (By.ID, 'browsingPrivacy')
_clear_browsing_history_locator = (By.CSS_SELECTOR, 'button.clear-history-button')
_clear_private_data_locator = (By.CSS_SELECTOR, 'button.clear-private-data-button')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(
expected.element_displayed(*self._clear_browsing_history_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def clear_browsing_history(self):
element = self.marionette.find_element(*self._clear_browsing_history_locator)
Wait(self.marionette).until(lambda m: element.is_displayed())
element.tap()
return ClearHistoryDialog(self.marionette)
def clear_private_data(self):
element = self.marionette.find_element(*self._clear_private_data_locator)
Wait(self.marionette).until(lambda m: element.is_displayed())
element.tap()
return ClearHistoryDialog(self.marionette)
class ClearHistoryDialog(PageRegion):
_root_locator = (By.ID, 'settings-confirm-dialog')
_cancel_locator = (By.CSS_SELECTOR, '[data-l10n-id="cancel"]')
_clear_delete_locator = (By.CSS_SELECTOR, '.danger')
def __init__(self, marionette):
element = marionette.find_element(*self._root_locator)
PageRegion.__init__(self, marionette, element)
Wait(self.marionette).until(lambda m: element.is_displayed())
# workaround for bug 1202246. Need to call this method after frame switching
def refresh_root_element(self):
self.root_element = self.marionette.find_element(*self._root_locator)
def confirm_clear(self):
element = self.root_element.find_element(*self._clear_delete_locator)
element.tap()
Wait(self.marionette).until(lambda m: not self.root_element.is_displayed())
def cancel_clear(self):
element = self.root_element.find_element(*self._cancel_locator)
element.tap()
Wait(self.marionette).until(lambda m: not self.root_element.is_displayed())

View file

@ -0,0 +1,271 @@
# 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.form_controls.binarycontrol import GaiaBinaryControl
from gaiatest.apps.base import Base
class CallSettings(Base):
_page_locator = (By.ID, 'call-iccs')
_sim_1_locator = (By.ID, 'menuItem-call-sim1')
_call_settings_page_locator = (By.ID, 'call')
_voicemail_locator = (By.CSS_SELECTOR, '.menuItem-voicemail')
_voicemail_number_locator = (By.CLASS_NAME, 'vm-number')
_voicemail_page_locator = (By.ID, 'call-voiceMailSettings')
_caller_id_menu_item_locator = (By.ID, 'menuItem-callerId')
_caller_id_selector_locator = (By.ID, 'ril-callerId')
_caller_id_confirm_button_locator = (By.CLASS_NAME, 'value-option-confirm')
_fixed_dialing_page_locator = (By.ID, 'call-fdnSettings')
_fixed_dialing_numbers_locator = (By.ID, 'menuItem-callFdn')
_toggle_fixed_dialing_number_locator = (By.CSS_SELECTOR, '.fdn-enabled gaia-switch')
_sim_pin_page_locator = (By.ID, 'simpin-dialog')
_sim_pin_area_locator = (By.CLASS_NAME, 'sim-code-area')
_auth_number_locator = (By.CSS_SELECTOR, '[data-l10n-id = "fdn-authorizedNumbers"]')
_auth_number_page_locator = (By.ID, 'call-fdnList')
_call_settings_query_locator = (By.CSS_SELECTOR, '[data-l10n-id = "callSettingsQuery"]')
_call_forwarding_page_locator = (By.ID, 'call-forwarding')
_call_forwarding_locator = (By.ID, 'menuItem-callForwarding')
_call_forwarding_status_disabled_text_locator = \
(By.CSS_SELECTOR, '[data-l10n-id = "callForwardingNotForwarding"]')
_call_forwarding_always_locator = (By.ID, 'li-cfu-desc')
_call_forwarding_always_page_locator = (By.ID, 'call-cf-unconditional-settings')
_call_forwarding_busy_locator = (By.ID, 'li-cfmb-desc')
_call_forwarding_busy_page_locator = (By.ID, 'call-cf-mobile-busy-settings')
_call_forwarding_unanswered_locator = (By.ID, 'li-cfnrep-desc')
_call_forwarding_unanswered_page_locator = (By.ID, 'call-cf-no-reply-settings')
_call_forwarding_unreachable_locator = (By.ID, 'li-cfnrea-desc')
_call_forwarding_unreachable_page_locator = (By.ID, 'call-cf-not-reachable-settings')
_call_barring_page_locator = (By.ID, 'call-cbSettings')
_call_barring_back_btn_locator = (By.CSS_SELECTOR, '[data-l10n-id = "back"]')
_call_barring_locator = (By.ID, 'menuItem-callBarring')
_call_barring_status_disabled_locator = (By.CSS_SELECTOR, '#baoc-desc[data-l10n-id = "disabled"]')
_call_barring_all_switch_locator = (By.ID, 'li-cb-baoc')
_call_barring_all_cancel_button_locator = (By.ID, 'cb-passcode-cancel-btn')
_change_passcode_locator = (By.ID, 'li-cb-pswd')
_passcode_page_locator = (By.ID, 'call-barring-passcode-change')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def cs_screen_element(self):
return self.marionette.find_element(*self._call_settings_page_locator)
@property
def vm_screen_element(self):
return self.marionette.find_element(*self._voicemail_page_locator)
@property
def fixed_dialing_screen_element(self):
return self.marionette.find_element(*self._fixed_dialing_page_locator)
@property
def fixed_dialing_simpin_screen_element(self):
return self.marionette.find_element(*self._sim_pin_page_locator)
@property
def auth_screen_element(self):
return self.marionette.find_element(*self._auth_number_page_locator)
@property
def call_forwarding_screen_element(self):
return self.marionette.find_element(*self._call_forwarding_page_locator)
@property
def call_forwarding_always_screen_element(self):
return self.marionette.find_element(*self._call_forwarding_always_page_locator)
@property
def call_forwarding_busy_screen_element(self):
return self.marionette.find_element(*self._call_forwarding_busy_page_locator)
@property
def call_forwarding_unans_screen_element(self):
return self.marionette.find_element(*self._call_forwarding_unanswered_page_locator)
@property
def call_forwarding_unreach_screen_element(self):
return self.marionette.find_element(*self._call_forwarding_unreachable_page_locator)
@property
def call_barring_screen_element(self):
return self.marionette.find_element(*self._call_barring_page_locator)
@property
def call_barring_back_btn_element(self):
return self.marionette.find_element(*self._call_barring_back_btn_locator)
@property
def call_barring_passcode_screen_element(self):
return self.marionette.find_element(*self._passcode_page_locator)
def tap_sim_1(self):
element = self.marionette.find_element(*self._sim_1_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._call_settings_page_locator))
menu_item = self.marionette.find_element(*self._caller_id_menu_item_locator)
Wait(self.marionette,timeout=120).until(lambda m: not menu_item.get_attribute('aria-disabled'))
def tap_voicemail(self):
element = self.marionette.find_element(*self._voicemail_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._voicemail_number_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
def tap_caller_id_selection(self):
element = self.marionette.find_element(*self._caller_id_selector_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
self.marionette.switch_to_frame()
def confirm_caller_id_selection(self):
element = self.marionette.find_element(*self._caller_id_confirm_button_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._caller_id_selector_locator))
def tap_fixed_dialing(self):
element = self.marionette.find_element(*self._fixed_dialing_numbers_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._fixed_dialing_page_locator))
def enable_fixed_dialing(self):
GaiaBinaryControl(self.marionette, self._toggle_fixed_dialing_number_locator).enable()
Wait(self.marionette).until(expected.element_displayed(
*self._sim_pin_area_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
def tap_auth_numbers(self):
element = self.marionette.find_element(*self._auth_number_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._auth_number_page_locator))
def tap_call_forwarding(self):
element = self.marionette.find_element(*self._call_forwarding_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._call_forwarding_page_locator))
Wait(self.marionette).until(
expected.element_displayed(*self._call_settings_query_locator))
# the default is 'disabled'
def wait_until_call_forwarding_info_received(self):
Wait(self.marionette, timeout=120).until(
expected.element_displayed(*self._call_forwarding_status_disabled_text_locator))
def tap_always_forward(self):
element = self.marionette.find_element(*self._call_forwarding_always_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._call_forwarding_always_page_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
def tap_forward_when_busy(self):
element = self.marionette.find_element(*self._call_forwarding_busy_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._call_forwarding_busy_page_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
def tap_forward_unanswered(self):
element = self.marionette.find_element(*self._call_forwarding_unanswered_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._call_forwarding_unanswered_page_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
def tap_forward_unreachable(self):
element = self.marionette.find_element(*self._call_forwarding_unreachable_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._call_forwarding_unreachable_page_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
def tap_call_barring(self):
element = self.marionette.find_element(*self._call_barring_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._call_barring_page_locator))
Wait(self.marionette).until(expected.element_displayed(*self._call_settings_query_locator))
def wait_until_call_barring_info_received(self):
Wait(self.marionette, timeout=120, interval=1).until(
expected.element_present(*self._call_barring_status_disabled_locator))
def tap_call_barring_all(self):
element = self.marionette.find_element(*self._call_barring_all_switch_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(
*self._call_barring_all_cancel_button_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
def tap_call_barring_all_cancel(self):
element = self.marionette.find_element(*self._call_barring_all_cancel_button_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._call_barring_page_locator))
def tap_change_passcode(self):
element = self.marionette.find_element(*self._change_passcode_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._passcode_page_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()

View file

@ -0,0 +1,77 @@
# 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.settings.regions.cell_data_prompt import CellDataPrompt
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
from gaiatest.apps.settings.regions.sim_settings import SimSettings
class CellData(Base):
_page_locator = (By.ID, 'carrier')
_carrier_container_locator = (By.ID, 'carrier')
_carrier_name_locator = (By.ID, 'dataNetwork-desc')
_cell_data_enabled_input_locator = (By.CSS_SELECTOR, '#menuItem-enableDataCall gaia-switch')
_cell_data_enabled_label_locator = (By.CSS_SELECTOR, '#menuItem-enableDataCall label')
_data_roaming_enabled_input_locator = (By.CSS_SELECTOR, '#menuItem-enableDataRoaming gaia-switch')
_data_roaming_enabled_label_locator = (By.CSS_SELECTOR, '#menuItem-enableDataRoaming label')
_sim_1_settings_locator = (By.ID, 'menuItem-carrier-sim1')
def __init__(self, marionette):
Base.__init__(self, marionette)
element = self.marionette.find_element(*self._carrier_container_locator)
Wait(self.marionette).until(lambda m: 'current' in element.get_attribute('class'))
@property
def carrier_name(self):
element = Wait(self.marionette).until(
expected.element_present(*self._carrier_name_locator))
Wait(self.marionette).until(expected.element_displayed(element))
return element.text
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
# workaround for elements within CellDataPrompt going stale (Bug 1202246)
@property
def data_prompt(self):
return CellDataPrompt(self.marionette)
def enable_data(self):
element = Wait(self.marionette).until(
expected.element_present(*self._cell_data_enabled_label_locator))
Wait(self.marionette).until(expected.element_displayed(element) and expected.element_enabled(element))
element.tap()
return self.data_prompt
def enable_roaming(self):
element = Wait(self.marionette).until(
expected.element_present(*self._data_roaming_enabled_label_locator))
Wait(self.marionette).until(expected.element_displayed(element))
Wait(self.marionette).until(expected.element_displayed(element) and expected.element_enabled(element))
element.tap()
return self.data_prompt
def tap_sim_1_setting(self):
element = Wait(self.marionette).until(
expected.element_present(*self._sim_1_settings_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
return SimSettings(self.marionette)
@property
def is_data_toggle_checked(self):
return GaiaBinaryControl(self.marionette, self._cell_data_enabled_input_locator).is_checked
@property
def is_roaming_toggle_checked(self):
return GaiaBinaryControl(self.marionette, self._data_roaming_enabled_input_locator).is_checked
class CellDataDualSim(CellData):
_carrier_name_locator = (By.CSS_SELECTOR, '#menuItem-carrier-sim1 small')

View file

@ -0,0 +1,21 @@
# 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 gaiatest.apps.base import PageRegion
class CellDataPrompt(PageRegion):
_root_element_locator = (By.CSS_SELECTOR, '#settings-confirm-dialog')
_turn_on_button_locator = (By.CSS_SELECTOR, 'button[data-l10n-id="turnOn"]')
def __init__(self, marionette):
element = marionette.find_element(*self._root_element_locator)
PageRegion.__init__(self, marionette, element)
Wait(marionette).until(lambda m: 'current' in element.get_attribute('class'))
def turn_on(self):
self.root_element.find_element(*self._turn_on_button_locator).tap()
Wait(self.marionette).until(lambda m: self.root_element.rect['x'] == self.root_element.rect['width'])

View file

@ -0,0 +1,108 @@
# 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 datetime import datetime
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class DateAndTime(Base):
_page_locator = (By.ID, 'dateTime')
_use_default_switch_locator = (By.CSS_SELECTOR, '#dateTime .time-format-auto gaia-switch')
_24h_selector_locator = (By.CSS_SELECTOR, '.timeformat .button')
_autotime_enabled_locator = (By.CSS_SELECTOR, '.time-auto')
_autotime_enabled_switch_locator = (By.CSS_SELECTOR, '.time-auto label')
_time_value = (By.CSS_SELECTOR, '.clock-time')
_timezone_region_locator = (By.CLASS_NAME, 'timezone-region')
_timezone_city_locator = (By.CLASS_NAME, 'timezone-city')
_timezone_selection_locator = (By.CSS_SELECTOR, '.value-selector-container li')
_timezone_confirm_button_locator = (By.CSS_SELECTOR, 'button.value-option-confirm')
_time_format_confirm_button_locator = (By.CLASS_NAME, "value-option-confirm")
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(expected.element_displayed(
Wait(self.marionette).until(
expected.element_present(*self._24h_selector_locator))))
@property
def _default_format_switch(self):
return GaiaBinaryControl(self.marionette, self._use_default_switch_locator)
def enable_default_format(self):
self._default_format_switch.enable()
def disable_default_format(self):
self._default_format_switch.disable()
Wait(self.marionette).until(
expected.element_enabled(self.marionette.find_element(*self._24h_selector_locator)))
def open_time_format(self):
self.marionette.find_element(*self._24h_selector_locator).tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(
expected.element_enabled(self.marionette.find_element(*self._time_format_confirm_button_locator)))
def close_time_format(self):
self.marionette.find_element(*self._time_format_confirm_button_locator).tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_present(*self._24h_selector_locator))
def select_time_format(self, time_format):
self.marionette.find_element(*self._24h_selector_locator).tap()
self.select(time_format)
def toggle_automatic_time_update(self):
old_state = self.is_autotime_enabled
Wait(self.marionette).until(expected.element_displayed(
Wait(self.marionette).until(
expected.element_present(*self._autotime_enabled_locator))))
self.marionette.find_element(*self._autotime_enabled_switch_locator).tap()
Wait(self.marionette).until(lambda m: self.is_autotime_enabled != old_state)
def set_region(self, region):
self.marionette.find_element(*self._timezone_region_locator).tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(
lambda m: len(self.marionette.find_elements(*self._timezone_selection_locator)) > 0)
options = self.marionette.find_elements(*self._timezone_selection_locator)
# loop options until we find the match
for li in options:
if region in li.text:
li.tap()
break
else:
raise Exception("Element '%s' could not be found in select wrapper" % region)
close_button = self.marionette.find_element(*self._timezone_confirm_button_locator)
close_button.tap()
self.apps.switch_to_displayed_app()
@property
def is_autotime_enabled(self):
return self.marionette.find_element(
*self._autotime_enabled_locator).get_attribute('data-state') == 'auto'
@property
def get_current_time_text(self):
return self.marionette.find_element(*self._time_value).text
@property
def get_current_time_datetime(self):
return datetime.strptime(self.get_current_time_text, '%I:%M %p')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)

View file

@ -0,0 +1,236 @@
# 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, PageRegion
class DeviceInfo(Base):
_page_locator = (By.ID, 'about')
_phone_number_locator = (By.CSS_SELECTOR, '.deviceInfo-msisdns')
_model_locator = (By.CSS_SELECTOR, '#about small[data-name="deviceinfo.product_model"]')
_software_locator = (By.CSS_SELECTOR, '#about small[data-name="deviceinfo.software"]')
_your_rights_locator = (By.CSS_SELECTOR, '[data-l10n-id="your-rights"]')
_rights_page_locator = (By.ID, 'about-yourRights')
_your_privacy_locator = (By.CSS_SELECTOR, '[data-l10n-id="your-privacy"]')
_privacy_page_locator = (By.ID, 'about-yourPrivacy')
_legal_page_locator = (By.ID, 'about-legal')
_legal_info_locator = (By.CSS_SELECTOR, '[data-l10n-id="about-legal-info"]')
_open_source_notices_locator = (By.CSS_SELECTOR, '[data-l10n-id="open-source-notices"]')
_notice_page_locator = (By.ID, 'about-licensing')
_notice_text_locator = (By.ID, 'os-license')
_source_text_locator = (By.ID, 'obtain-sc')
_obtaining_source_code_locator = (By.CSS_SELECTOR, '[data-l10n-id="obtaining-source-code"]')
_source_code_page_locator = (By.ID, 'about-source-code')
_more_info_button_locator = (By.CSS_SELECTOR, 'a[href="#about-moreInfo"]')
_more_info_page_locator = (By.ID, 'about-moreInfo')
_reset_button_locator = (By.CLASS_NAME, 'reset-phone')
_reset_confirm_locator = (By.CLASS_NAME, 'confirm-reset-phone')
_reset_cancel_locator = (By.CLASS_NAME, 'cancel-reset-phone')
_update_frequency_locator = (By.NAME, 'app.update.interval')
_update_ok_button_locator = (By.CLASS_NAME, 'value-option-confirm')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(
expected.element_displayed(*self._model_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def moreinfo_screen_element(self):
return self.marionette.find_element(*self._more_info_page_locator)
@property
def rights_screen_element(self):
return self.marionette.find_element(*self._rights_page_locator)
@property
def notice_screen_element(self):
return self.marionette.find_element(*self._notice_page_locator)
@property
def source_screen_element(self):
return self.marionette.find_element(*self._source_code_page_locator)
@property
def privacy_screen_element(self):
return self.marionette.find_element(*self._privacy_page_locator)
@property
def legal_screen_element(self):
return self.marionette.find_element(*self._legal_page_locator)
@property
def phone_number(self):
return self.marionette.find_element(*self._phone_number_locator).text
@property
def model(self):
return self.marionette.find_element(*self._model_locator).text
@property
def software(self):
return self.marionette.find_element(*self._software_locator).text
def tap_your_rights(self):
element = self.marionette.find_element(*self._your_rights_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._rights_page_locator))
def tap_your_privacy(self):
element = self.marionette.find_element(*self._your_privacy_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._privacy_page_locator))
def tap_legal_info(self):
element = self.marionette.find_element(*self._legal_info_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._open_source_notices_locator))
def tap_open_source_notices(self):
element = self.marionette.find_element(*self._open_source_notices_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
iframe = self.marionette.find_element(*self._notice_text_locator)
Wait(self.marionette).until(expected.element_displayed(iframe))
self.marionette.switch_to_frame(iframe)
_last_child_locator = (By.CSS_SELECTOR, 'body > *:last-child')
Wait(self.marionette).until(expected.element_displayed(*_last_child_locator))
self.apps.switch_to_displayed_app()
def tap_obtaining_source_code(self):
element = self.marionette.find_element(*self._obtaining_source_code_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
iframe = self.marionette.find_element(*self._source_text_locator)
Wait(self.marionette).until(expected.element_displayed(iframe))
self.marionette.switch_to_frame(iframe)
_last_child_locator = (By.CSS_SELECTOR, 'body > *:last-child')
Wait(self.marionette).until(expected.element_displayed(*_last_child_locator))
self.apps.switch_to_displayed_app()
def tap_more_info(self):
element = self.marionette.find_element(*self._more_info_button_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
return self.MoreInfo(self.marionette)
# In order to access UI, the frame needs to be switched to root
def tap_update_frequency(self):
element = self.marionette.find_element(*self._update_frequency_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(*self._update_ok_button_locator))
# When leaving the page, return to the saved application frame
def exit_update_frequency(self):
element = self.marionette.find_element(*self._update_ok_button_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._page_locator))
def tap_reset_phone(self):
element = self.marionette.find_element(*self._reset_button_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._reset_confirm_locator))
def confirm_reset(self, response=True):
if response is True:
self.marionette.find_element(*self._reset_confirm_locator).tap()
else:
self.marionette.find_element(*self._reset_cancel_locator).tap()
Wait(self.marionette).until(expected.element_displayed(self.screen_element))
class MoreInfo(PageRegion):
_root_locator = (By.ID, 'about-moreInfo')
_os_version_locator = (By.CSS_SELECTOR, 'small[data-name="deviceinfo.os"]')
_hardware_revision_locator = (By.CSS_SELECTOR, 'small[data-name="deviceinfo.hardware"]')
_mac_address_locator = (By.CSS_SELECTOR, 'small[data-name="deviceinfo.mac"]')
_imei1_locator = (By.CSS_SELECTOR, '.deviceInfo-imeis span[data-slot="0"]')
_imei2_locator = (By.CSS_SELECTOR, '.deviceInfo-imeis span[data-slot="1"]')
_iccid_locator = (By.CSS_SELECTOR, '.deviceInfo-iccids')
_platform_version_locator = (By.CSS_SELECTOR, 'small[data-name="deviceinfo.platform_version"]')
_build_id_locator = (By.CSS_SELECTOR, 'small[data-name="deviceinfo.platform_build_id"]')
_build_number_locator = (By.CSS_SELECTOR, 'small[data-name="deviceinfo.build_number"]')
_update_channel_locator = (By.CSS_SELECTOR, 'small[data-name="app.update.channel"]')
_git_commit_timestamp_locator = (By.CSS_SELECTOR, '.gaia-commit-date')
_git_commit_hash_locator = (By.CSS_SELECTOR, '.gaia-commit-hash')
def __init__(self, marionette):
root = marionette.find_element(*self._root_locator)
PageRegion.__init__(self, marionette, root)
Wait(self.marionette).until(expected.element_displayed(*self._os_version_locator))
@property
def screen_element(self):
return self.root_element
@property
def os_version(self):
return self.root_element.find_element(*self._os_version_locator).text
@property
def hardware_revision(self):
return self.root_element.find_element(*self._hardware_revision_locator).text
@property
def mac_address(self):
return self.root_element.find_element(*self._mac_address_locator).text
@property
def imei1(self):
return self._get_imei(number=1)
@property
def imei2(self):
return self._get_imei(number=2)
def _get_imei(self, number):
locator = getattr(self, '_imei{}_locator'.format(number))
imei = self.root_element.find_element(*locator).get_attribute('data-l10n-args')
return imei.lstrip('{{"index":{},"imei":"'.format(number)).rstrip('"{}')
@property
def iccid(self):
return self.root_element.find_element(*self._iccid_locator).text
@property
def platform_version(self):
return self.root_element.find_element(*self._platform_version_locator).text
@property
def build_id(self):
return self.root_element.find_element(*self._build_id_locator).text
@property
def build_number(self):
return self.root_element.find_element(*self._build_number_locator).text
@property
def update_channel(self):
return self.root_element.find_element(*self._update_channel_locator).text
@property
def git_commit_timestamp(self):
return self.root_element.find_element(*self._git_commit_timestamp_locator).text
@property
def git_commit_hash(self):
return self.root_element.find_element(*self._git_commit_hash_locator).text
# workaround for bug 1202246. Need to call this method after frame switching
def refresh_root_element(self):
self.root_element = self.marionette.find_element(*self._root_locator)

View file

@ -0,0 +1,32 @@
# 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 Display(Base):
_page_locator = (By.ID, 'display')
_timeout_selector_locator = (By.NAME, "screen.timeout")
_timeout_confirmation_button_locator = (By.CLASS_NAME, "value-option-confirm")
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def tap_timeout_selector(self):
self.marionette.find_element(*self._timeout_selector_locator).tap()
self.marionette.switch_to_frame()
element = Wait(self.marionette).until(
expected.element_present(*self._timeout_confirmation_button_locator))
Wait(self.marionette).until(expected.element_displayed(element))
def tap_timeout_confirmation(self):
self.marionette.find_element(*self._timeout_confirmation_button_locator).tap()
self.apps.switch_to_displayed_app()
element = Wait(self.marionette).until(
expected.element_present(*self._timeout_selector_locator))
Wait(self.marionette).until(expected.element_displayed(element))

View file

@ -0,0 +1,28 @@
# 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 gaiatest.apps.base import Base
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class DoNotTrack(Base):
_page_locator = (By.ID, 'doNotTrack')
_allow_tracking_radio_locator = (By.CSS_SELECTOR, 'gaia-radio[name="privacy.donottrackheader.value"][value="0"]')
_disallow_tracking_radio_locator = (By.CSS_SELECTOR, 'gaia-radio[name="privacy.donottrackheader.value"][value="1"]')
_do_not_have_pref_on_tracking_radio_locator = (By.CSS_SELECTOR, 'gaia-radio[name="privacy.donottrackheader.value"][value="-1"]')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def tap_allow_tracking(self):
GaiaBinaryControl(self.marionette, self._allow_tracking_radio_locator).enable()
def tap_disallow_tracking(self):
GaiaBinaryControl(self.marionette, self._disallow_tracking_radio_locator).enable()
def tap_do_not_have_pref_on_tracking(self):
GaiaBinaryControl(self.marionette, self._do_not_have_pref_on_tracking_radio_locator).enable()

View file

@ -0,0 +1,22 @@
# 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.settings.regions.cell_data_prompt import CellDataPrompt
class Downloads(Base):
_page_locator = (By.ID, 'downloads')
_download_text_locator = (By.ID, 'dle-text')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(expected.element_displayed(*self._download_text_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)

View 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 expected, By, Wait
from gaiatest.apps.base import Base
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class FindMyDevice(Base):
_page_locator = (By.ID, 'findmydevice')
_login_locator = (By.CLASS_NAME, 'findmydevice-login')
_checkbox_locator = (By.CSS_SELECTOR, '.findmydevice-enabled gaia-switch')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def tap_login(self):
login = Wait(self.marionette, timeout=60).until(
expected.element_present(*self._login_locator))
Wait(self.marionette).until(expected.element_displayed(login))
login.tap()
# After tapping, we are getting into the Firefox Accounts login page
from gaiatest.apps.system.regions.fxaccounts import FirefoxAccount
return FirefoxAccount(self.marionette)
def wait_for_enable_switch_to_be_turned_on(self):
Wait(self.marionette, timeout=60).until(
expected.element_displayed(*self._checkbox_locator))
Wait(self.marionette).until(lambda m:
GaiaBinaryControl(m, self._checkbox_locator).is_checked is True)

View file

@ -0,0 +1,102 @@
# 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.system.regions.activities import Activities
class HomescreenSettings(Base):
_page_locator = (By.ID, 'homescreens')
_change_icon_layout_locator = (By.CSS_SELECTOR, 'select[name="grid.layout.cols"]')
_change_icon_choices_locator = (By.CSS_SELECTOR, '.value-selector-options-container > [role="option"]')
_confirm_layout_button_locator = (By.CSS_SELECTOR, 'button[data-l10n-id="ok"]')
_change_homescreen_page_locator = (By.ID, 'homescreens-list')
_change_homescreen_locator = (By.CSS_SELECTOR, '[data-l10n-id="change-home-screen"]')
_get_more_homescreen_locator = (By.CSS_SELECTOR, '[data-l10n-id="get-more-home-screens"]')
_pick_homescreen_cancel_button_locator = (By.CSS_SELECTOR, '#action-menu-list button[data-l10n-id="cancel"]')
_wallpaper_preview_locator = (By.CSS_SELECTOR, '.wallpaper-preview')
_wallpaper_pick_locator = (By.CLASS_NAME, 'wallpaper-button')
_wallpaper_pick_cancel_btn_locator = (By.CSS_SELECTOR, '#action-menu-list button[data-l10n-id="cancel"]')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def change_homescreen_screen_element(self):
return self.marionette.find_element(*self._change_homescreen_page_locator)
def open_change_home_screen(self):
element = Wait(self.marionette).until(
expected.element_present(*self._change_homescreen_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
new_page = self.marionette.find_element(*self._change_homescreen_page_locator)
Wait(self.marionette).until(lambda m: new_page.rect['x'] == 0 and new_page.is_displayed())
def open_get_more_home_screen(self):
element = Wait(self.marionette).until(
expected.element_present(*self._get_more_homescreen_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(*self._pick_homescreen_cancel_button_locator))
def cancel_get_more_home_screen(self):
self.marionette.find_element(*self._pick_homescreen_cancel_button_locator).tap()
Wait(self.marionette).until(expected.element_not_displayed(*self._pick_homescreen_cancel_button_locator))
self.apps.switch_to_displayed_app()
element = Wait(self.marionette).until(
expected.element_present(*self._change_homescreen_page_locator))
Wait(self.marionette).until(expected.element_displayed(element))
def select_change_icon_layout(self):
element = Wait(self.marionette).until(
expected.element_present(*self._change_icon_layout_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(*self._confirm_layout_button_locator))
def pick_icon_layout(self, text):
self.marionette.switch_to_frame()
for selection in self.marionette.find_elements(*self._change_icon_choices_locator):
if selection.text == text:
selection.tap()
def confirm_icon_layout(self):
self.marionette.find_element(*self._confirm_layout_button_locator).tap()
self.apps.switch_to_displayed_app()
element = Wait(self.marionette).until(
expected.element_present(*self._change_icon_layout_locator))
Wait(self.marionette).until(expected.element_displayed(element))
def change_icon_layout(self, layout_text):
self.select_change_icon_layout()
self.pick_icon_layout(layout_text)
self.confirm_icon_layout()
@property
def wallpaper_preview_src(self):
element = Wait(self.marionette).until(
expected.element_present(*self._wallpaper_preview_locator))
Wait(self.marionette).until(expected.element_displayed(element))
return element.get_attribute('src')
def pick_wallpaper(self):
self.marionette.find_element(*self._wallpaper_pick_locator).tap()
return Activities(self.marionette)
def cancel_pick_wallpaper(self):
self.marionette.switch_to_frame()
self.marionette.find_element(*self._wallpaper_pick_cancel_btn_locator).tap()
Wait(self.marionette).until(expected.element_not_displayed(*self._wallpaper_pick_cancel_btn_locator))
self.apps.switch_to_displayed_app()
element = Wait(self.marionette).until(
expected.element_present(*self._wallpaper_preview_locator))
Wait(self.marionette).until(expected.element_displayed(element))

View file

@ -0,0 +1,36 @@
# 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 Improve(Base):
_page_locator = (By.ID, 'improveBrowserOS')
_feedback_page_locator = (By.ID, 'improveBrowserOS-chooseFeedback')
_crash_report_info_locator = (By.CSS_SELECTOR, '[data-l10n-id="crashReportInfo"]')
_send_feedback_locator = (By.CSS_SELECTOR, '[data-l10n-id="sendMozillaFeedback"]')
_feedback_choice_locator = (By.ID, 'feedback-mood')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(
expected.element_displayed(*self._crash_report_info_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def feedback_screen_element(self):
return self.marionette.find_element(*self._feedback_page_locator)
def tap_send_feedback(self):
element = Wait(self.marionette).until(
expected.element_present(*self._send_feedback_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._feedback_choice_locator))

View file

@ -0,0 +1,59 @@
# 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.form_controls.binarycontrol import GaiaBinaryControl
class InternetSharing(Base):
_page_locator = (By.ID, 'hotspot')
_hotspot_settings_locator = (By.ID, "hotspot-settings-section")
_hotspot_switch_locator = (By.CSS_SELECTOR, '#hotspot gaia-switch')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def _hotspot_switch(self):
return GaiaBinaryControl(self.marionette, self._hotspot_switch_locator)
def tap_hotspot_settings(self):
self.marionette.find_element(*self._hotspot_settings_locator).tap()
return self.HotspotSettings(self.marionette)
def enable_hotspot(self):
self._hotspot_switch.enable()
def disable_hotspot(self):
self._hotspot_switch.disable()
class HotspotSettings(Base):
_page_locator = (By.ID, 'hotspot-wifiSettings')
_security_selector_locator = (By.CLASS_NAME, 'security-selector')
_security_selector_ok_locator = (By.CLASS_NAME, 'value-option-confirm')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(
expected.element_displayed(*self._security_selector_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def tap_security_settings(self):
self.marionette.find_element(*self._security_selector_locator).tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(
expected.element_displayed(*self._security_selector_ok_locator))
def confirm_security_settings(self):
self.marionette.find_element(*self._security_selector_ok_locator).tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(
expected.element_displayed(*self._security_selector_locator))

View file

@ -0,0 +1,102 @@
# 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.form_controls.binarycontrol import GaiaBinaryControl
from gaiatest.form_controls.header import GaiaHeader
class Keyboard(Base):
_section_locator = (By.ID, 'keyboard')
_add_more_keyboards_button_locator = (By.CSS_SELECTOR, "a[href='#keyboard-selection-addMore']")
_built_in_keyboard_locator = (By.CSS_SELECTOR, ".allKeyboardList")
_built_in_keyboard_list_element_locator = (By.CSS_SELECTOR, '.enabledKeyboardList > li > span')
def __init__(self, marionette):
Base.__init__(self, marionette)
self.wait_until_page_ready()
def wait_until_page_ready(self):
section = self.marionette.find_element(*self._section_locator)
return Wait(self.marionette).until(lambda m: section.location['x'] == 0)
def tap_built_in_keyboards(self):
self.marionette.find_element(*self._built_in_keyboard_locator).tap()
return BuiltInKeyBoard(self.marionette)
def tap_add_more_keyboards(self):
self.marionette.find_element(*self._add_more_keyboards_button_locator).tap()
return KeyboardAddMoreKeyboards(self.marionette)
def wait_for_built_in_keyboard(self, language):
Wait(self.marionette).until(lambda m: self.is_built_in_keyboard_present(language))
def is_built_in_keyboard_present(self, language):
for element in self.marionette.find_elements(*self._built_in_keyboard_list_element_locator):
if language in element.text:
return True
return False
@property
def screen_element(self):
return self.marionette.find_element(*self._section_locator)
class KeyboardAddMoreKeyboards(Base):
_section_locator = (By.ID, 'keyboard-selection-addMore')
_select_language_locator = (
By.XPATH,
"//div[contains(@class,'keyboardAppContainer')]//li//gaia-checkbox[contains(., '%s')]"
)
_header_locator = (By.CSS_SELECTOR, '.current gaia-header')
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)
@property
def screen_element(self):
return self.marionette.find_element(*self._section_locator)
def select_language(self, language):
language_locator = (
self._select_language_locator[0],
self._select_language_locator[1] % language
)
GaiaBinaryControl(self.marionette, language_locator).enable()
def go_back(self):
GaiaHeader(self.marionette, self._header_locator).go_back()
class BuiltInKeyBoard(Base):
manifest_url = '{}keyboard{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)
_section_locator = (By.ID, 'general-container')
_header_locator = (By.ID, 'general-header')
_user_dict_button_locator = (By.ID, 'menu-userdict')
_user_dict_locator = (By.ID, 'ud-wordlist-container')
_user_dict_header_locator = (By.ID, 'ud-wordlist-header')
def __init__(self, marionette):
Base.__init__(self, marionette)
self.apps.switch_to_displayed_app()
section = self.marionette.find_element(*self._section_locator)
Wait(self.marionette).until(expected.element_displayed(section))
def tap_user_dictionary(self):
self.marionette.find_element(*self._user_dict_button_locator).tap()
dictionary = self.marionette.find_element(*self._user_dict_locator)
Wait(self.marionette).until(expected.element_displayed(dictionary))
def tap_user_dict_exit(self):
GaiaHeader(self.marionette, self._user_dict_header_locator).go_back()
def tap_exit(self):
GaiaHeader(self.marionette, self._header_locator).go_back(app=self, exit_app=True, statusbar=True)

View file

@ -0,0 +1,60 @@
# 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/.
import time
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
from gaiatest.apps.settings.app import Settings
class Language(Base):
_select_language_locator = (By.CSS_SELECTOR, "select[name='language.current']")
_language_options_locator = (By.CSS_SELECTOR, "select[name='language.current'] option")
_more_language_locator = (By.CSS_SELECTOR, '.more-languages')
_more_language_cancel_locator = (By.CSS_SELECTOR, '[data-l10n-id="cancel"]')
_select_language_close_button_locator = (By.CLASS_NAME, "value-option-confirm")
_language_locator = (By.ID, 'languages')
def wait_for_languages_to_load(self):
Wait(self.marionette).until(expected.elements_present(*self._language_options_locator))
def go_back(self):
settings = Settings(self.marionette)
settings.return_to_prev_menu(settings.screen_element, self.screen_element)
def open_select_language(self):
self.marionette.find_element(*self._select_language_locator).tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_present(*self._select_language_close_button_locator))
def close_select_language(self):
self.marionette.find_element(*self._select_language_close_button_locator).tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_present(*self._select_language_locator))
def select_language(self, language):
self.marionette.find_element(*self._select_language_locator).tap()
self.select(language)
def open_get_language(self):
self.marionette.find_element(*self._more_language_locator).tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_present(*self._more_language_cancel_locator))
def close_get_language(self):
self.marionette.find_element(*self._more_language_cancel_locator).tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_present(*self._more_language_locator))
@property
def current_language(self):
return self.marionette.find_element(By.CSS_SELECTOR, 'html').get_attribute('lang')
@property
def screen_element(self):
return self.marionette.find_element(*self._language_locator)

View file

@ -0,0 +1,77 @@
# 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.base import PageRegion
class MediaStorage(Base):
_page_locator = (By.ID, 'mediaStorage')
_advanced_header_locator = (By.CSS_SELECTOR, '[data-l10n-id="advanced"]')
_internal_storage_locator = (By.CSS_SELECTOR, '[data-id="internal"] + ul')
_external0_storage_locator = (By.CSS_SELECTOR, '[data-id="external-0"] + ul')
_internal_storage_header_locator = (By.CSS_SELECTOR, '[data-l10n-id="storage-name-internal"]')
_external0_storage_header_locator = (By.CSS_SELECTOR, '[data-l10n-id="storage-name-external-0"]')
_media_location_selector_locator = (By.ID, 'defaultMediaLocation')
_default_change_cancel_locator = (By.CSS_SELECTOR, 'button[type="reset"]')
_default_change_confirm_locator = (By.CSS_SELECTOR, 'button[type="submit"]')
_default_change_ok_button_locator = (By.CLASS_NAME, 'value-option-confirm')
def __init__(self, marionette):
Base.__init__(self, marionette)
# check for the presence of internal storage section and advanced option section
Wait(self.marionette).until(expected.element_displayed(*self._internal_storage_header_locator))
Wait(self.marionette).until(expected.element_displayed(*self._advanced_header_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def internal_storage(self):
element = self.marionette.find_element(*self._internal_storage_locator)
from gaiatest.apps.settings.regions.storage_region import StorageRegion
return StorageRegion(self.marionette, element)
@property
def external_storage0(self):
element = self.marionette.find_element(*self._external0_storage_locator)
from gaiatest.apps.settings.regions.storage_region import StorageRegion
return StorageRegion(self.marionette, element)
@property
def default_media_location(self):
element = self.marionette.find_element(*self._media_location_selector_locator)
return self.marionette.execute_script("""
return arguments[0].wrappedJSObject.selectedIndex;
""", [element]);
def tap_select_media_location(self):
# if scrollIntoView() method is used before tapping, it will cause a slight screen shift
self.marionette.find_element(*self._media_location_selector_locator).tap()
Wait(self.marionette).until(expected.element_displayed(*self._default_change_confirm_locator))
def confirm_select_media_location(self):
self.marionette.find_element(*self._default_change_confirm_locator).tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(*self._default_change_ok_button_locator))
def pick_media_location(self,location):
if location == 'Internal':
_selection_locator = (By.CSS_SELECTOR, '[data-option-index="0"]')
elif location == 'SD Card':
_selection_locator = (By.CSS_SELECTOR, '[data-option-index="1"]')
else:
raise AttributeError('{} is not a media supported in the test'.format(location))
element = Wait(self.marionette).until(expected.element_present(*_selection_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.marionette.find_element(*self._default_change_ok_button_locator).tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._media_location_selector_locator))

View file

@ -0,0 +1,53 @@
# 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.form_controls.binarycontrol import GaiaBinaryControl
class Message(Base):
_page_locator = (By.ID, 'messaging')
_auto_retrieve_selector_locator = (By.NAME, 'ril.mms.retrieval_mode')
_auto_retrieve_ok_button_locator = (By.CLASS_NAME, 'value-option-confirm')
_sim_1_selector_locator = (By.CLASS_NAME, 'sim1')
_sim_1_settings_page_locator = (By.ID, 'messaging-details')
_cell_broadcast_switch_locator = (By.CSS_SELECTOR, '#menuItem-cellBroadcast gaia-switch')
_emerg_alert_switch_locator = (By.CSS_SELECTOR, '#menuItem-emergencyAlert gaia-switch')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def settings_screen_element(self):
return self.marionette.find_element(*self._sim_1_settings_page_locator)
def tap_auto_retrieve_selector(self):
element = self.marionette.find_element(*self._auto_retrieve_selector_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(
*self._auto_retrieve_ok_button_locator))
def close_retrieve_dialog(self):
element = self.marionette.find_element(*self._auto_retrieve_ok_button_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(self.screen_element))
def select_sim_1(self):
element = self.marionette.find_element(*self._sim_1_selector_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._sim_1_settings_page_locator))
# Check whether Cell Broadcast is enabled. If so, wait until the switch transition is complete
# for the emergency alert switch as well
cell_broadcast_switch = GaiaBinaryControl(self.marionette, self._cell_broadcast_switch_locator)
if cell_broadcast_switch.is_checked:
emerg_alert_switch = GaiaBinaryControl(self.marionette, self._emerg_alert_switch_locator)
Wait(self.marionette).until(lambda m: emerg_alert_switch.is_checked)

View file

@ -0,0 +1,16 @@
# 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 Navigation(Base):
_page_locator = (By.ID, 'navigation')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)

View file

@ -0,0 +1,16 @@
# 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 Notifications(Base):
_page_locator = (By.ID, 'notifications')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)

View file

@ -0,0 +1,63 @@
# 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 PageRegion
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class ScreenLock(PageRegion):
_root_locator = (By.ID, 'screenLock')
_lockscreen_checkbox_locator = (By.XPATH, '//li/gaia-switch[@name="lockscreen.enabled"]')
_passcode_checkbox_locator = (By.XPATH, '//li/gaia-switch[@name="lockscreen.passcode-lock.enabled"]')
_screen_lock_passcode_section_locator = (By.ID, 'screenLock-passcode')
_passcode_create_locator = (By.CSS_SELECTOR, '#screenLock-passcode gaia-header button[type="submit"]')
def __init__(self, marionette):
root = marionette.find_element(*self._root_locator)
PageRegion.__init__(self, marionette, root)
Wait(self.marionette).until(expected.element_displayed(*self._lockscreen_checkbox_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._root_locator)
@property
def passcode_screen_element(self):
return self.marionette.find_element(*self._screen_lock_passcode_section_locator)
@property
def _lockscreen_switch(self):
return GaiaBinaryControl(self.marionette, self._lockscreen_checkbox_locator)
def enable_lockscreen(self):
self._lockscreen_switch.enable()
Wait(self.marionette).until(expected.element_present(*self._passcode_checkbox_locator) and
expected.element_present(*self._passcode_checkbox_locator))
def enable_passcode_lock(self):
checkbox = Wait(self.marionette).until(
expected.element_present(*self._passcode_checkbox_locator))
Wait(self.marionette).until(expected.element_displayed(checkbox))
checkbox.tap()
section = self.marionette.find_element(*self._screen_lock_passcode_section_locator)
Wait(self.marionette).until(lambda m: section.location['x'] == 0)
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()
def create_passcode(self, passcode):
# switch to keyboard, input passcode
for times in range(2):
self.keyboard.send("".join(passcode))
# Back to create passcode
Wait(self.marionette).until(expected.element_displayed(
*self._screen_lock_passcode_section_locator))
self.marionette.find_element(*self._passcode_create_locator).tap()
Wait(self.marionette).until(expected.element_displayed(
*self._root_locator))

View file

@ -0,0 +1,39 @@
# 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 Search(Base):
_page_locator = (By.ID, 'search')
_search_selector_locator = (By.NAME, "search.provider")
_search_selector_confirmation_button_locator = (By.CLASS_NAME, "value-option-confirm")
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def select_search_engine(self, value):
element = Wait(self.marionette).until(
expected.element_present(*self._search_selector_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.select(value)
def open_select_search_engine(self):
element = Wait(self.marionette).until(
expected.element_present(*self._search_selector_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
def close_select_search_engine(self):
self.marionette.switch_to_frame()
self.marionette.find_element(*self._search_selector_confirmation_button_locator).tap()
self.apps.switch_to_displayed_app()
element = Wait(self.marionette).until(
expected.element_present(*self._search_selector_locator))
Wait(self.marionette).until(expected.element_displayed(element))

View file

@ -0,0 +1,89 @@
# 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 SimManager(Base):
_page_locator = (By.ID, 'sim-manager')
_outgoing_call_locator = (By.CSS_SELECTOR, ".sim-manager-outgoing-call-select")
_outgoing_messages_locator = (By.CSS_SELECTOR, ".sim-manager-outgoing-messages-select")
_outgoing_data_locator = (By.CSS_SELECTOR, ".sim-manager-outgoing-data-select")
_back_button_locator = (By.CSS_SELECTOR, '.current header > a')
_confirm_suspended_locator = (By.CSS_SELECTOR, '.modal-dialog-confirm-ok')
_security_screen_page = (By.ID, 'simpin')
_sim_security_locator = (By.CSS_SELECTOR, '[data-l10n-id="simSecurity"]')
_sim_pin_toggle_locator = (By.CLASS_NAME, 'simpin-enabled')
_sim_pin_screen_locator = (By.ID, 'simpin-dialog')
_sim_pin_field_locator = (By.CSS_SELECTOR, '[data-l10n-id="simPin"]')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def security_screen_element(self):
return self.marionette.find_element(*self._security_screen_page)
@property
def sim_pin_screen_element(self):
return self.marionette.find_element(*self._sim_pin_screen_locator)
def select_outgoing_calls(self, sim_option):
self.marionette.find_element(*self._outgoing_call_locator).tap()
self.select(sim_option)
def select_outgoing_messages(self, sim_option):
self.marionette.find_element(*self._outgoing_messages_locator).tap()
self.select(sim_option)
def select_data(self, sim_option):
self.marionette.find_element(*self._outgoing_data_locator).tap()
self.select(sim_option)
# A confirmation modal about stopping the data connection gets displayed in the System app
self.marionette.switch_to_frame()
confirm = Wait(self.marionette).until(expected.element_present(*self._confirm_suspended_locator))
Wait(self.marionette).until(expected.element_displayed(confirm))
confirm.tap()
self.apps.switch_to_displayed_app()
@property
def sim_for_outgoing_calls(self):
return self._get_displayed_sim(*self._outgoing_call_locator)
@property
def sim_for_outgoing_messages(self):
return self._get_displayed_sim(*self._outgoing_messages_locator)
@property
def sim_for_data(self):
return self._get_displayed_sim(*self._outgoing_data_locator)
def _get_displayed_sim(self, by, locator):
select = self.marionette.find_element(by, locator)
select_value = select.get_attribute('value')
option = select.find_element(By.CSS_SELECTOR, 'option[value="%s"]' % select_value)
return option.text
def tap_sim_security(self):
element = self.marionette.find_element(*self._sim_security_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._sim_pin_toggle_locator))
def enable_sim_pin(self):
element = self.marionette.find_element(*self._sim_pin_toggle_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._sim_pin_field_locator))
self.marionette.switch_to_frame()
Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
self.apps.switch_to_displayed_app()

View file

@ -0,0 +1,157 @@
# 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, expected, Wait
from gaiatest.apps.base import Base
class SimSettings(Base):
_page_locator = (By.ID, 'carrier-detail')
_network_op_locator = (By.CSS_SELECTOR, '[data-l10n-id ="netOperator"]')
_network_op_page_locator = (By.ID, 'operator-settings')
_network_type_selector_locator = (By.CSS_SELECTOR, '.preferred-network-type .button')
_network_type_confirm_button_locator = (By.CLASS_NAME, 'value-option-confirm')
_apn_settings_locator = (By.CSS_SELECTOR, '[data-l10n-id ="apnSettings"]')
_apn_item_locator = (By.CLASS_NAME, 'apn-item')
_apn_settings_page_locator = (By.ID, 'apn-settings')
_data_settings_page_locator = (By.ID, 'apn-list')
_data_settings_locator = (By.CSS_SELECTOR, '[data-l10n-id ="dataSettings"]')
_add_new_apn_btn_locator = (By.CLASS_NAME, 'add-apn')
_apn_editor_page_locator = (By.ID, 'apn-editor')
_authentication_selector_locator = (By.CLASS_NAME, 'authtype')
_protocol_selector_locator = (By.CLASS_NAME, 'protocol')
_roaming_protocol_locator = (By.CLASS_NAME, 'roaming_protocol')
_apn_selector_confirm_button_locator = (By.CLASS_NAME, 'value-option-confirm')
_reset_apn_btn_locator = (By.CSS_SELECTOR, '[data-l10n-id="reset-apn"]')
_reset_apn_page_locator = (By.CSS_SELECTOR, '#settings-confirm-dialog')
_cancel_btn_locator = (By.CSS_SELECTOR, '#settings-confirm-dialog [data-l10n-id="cancel"]')
def __init__(self, marionette):
Base.__init__(self, marionette)
element = self.marionette.find_element(*self._page_locator)
Wait(self.marionette).until(lambda m: 'current' in element.get_attribute('class'))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def network_op_screen_element(self):
return self.marionette.find_element(*self._network_op_page_locator)
@property
def apn_settings_screen_element(self):
return self.marionette.find_element(*self._apn_settings_page_locator)
@property
def data_settings_screen_element(self):
return self.marionette.find_element(*self._data_settings_page_locator)
@property
def apn_editor_screen_element(self):
return self.marionette.find_element(*self._apn_editor_page_locator)
def tap_network_operator(self):
element = self.marionette.find_element(*self._network_op_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._network_type_selector_locator))
def tap_network_type(self):
element = self.marionette.find_element(*self._network_type_selector_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(*self._network_type_confirm_button_locator))
def confirm_network_type(self):
element = self.marionette.find_element(*self._network_type_confirm_button_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._network_type_selector_locator))
def tap_apn_settings(self):
element = self.marionette.find_element(*self._apn_settings_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._reset_apn_btn_locator))
def tap_data_settings(self):
element = self.marionette.find_element(*self._data_settings_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._add_new_apn_btn_locator))
# also necessary to check for selections, since sometimes the button gets displayed first
Wait(self.marionette).until(expected.element_displayed(*self._apn_item_locator))
def tap_add_new_apn(self):
element = self.marionette.find_element(*self._add_new_apn_btn_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._apn_editor_page_locator))
def select_authentication(self):
element = self.marionette.find_element(*self._authentication_selector_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(
*self._apn_selector_confirm_button_locator))
def select_protocol(self):
element = self.marionette.find_element(*self._protocol_selector_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(
*self._apn_selector_confirm_button_locator))
def select_roaming_protocol(self):
element = self.marionette.find_element(*self._roaming_protocol_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(
*self._apn_selector_confirm_button_locator))
def confirm_apn_selection(self):
element = self.marionette.find_element(*self._apn_selector_confirm_button_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._apn_editor_page_locator))
def tap_reset_to_default(self):
element = self.marionette.find_element(*self._reset_apn_btn_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._cancel_btn_locator))
def tap_cancel_reset(self):
dialog_view = self.marionette.find_element(*self._reset_apn_page_locator)
element = self.marionette.find_element(*self._cancel_btn_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
element.tap()
Wait(self.marionette).until(lambda m: 'current' not in dialog_view.get_attribute('class'))
Wait(self.marionette).until(expected.element_displayed(*self._reset_apn_btn_locator))

View file

@ -0,0 +1,59 @@
# 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.ring_tone.app import RingTone
class Sound(Base):
_page_locator = (By.ID, 'sound')
_ring_tone_selector_locator = (By.CSS_SELECTOR, '.ring-tone-selection')
_current_ring_tone_locator = (By.CSS_SELECTOR, '.ring-tone-selection > small')
_alert_selector_locator = (By.ID, 'alerts')
_manage_tones_selector_locator = (By.ID, 'manage-tones')
_dulco_ringtone_locator = (By.CSS_SELECTOR, '[data-id="builtin:ringtone/ringer_dulco"]')
_firefox_alerts_locator = (By.CSS_SELECTOR, '[data-id="builtin:alerttone/notifier_firefox"]')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def ring_tone_selector_visible(self):
return expected.element_displayed(*self._ring_tone_selector_locator)(self.marionette)
@property
def current_ring_tone(self):
element = self.marionette.find_element(*self._current_ring_tone_locator)
Wait(self.marionette).until(lambda m: element.text != '')
return element.text
def tap_ring_tone_selector(self):
self.marionette.find_element(*self._ring_tone_selector_locator).tap()
ringtone_page = RingTone(self.marionette)
element = self.marionette.find_element(*self._dulco_ringtone_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
return ringtone_page
def tap_alerts_selector(self):
self.marionette.find_element(*self._alert_selector_locator).tap()
alerts_page = RingTone(self.marionette)
element = self.marionette.find_element(*self._firefox_alerts_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
return alerts_page
def tap_manage_tones_selector(self):
self.marionette.find_element(*self._manage_tones_selector_locator).tap()
manage_tones_page = RingTone(self.marionette)
element = self.marionette.find_element(*self._dulco_ringtone_locator)
Wait(self.marionette).until(expected.element_displayed(element) and
expected.element_enabled(element))
return manage_tones_page

View file

@ -0,0 +1,81 @@
# 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 PageRegion
class StorageRegion(PageRegion):
_music_size_locator = (By.CSS_SELECTOR, '[data-l10n-id="music-space"] + [data-l10n-id="storageSize"]')
_movies_size_locator = (By.CSS_SELECTOR, '[data-l10n-id="videos-space"] + [data-l10n-id="storageSize"]')
_pictures_size_locator = (By.CSS_SELECTOR, '[data-l10n-id="pictures-space"] + [data-l10n-id="storageSize"]')
_internal_format_locator = (By.CSS_SELECTOR, '[data-l10n-id="format-sdcard-internal"]')
_sd_format_locator = (By.CSS_SELECTOR, '[data-l10n-id="format-sdcard-external-0"]')
_eject_locator = (By.CSS_SELECTOR, '[data-l10n-id^="eject-sdcard-external-0"]')
_format_dialog_cancel_locator = (By.CSS_SELECTOR, 'button[type="reset"]')
_format_dialog_confirm_locator = (By.CSS_SELECTOR, 'button[type="submit"]')
_eject_dialog_cancel_locator = (By.CSS_SELECTOR, 'button[type="reset"]')
_eject_dialog_confirm_locator = (By.CSS_SELECTOR, 'button[type="submit"]')
_confirm_dialog_locator = (By.ID, 'settings-confirm-dialog')
@property
def music_size(self):
return self.root_element.find_element(*self._music_size_locator).get_attribute('data-l10n-args')
@property
def movies_size(self):
return self.root_element.find_element(*self._movies_size_locator).get_attribute('data-l10n-args')
@property
def pictures_size(self):
return self.root_element.find_element(*self._pictures_size_locator).get_attribute('data-l10n-args')
@property
def _sd_format_button(self):
return self.root_element.find_element(*self._sd_format_locator)
@property
def _internal_format_button(self):
return self.root_element.find_element(*self._internal_format_locator)
@property
def _eject_button(self):
return self.root_element.find_element(*self._eject_locator)
def wait_until_confirm_dialog_close(self):
dialog = self.marionette.find_element(*self._confirm_dialog_locator)
Wait(self.marionette).until(lambda m: 'current' not in dialog.get_attribute('class'))
def tap_internal_format(self):
self.marionette.execute_script('arguments[0].scrollIntoView(false);', [self._internal_format_button])
self._internal_format_button.tap()
Wait(self.marionette).until(expected.element_displayed(*self._format_dialog_confirm_locator))
def tap_sd_format(self):
self.marionette.execute_script('arguments[0].scrollIntoView(false);', [self._sd_format_button])
self._sd_format_button.tap()
Wait(self.marionette).until(expected.element_displayed(*self._format_dialog_confirm_locator))
def confirm_format(self):
self.marionette.find_element(*self._format_dialog_confirm_locator).tap()
self.wait_until_confirm_dialog_close()
def cancel_format(self):
self.marionette.find_element(*self._format_dialog_cancel_locator).tap()
self.wait_until_confirm_dialog_close()
def tap_eject(self):
self.marionette.execute_script('arguments[0].scrollIntoView(false);', [self._eject_button])
self._eject_button.tap()
Wait(self.marionette).until(expected.element_displayed(*self._eject_dialog_confirm_locator))
def confirm_eject(self):
self.marionette.find_element(*self._eject_dialog_confirm_locator).tap()
self.wait_until_confirm_dialog_close()
def cancel_eject(self):
self.marionette.find_element(*self._eject_dialog_cancel_locator).tap()
self.wait_until_confirm_dialog_close()
Wait(self.marionette).until(expected.element_displayed(self._eject_button))

View file

@ -0,0 +1,21 @@
# 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 Themes(Base):
_page_locator = (By.ID, 'themes')
_back_btn_locator = (By.CSS_SELECTOR, '#themes .icon.icon-back')
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
@property
def back_btn_element(self):
return self.marionette.find_element(*self._back_btn_locator)

View file

@ -0,0 +1,50 @@
# 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.base import PageRegion
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class USBStorage(Base):
_page_locator = (By.ID, 'usbStorage')
_usb_storage_checkbox_locator = (By.CSS_SELECTOR, '#usbStorage gaia-switch.ums-switch')
_usb_storage_confirm_button_locator = (By.CSS_SELECTOR, 'gaia-confirm button[data-l10n-id="ok"]')
_usb_storage_cancel_button_locator = (By.CSS_SELECTOR, 'gaia-confirm button[data-l10n-id="cancel"]')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(expected.element_displayed(*self._page_locator))
@property
def screen_element(self):
return self.marionette.find_element(*self._page_locator)
def enable_usb_storage(self):
self._usb_checkbox.enable()
@property
def enabled(self):
return self._usb_checkbox.is_checked
@property
def _usb_checkbox(self):
return GaiaBinaryControl(self.marionette, self._usb_storage_checkbox_locator)
def confirm_usb_storage(self):
element = Wait(self.marionette).until(
expected.element_present(*self._usb_storage_confirm_button_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(lambda m: self.enabled is True)
def cancel_usb_storage(self):
element = Wait(self.marionette).until(
expected.element_present(*self._usb_storage_cancel_button_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(lambda m: self.enabled is False)

View file

@ -0,0 +1,159 @@
# 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.base import Base
from gaiatest.form_controls.binarycontrol import GaiaBinaryControl
class Wifi(Base):
_screen_locator = (By.ID, 'wifi')
_wifi_enabled_checkbox_locator = (By.CSS_SELECTOR, '.wifi-enabled gaia-switch')
_available_networks_locator = (By.CSS_SELECTOR, '.wifi-availableNetworks > li > aside[class*="wifi-signal"]')
_password_input_locator = (By.CSS_SELECTOR, '#wifi-auth input[type="password"]')
_password_ok_button_locator = (By.CSS_SELECTOR, '#wifi-auth button[type="submit"]')
_connected_message_locator = (By.CSS_SELECTOR, '.wifi-availableNetworks li.active small')
_wps_connect_locator = (By.CSS_SELECTOR, '[data-l10n-id="wpsMessage"]')
_wps_screen_locator = (By.ID, 'wifi-wps')
_wps_selection_locator = (By.CSS_SELECTOR, '[data-l10n-id="wpsMethodSelection"]')
_manage_networks_locator = (By.CSS_SELECTOR, '[data-l10n-id="manageNetworks"]')
_manage_networks_screen_locator = (By.ID, 'wifi-manageNetworks')
_join_hidden_screen_locator = (By.ID, 'wifi-joinHidden')
_join_hidden_network_locator = (By.CSS_SELECTOR, '[data-l10n-id="joinHiddenNetwork"]')
_security_selector_locator = (By.NAME, 'security')
_security_selector_ok_btn_locator = (By.CLASS_NAME, 'value-option-confirm')
_manage_certs_locator = (By.CSS_SELECTOR, '[data-l10n-id="manageCertificates"]')
_manage_certs_screen_locator = (By.ID, 'wifi-manageCertificates')
_import_certs_locator = (By.CSS_SELECTOR, '[data-l10n-id="importCertificate"]')
_select_certs_screen_locator = (By.ID, 'wifi-selectCertificateFile')
_active_wifi_locator = (By.CSS_SELECTOR, '.wifi-availableNetworks li.active')
_forget_locator = (By.CSS_SELECTOR, '#wifi-status span[data-l10n-id="forget"]')
@property
def screen_element(self):
return self.marionette.find_element(*self._screen_locator)
@property
def wps_screen_element(self):
return self.marionette.find_element(*self._wps_screen_locator)
@property
def manage_network_screen_element(self):
return self.marionette.find_element(*self._manage_networks_screen_locator)
@property
def join_hidden_network_screen_element(self):
return self.marionette.find_element(*self._join_hidden_screen_locator)
@property
def manage_certs_screen_element(self):
return self.marionette.find_element(*self._manage_certs_screen_locator)
@property
def select_certs_screen_element(self):
return self.marionette.find_element(*self._select_certs_screen_locator)
@property
def is_wifi_enabled(self):
return self._wifi_switch.is_checked
@property
def manage_network_button(self):
return self.marionette.find_element(*self._manage_networks_locator)
def enable_wifi(self):
self._wifi_switch.enable()
@property
def _wifi_switch(self):
return GaiaBinaryControl(self.marionette, self._wifi_enabled_checkbox_locator)
def disable_wifi(self):
self._wifi_switch.disable()
def connect_to_network(self, network_info):
# Wait for the networks to be found
this_network_locator = ('xpath', "//li/a/span[text()='%s']" % network_info['ssid'])
this_network = Wait(self.marionette).until(expected.element_present(*this_network_locator))
this_network.tap()
if network_info.get('keyManagement'):
password = network_info.get('psk') or network_info.get('wep')
if not password:
raise Exception('No psk or wep key found in testvars for secured wifi network.')
screen_width = int(self.marionette.execute_script('return window.innerWidth'))
ok_button = self.marionette.find_element(*self._password_ok_button_locator)
Wait(self.marionette).until(lambda m: (ok_button.location['x'] + ok_button.size['width']) == screen_width)
password_input = self.marionette.find_element(*self._password_input_locator)
Wait(self.marionette).until(expected.element_displayed(password_input))
password_input.send_keys(password)
ok_button.tap()
connected_message = self.marionette.find_element(*self._connected_message_locator)
self.marionette.execute_script("arguments[0].scrollIntoView(false);", [connected_message])
timeout = max(self.marionette.timeout and self.marionette.timeout / 1000, 60)
Wait(self.marionette, timeout, ignored_exceptions=StaleElementException).until(
lambda m: m.find_element(*self._connected_message_locator).text == "Connected")
def tap_connect_with_wps(self):
element = self.marionette.find_element(*self._wps_connect_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._wps_selection_locator))
def tap_manage_networks(self):
element = self.marionette.find_element(*self._manage_networks_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._join_hidden_network_locator))
def tap_join_hidden_network(self):
element = self.marionette.find_element(*self._join_hidden_network_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._security_selector_locator))
def tap_security_selector(self):
element = self.marionette.find_element(*self._security_selector_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.marionette.switch_to_frame()
Wait(self.marionette).until(expected.element_displayed(*self._security_selector_ok_btn_locator))
def tap_security_ok(self):
element = self.marionette.find_element(*self._security_selector_ok_btn_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._security_selector_locator))
def tap_manage_certs(self):
element = self.marionette.find_element(*self._manage_certs_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._import_certs_locator))
def tap_import_certs(self):
element = self.marionette.find_element(*self._import_certs_locator)
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._select_certs_screen_locator))
def tap_active_wifi(self):
element = self.marionette.find_element(*self._active_wifi_locator)
element.tap()
Wait(self.marionette).until(expected.element_displayed(*self._forget_locator))
def tap_forget_wifi(self):
element_to_forget = Wait(self.marionette).until(expected.element_present(*self._forget_locator))
Wait(self.marionette).until(expected.element_displayed(element_to_forget))
element_to_forget.tap()
Wait(self.marionette).until(expected.element_not_displayed(element_to_forget))