Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
from gaiatest.apps.music.regions.player_view import PlayerView
class TileView(Base):
_active_view_locator = (By.CSS_SELECTOR, 'iframe.active[src*="/views/home/index.html"]')
_tile_group_locator = (By.ID, 'tiles')
def __init__(self, marionette):
Base.__init__(self, marionette)
# there are two type of tiles - main and sub. There should be at least one main tile
self.marionette.switch_to_frame(self.marionette.find_element(*self._active_view_locator))
Wait(self.marionette).until(expected.element_displayed(*self._tile_group_locator))
self.apps.switch_to_displayed_app()
def tap_song(self, filename):
self.marionette.switch_to_frame(self.marionette.find_element(*self._active_view_locator))
_pick_tile_locator = (By.CSS_SELECTOR, '.tile[data-file-path$="{}"]'.format(filename))
self.marionette.find_element(*_pick_tile_locator).tap()
self.marionette.find_element(*self._about_back_header_locator).tap(25, 25)
Wait(self.marionette).until(expected.element_displayed(*self._location_accuracy_menu_locator))
def tap_loc_accuracy(self):
self.marionette.find_element(*self._location_accuracy_menu_locator).tap()
return self.LocationAccuracy(self.marionette)
def tap_remote_protect(self):
self.marionette.find_element(*self._remote_protection_menu_locator).tap()
return self.RemoteProtection(self.marionette)
def tap_trans_control(self):
self.marionette.find_element(*self._trans_control_locator).tap()
return self.TransparencyControl(self.marionette)
class LocationAccuracy(Base):
_page_locator = (By.ID, 'ala-main')
_app_locator = (By.CSS_SELECTOR, '[data-manifest-name="Privacy Controls"]')
_loc_adjust_enable_locator = (By.CLASS_NAME, 'show-when-geolocation-on')
_loc_selection_locator = (By.NAME, 'geolocation.type')
_ok_locator = (By.CLASS_NAME, 'value-option-confirm')
_add_exceptions_menu_locator = (By.CSS_SELECTOR, '[data-l10n-id="add-exceptions"]')
_exception_app_list = (By.ID, 'ala-exceptions')
_first_app_locator = (By.CSS_SELECTOR, '#app-list > li:nth-child(2) > a:nth-child(1)')
_app_info_locator = (By.CLASS_NAME, 'app-info')
_app_view_locator = (By.ID, 'ala-exception')
# no choice since the unique ID is being reused
_global_settings_locator = \
(By.CSS_SELECTOR,
'#ala-exception > div:nth-child(2) > ul:nth-child(1) > '
'li:nth-child(3) > p:nth-child(1) > span:nth-child(1)')
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
class AttentionScreen(Base):
_message_locator = (By.ID, 'message')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(
expected.element_displayed(*self._message_locator))
@property
def message(self):
return self.marionette.find_element(*self._message_locator).text
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
class FacebookLogin(Base):
_iframe_locator = (By.CSS_SELECTOR, 'iframe[data-url*="m.facebook.com"]')
_div_locator = (By.CSS_SELECTOR, 'div')
_email_locator = (By.CSS_SELECTOR, 'input[placeholder^="Email"]')
_password_locator = (By.CSS_SELECTOR, 'input[placeholder^="Password"]')
_submit_locator = (By.CSS_SELECTOR, '*[type="submit"]')
def __init__(self, marionette):
Base.__init__(self, marionette)
self.marionette.switch_to_frame()
# wait for the pop up screen to open
view = Wait(self.marionette, timeout=60).until(
expected.element_present(*self._iframe_locator))
Wait(self.marionette).until(expected.element_displayed(view))
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
class SetupEmail(Base):
_name_locator = (By.CSS_SELECTOR, 'cards-setup-account-info input.sup-info-name')
_email_locator = (By.CSS_SELECTOR, 'cards-setup-account-info input.sup-info-email')
_next_locator = (By.CSS_SELECTOR, '.sup-info-next-btn')
_continue_button_locator = ('class name', 'sup-show-mail-btn sup-form-btn recommend')
_check_for_new_messages_locator = (By.CSS_SELECTOR, '.tng-account-check-interval.mail-select')
_account_prefs_section_locator = (By.CSS_SELECTOR, 'cards-setup-account-prefs section')
_account_prefs_next_locator = (By.CSS_SELECTOR, 'cards-setup-account-prefs .sup-info-next-btn')
_done_section_locator = (By.CSS_SELECTOR, 'cards-setup-done section')
def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(expected.element_displayed(
Wait(self.marionette).until(expected.element_present(
*self._name_locator))))
def __init__(self, marionette):
Base.__init__(self, marionette)
view = self.marionette.find_element(*self._view_locator)
Wait(self.marionette).until(lambda m: view.location['x'] == 0)
def launch(self):
Base.launch(self)
# 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.by import By
from marionette.marionette import Actions
from gaiatest.apps.base import Base
class System(Base):
# status bar
_status_bar_locator = (By.ID, 'statusbar')
_geoloc_statusbar_locator = (By.CSS_SELECTOR, '#statusbar-minimized-wrapper #statusbar-geolocation')
_airplane_mode_statusbar_locator = (By.CSS_SELECTOR, '#statusbar-minimized-wrapper #statusbar-flight-mode')
_utility_tray_locator = (By.ID, 'utility-tray')
_system_banner_locator = (By.CSS_SELECTOR, '.banner.generic-dialog')
_notification_toaster_locator = (By.ID, 'notification-toaster')
_update_manager_toaster_locator = (By.ID, 'update-manager-toaster')
_software_home_button_locator = (By.ID, 'software-home-button')
def wait_for_status_bar_displayed(self):
self.wait_for_element_displayed(*self._status_bar_locator)
# 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 Bluetooth(Base):
_bluetooth_checkbox_locator = (By.CSS_SELECTOR, '#bluetooth-status input')
_bluetooth_label_locator = (By.CSS_SELECTOR, '#bluetooth-status span')
_visible_to_all_checkbox_locator = (By.CSS_SELECTOR, '#device-visible input')
_visible_to_all_label_locator = (By.CSS_SELECTOR, '#device-visible span')
_device_name_locator = (By.ID, 'bluetooth-device-name')
_rename_my_device_button_locator = (By.ID, 'rename-device')
_update_device_name_form_locator = (By.ID, 'update-device-name')
_update_device_name_input_locator = (By.ID, 'update-device-name-input')
_update_device_name_ok_locator = (By.ID, 'update-device-name-confirm')
@property
def is_bluetooth_enabled(self):
return self.marionette.find_element(*self._bluetooth_checkbox_locator).is_selected()
def __init__(self, marionette):
Base.__init__(self, marionette)