def wait_for_enable_switch_to_be_turned_on(self): findmydevice = Wait(self.marionette, timeout=60).until( expected.element_present(*self._findmydevice_locator)) Wait(self.marionette).until(expected.element_displayed(findmydevice)) checkbox = Wait(self.marionette, timeout=60).until( expected.element_present(*self._checkbox_locator)) Wait(self.marionette).until(lambda m: checkbox.is_selected())
def a11y_click_month_display_button(self): self.accessibility.click(self.marionette.find_element(*self._month_display_button_locator)) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._current_monthly_calendar_locator)))) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._current_month_day_agenda_locator))))
def launch(self): Base.launch(self) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._visible_clock_locator)))) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._alarm_create_new_locator))))
def unlock_to_passcode_pad(self): Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._lockscreen_handle_locator)))) self._slide_to_unlock('homescreen') Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._lockscreen_passcode_code_locator)))) return PasscodePad(self.marionette)
def tap_unlink_contact(self): facebook_unlink_button = Wait(self.marionette).until(expected.element_present(*self._facebook_link_locator)) Wait(self.marionette).until(expected.element_displayed(facebook_unlink_button)) facebook_unlink_button.tap() facebook_confirm_unlink_button = Wait(self.marionette).until(expected.element_present(*self._confirm_unlink_button_locator)) Wait(self.marionette).until(expected.element_displayed(facebook_confirm_unlink_button)) facebook_confirm_unlink_button.tap() self.apps.switch_to_displayed_app()
def __init__(self, marionette): Base.__init__(self, marionette) # wait for the pop up screen to open view = Wait(self.marionette).until(expected.element_present(*self._iframe_locator)) self.marionette.switch_to_frame(view) # wait for the page to load email = Wait(self.marionette).until(expected.element_present(*self._email_locator)) Wait(self.marionette).until(lambda m: email.get_attribute("value") != "")
def tap_import_from_sim(self): import_from_sim = Wait(self.marionette).until( expected.element_present(*self._import_from_sim_button_locator)) Wait(self.marionette).until(expected.element_displayed(import_from_sim)) import_from_sim.tap() from gaiatest.apps.contacts.app import Contacts status_message = Wait(self.marionette).until( expected.element_present(*Contacts._status_message_locator)) Wait(self.marionette).until(expected.element_displayed(status_message)) Wait(self.marionette).until(expected.element_not_displayed(status_message))
def __init__(self, marionette): Base.__init__(self, marionette) # go into iframe of usage app settings frame = Wait(self.marionette).until(expected.element_present( *self._settings_iframe_locator)) Wait(self.marionette).until(expected.element_displayed(frame)) self.marionette.switch_to_frame(frame) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._settings_title_locator))))
def tap_next(self): next = Wait(self.marionette).until(expected.element_present(*self._next_locator)) Wait(self.marionette).until(lambda m: next.get_attribute('disabled') != 'true') next.tap() account = Wait(self.marionette).until( expected.element_present(*self._account_prefs_section_locator)) Wait(self.marionette).until(lambda m: account.location['x'] == 0) Wait(self.marionette, timeout=120).until(expected.element_displayed( Wait(self.marionette, timeout=120).until(expected.element_present( *self._account_prefs_next_locator))))
def tap_delete_button(self, confirm=True): delete_button = Wait(self.marionette).until( expected.element_present(*self._delete_thumbnail_locator)) Wait(self.marionette).until(expected.element_displayed(delete_button)) delete_button.tap() if confirm: confirm_decision_button = Wait(self.marionette).until( expected.element_present(*self._delete_confirm_locator)) else: confirm_decision_button = Wait(self.marionette).until( expected.element_present(*self._delete_cancel_locator)) Wait(self.marionette).until(expected.element_displayed(confirm_decision_button)) confirm_decision_button.tap()
def reset_mobile_usage(self): self.marionette.find_element(*self._reset_button_locator).tap() reset_mobile_usage = Wait(self.marionette).until( expected.element_present(*self._reset_mobile_usage_button_locator)) Wait(self.marionette).until(expected.element_displayed(reset_mobile_usage)) reset_dialog = self.marionette.find_element(*self._reset_dialog_locator) reset_mobile_usage.tap() confirm_reset_button = Wait(self.marionette).until( expected.element_present(*self._confirm_reset_button_locator)) Wait(self.marionette).until(expected.element_displayed(confirm_reset_button)) confirm_reset_button.tap() Wait(self.marionette).until(expected.element_not_displayed(reset_dialog))
def search(self, term): iframe = Wait(self.marionette).until( expected.element_present(*self._marketplace_iframe_locator)) Wait(self.marionette).until(expected.element_displayed(iframe)) self.marionette.switch_to_frame(iframe) search_box = Wait(self.marionette).until( expected.element_present(*self._search_locator)) Wait(self.marionette).until(expected.element_displayed(search_box)) # search for the app search_box.send_keys(term) search_box.send_keys(Keys.RETURN) return SearchResults(self.marionette)
def a11y_click_next_to_timezone_section(self): self.a11y_click_next() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._section_date_time_locator))))
def confirm_suggestion_notice(self): confirm = Wait(self.marionette).until( expected.element_present( *self._search_suggestion_ok_button_locator)) Wait(self.marionette).until(expected.element_displayed(confirm)) confirm.tap() Wait(self.marionette).until(expected.element_not_displayed(confirm))
def __init__(self, marionette): Base.__init__(self, marionette) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._crop_view_locator)))) done = self.marionette.find_element(*self._crop_done_button_locator) Wait(self.marionette).until(expected.element_enabled(done))
def tap_share_button(self): share_button = Wait(self.marionette).until( expected.element_present(*self._share_thumbnail_locator)) Wait(self.marionette).until(expected.element_displayed(share_button)) share_button.tap() from gaiatest.apps.system.regions.activities import Activities return Activities(self.marionette)
def a11y_click_next_to_wifi_section(self): progress = self.marionette.find_element(*self._progress_activity_locator) self.a11y_click_next() Wait(self.marionette).until(expected.element_not_displayed(progress)) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._section_wifi_locator))))
def tap_next(self): next = Wait(self.marionette).until( expected.element_present(*self._next_locator)) Wait(self.marionette).until( lambda m: next.get_attribute('disabled') != 'true') next.tap() account = Wait(self.marionette).until( expected.element_present(*self._account_prefs_section_locator)) Wait(self.marionette).until(lambda m: account.location['x'] == 0) Wait(self.marionette, timeout=120).until( expected.element_displayed( Wait(self.marionette, timeout=120).until( expected.element_present( *self._account_prefs_next_locator))))
def tap_next_to_wifi_section(self): progress = self.marionette.find_element(*self._loading_overlay_locator) self.tap_next() Wait(self.marionette).until(expected.element_not_displayed(progress)) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._section_wifi_locator))))
def a11y_first_predictive_word_click(self): self.switch_to_keyboard() element = Wait(self.marionette).until( expected.element_present(*self._predicted_word_locator)) Wait(self.marionette).until(expected.element_displayed(element)) self.accessibility.click(element) self.apps.switch_to_displayed_app()
def tap_keyboard_language_key(self): self.switch_to_keyboard() key = Wait(self.marionette).until( expected.element_present(*self._language_key_locator)) Wait(self.marionette).until(expected.element_displayed(key)) key.tap() self.apps.switch_to_displayed_app()
def close_app(self, app): self.wait_for_card_ready(app) Wait(self.marionette).until( expected.element_present(*self._app_card_locator(app))) self.marionette.find_element(*self._close_button_locator(app)).tap() Wait(self.marionette).until( expected.element_not_present(*self._app_card_locator(app)))
def a11y_click_day_display_button(self): self.accessibility.click( self.marionette.find_element(*self._day_display_button_locator)) Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present(*self._day_view_locator))))
def disable_geolocation(self): element = Wait(self.marionette).until( expected.element_present( *self._enable_geolocation_checkbox_locator)) Wait(self.marionette).until(expected.element_displayed(element)) # TODO: Remove y parameter when Bug 932804 is fixed element.tap(y=30)
def tap_export_contacts(self): export_contacts = Wait(self.marionette).until( expected.element_present(*self._export_contacts_locator)) Wait(self.marionette).until(expected.element_displayed(export_contacts)) export_contacts.tap() import_settings = self.marionette.find_element(*self._import_settings_locator) Wait(self.marionette).until(lambda m: import_settings.location['x'] == 0)
def a11y_click_next_to_firefox_accounts_section(self): self.a11y_click_next() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._section_firefox_accounts_locator))))
def select_when_use_is_above_unit_and_value(self, unit, value): self.marionette.find_element(*self._data_alert_selector_locator).tap() data_limit_view = self.marionette.find_element( *self._data_limit_view_locator) Wait(self.marionette).until( lambda m: data_limit_view.location['y'] == 0) current_unit = Wait(self.marionette).until( expected.element_present(*self._data_limit_switch_unit_locator)) Wait(self.marionette).until(expected.element_displayed(current_unit)) if current_unit.text != unit: current_unit.tap() Wait(self.marionette).until(lambda m: current_unit.text == unit) # clear the original assigned value and set it to the new value self.marionette.find_element( *self._data_limit_dialog_input_locator).clear() self.keyboard.send(value) self.switch_to_ftu() self.marionette.find_element( *self._data_limit_dialog_done_locator).tap() data_limit_view = self.marionette.find_element( *self._data_limit_view_locator) Wait(self.marionette).until(lambda m: int(data_limit_view.location[ 'y']) == int(data_limit_view.size['height']))
def __init__(self, marionette): Base.__init__(self, marionette) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._actions_menu_locator)))) # TODO Difficult intermittent bug 977052 time.sleep(1)
def a11y_click_next_to_privacy_browser_section(self): self.a11y_click_next() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._section_browser_privacy_locator))))
def tap_delete_button(self): self.marionette.find_element(*self._delete_image_locator).tap() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until(expected.element_present(*self._confirm_delete_locator)) ) )
def launch(self): Base.launch(self) Wait(self.marionette, ignored_exceptions=JavascriptException).until( lambda m: m.execute_script('return window.wrappedJSObject.Contacts.asyncScriptsLoaded;') is True) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._settings_button_locator))))
def send(self, string): self.switch_to_keyboard() for val in string: if ord(val) > 127: # this would get the right key to long press and switch to the right keyboard middle_key_val = self._find_key_for_longpress( val.encode('UTF-8')) self._switch_to_correct_layout(middle_key_val) # find the key to long press and press it to get the extended characters list middle_key = self.marionette.find_element( *self._key_locator(middle_key_val)) action = Actions(self.marionette) action.press(middle_key).wait(1).perform() # find the targeted extended key to send key = Wait(self.marionette).until( expected.element_present(*self._key_locator(val))) Wait(self.marionette).until(expected.element_displayed(key)) action.move(key).release().perform() else: # after switching to correct keyboard, tap/click if the key is there self._switch_to_correct_layout(val) self._tap(val) # when we tap on '@' the layout switches to the default keyboard - Bug 996332 if val == '@': Wait(self.marionette).until( lambda m: self._layout_page == 0) self.apps.switch_to_displayed_app()
def a11y_click_settings(self): settings = Wait(self.marionette).until( expected.element_present(*self._settings_a11y_locator)) Wait(self.marionette).until( lambda m: self.accessibility.is_visible(settings)) self.accessibility.click(settings) return Settings(self.marionette)
def tap_first_predictive_word(self): self.switch_to_keyboard() key = Wait(self.marionette).until( expected.element_present(*self._predicted_word_locator)) Wait(self.marionette).until(expected.element_displayed(key)) key.tap() self.apps.switch_to_displayed_app()
def launch(self): Base.launch(self) # empty message is only displayed after first MonthsDay#render, # so we are sure app is "ready" after that Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._event_list_empty_locator))))
def tap_export_to_sim(self): export_to_sim = Wait(self.marionette).until( expected.element_present(*self._export_to_sim_button_locator)) Wait(self.marionette).until(expected.element_displayed(export_to_sim)) export_to_sim.tap() select_contacts = self.marionette.find_element(*self._select_contacts_locator) Wait(self.marionette).until(lambda m: select_contacts.location['y'] == 0)
def tap_done(self): done = Wait(self.marionette, timeout=60).until( expected.element_present(*self._done_locator)) Wait(self.marionette).until(expected.element_displayed(done)) done.tap() #Switch back to the settings app self.apps.switch_to_displayed_app()
def tap_delete_contacts(self): delete_contacts = Wait(self.marionette).until( expected.element_present(*self._delete_contacts_locator)) Wait(self.marionette).until(expected.element_displayed(delete_contacts)) delete_contacts.tap() select_contacts = self.marionette.find_element(*self._select_contacts_locator) Wait(self.marionette).until(lambda m: select_contacts.location['y'] == 0)
def __init__(self, marionette): Base.__init__(self, marionette) Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._messaging_settings_locator))))
def tap_import_from_gmail(self): import_from_gmail = Wait(self.marionette).until( expected.element_present(*self._import_from_gmail_button_locator)) Wait(self.marionette).until(expected.element_displayed(import_from_gmail)) import_from_gmail.tap() from gaiatest.apps.contacts.regions.gmail import GmailLogin return GmailLogin(self.marionette)
def tap_cover_in_player_view(self): self.marionette.find_element(*self._cover_image_locator).tap() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present(*self._rating_view_locator))))
def filter_search_all_apps(self): filter_select = Wait(self.marionette).until( expected.element_present(*self._filter_locator)) Wait(self.marionette).until(expected.element_displayed(filter_select)) filter_select.tap() self.select('All apps', tap_close=False) # After the select is gone, go back to the Marketplace app self.apps.switch_to_displayed_app() iframe = Wait(self.marionette).until( expected.element_present(*self._marketplace_iframe_locator)) Wait(self.marionette).until(expected.element_displayed(iframe)) self.marionette.switch_to_frame(iframe) return SearchResults(self.marionette)
def dismiss_banner(self): banner = Wait(self.marionette).until( expected.element_present( *self._banner_countdown_notification_locator)) Wait(self.marionette).until(expected.element_displayed(banner)) # We can't tap to clear the banner as sometimes it taps the underlying alarm changing the UI Wait(self.marionette).until(expected.element_not_displayed(banner))
def select_sim(self, sim): locators = [self._menuItem_carrier_sim1_locator, self._menuItem_carrier_sim2_locator] element = Wait(self.marionette).until( expected.element_present(*locators[sim])) Wait(self.marionette).until(expected.element_dispayed(element)) element.tap()
def tap_new_alarm(self): new_alarm = Wait(self.marionette).until( expected.element_present(*self._alarm_create_new_locator)) Wait(self.marionette).until(expected.element_displayed(new_alarm)) new_alarm.tap() from gaiatest.apps.clock.regions.alarm import NewAlarm return NewAlarm(self.marionette)
def launch(self): Base.launch(self) Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._section_languages_locator))))
def a11y_click_edit(self): edit = Wait(self.marionette).until(expected.element_present( *self._edit_contact_button_locator)) Wait(self.marionette).until(expected.element_displayed(edit)) self.accessibility.click(edit) from gaiatest.apps.contacts.regions.contact_form import EditContact return EditContact(self.marionette)
def tap_next_to_geolocation_section(self): self.tap_next() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._section_geolocation_locator))))
def a11y_click_next_to_import_contacts_section(self): self.a11y_click_next() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._section_import_contacts_locator))))
def tap_next_to_welcome_browser_section(self): self.tap_next() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._section_welcome_browser_locator))))
def find_wifi_network(self, network_ssid): wifi_network_locator = (By.CSS_SELECTOR, '#networks-list li[data-ssid="%s"]' % network_ssid) wifi_network = Wait(self.marionette).until( expected.element_present(*wifi_network_locator)) self.marionette.execute_script("arguments[0].scrollIntoView(false);", [wifi_network]) Wait(self.marionette).until(expected.element_displayed(wifi_network)) return wifi_network
def __init__(self, marionette): Base.__init__(self, marionette) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._contact_import_picker_frame_locator)))) select_contacts = self.marionette.find_element(*self._contact_import_picker_frame_locator) self.marionette.switch_to_frame(select_contacts)
def __init__(self, marionette): Base.__init__(self, marionette) Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until(expected.element_present(*self._current_image_locator)) ) )