def tap_share_to_messages(self): element = Wait(self.marionette).until( expected.element_present(*self._share_to_messages_button_locator)) Wait(self.marionette).until(expected.element_displayed(element)) element.tap() from gaiatest.apps.messages.regions.new_message import NewMessage return NewMessage(self.marionette)
def tap_done(self): done = Wait(self.marionette).until(expected.element_present(*self._done_locator)) Wait(self.marionette).until(expected.element_displayed(done)) done.tap() view = self.marionette.find_element(*self._alarm_view_locator) Wait(self.marionette).until(lambda m: view.location['x'] == view.size['width']) return Clock(self.marionette)
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_settings(self): settings = Wait(self.marionette).until( expected.element_present(*self._settings_button_locator)) Wait(self.marionette).until(expected.element_displayed(settings)) settings.tap() from gaiatest.apps.cost_control.regions.settings import Settings return Settings(self.marionette)
def _perform_search(self, term): self.marionette.find_element(*self._search_toggle_locator).tap() search_box = Wait(self.marionette).until( expected.element_present(*self._search_input_locator)) Wait(self.marionette).until(expected.element_displayed(search_box)) search_box.send_keys(term) search_box.send_keys(Keys.RETURN)
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 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 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_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 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_call_button(self, switch_to_call_screen=True): element = Wait(self.marionette).until( expected.element_present(*self._call_bar_locator)) Wait(self.marionette).until(expected.element_enabled(element)) element.tap() if switch_to_call_screen: return CallScreen(self.marionette)
def 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 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 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 go_back(self): element = Wait(self.marionette).until(expected.element_present(*self._header_locator)) Wait(self.marionette).until(expected.element_displayed(element)) # TODO: replace this hard coded value with tap on the back button, after Bug 1061698 is fixed element.tap(x=10) Wait(self.marionette).until(lambda m: m.execute_script( "return window.wrappedJSObject.Settings && window.wrappedJSObject.Settings._currentPanel === '#root'"))
def tap_done(self): done_button = Wait(self.marionette).until( expected.element_present(*self._done_button_locator)) Wait(self.marionette).until(expected.element_displayed(done_button)) done_button.tap() # Switch back to Cost Control app frame self.apps.switch_to_displayed_app()
def enable_passcode_lock(self): # This wait would be in __init__ but lockscreen could be disabled meaning init would timeout element = Wait(self.marionette).until(expected.element_present(*self._passcode_enable_locator)) Wait(self.marionette).until(expected.element_displayed(element)) element.tap() section = self.marionette.find_element(*self._screen_lock_passcode_section_locator) Wait(self.marionette).until(lambda m: section.location['x'] == 0)
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_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_send(self, timeout=120): send = Wait(self.marionette).until( expected.element_present(*self._send_message_button_locator)) Wait(self.marionette).until(expected.element_enabled(send)) send.tap() self.wait_for_element_not_present(*self._message_sending_locator, timeout=timeout) from gaiatest.apps.messages.regions.message_thread import MessageThread return MessageThread(self.marionette)
def tap_confirm(self): # TODO add a good wait here when Bug 1008961 is resolved time.sleep(1) self.marionette.switch_to_frame() confirm = Wait(self.marionette).until(expected.element_present( *self._confirm_install_button_locator)) Wait(self.marionette).until(expected.element_displayed(confirm)) confirm.tap()
def tap_change_wallpaper(self): change_wallpaper = Wait(self.marionette).until( expected.element_present(*self._change_wallpaper_button_locator)) Wait(self.marionette).until(expected.element_displayed(change_wallpaper)) change_wallpaper.tap() from gaiatest.apps.system.regions.activities import Activities return Activities(self.marionette)
def tap_call(self): call = Wait(self.marionette).until(expected.element_present(*self._call_button_locator)) Wait(self.marionette).until(expected.element_displayed(call)) call.tap() from gaiatest.apps.phone.regions.keypad import Keypad keypad = Keypad(self.marionette) keypad.wait_for_phone_number_ready() return keypad
def tap_edit(self): edit = Wait(self.marionette).until(expected.element_present( *self._edit_contact_button_locator)) Wait(self.marionette).until(expected.element_displayed(edit)) edit.tap() Wait(self.marionette).until(expected.element_not_displayed(edit)) from gaiatest.apps.contacts.regions.contact_form import EditContact return EditContact(self.marionette)
def tap_add_collection(self): add_collection = Wait(self.marionette).until( expected.element_present(*self._add_collection_button_locator)) Wait(self.marionette).until(expected.element_displayed(add_collection)) add_collection.tap() from gaiatest.apps.homescreen.regions.collections_activity import CollectionsActivity return CollectionsActivity(self.marionette)
def tap_delete_confirmation_button(self): confirm = Wait(self.marionette).until( expected.element_present(*self._call_log_delete_confirmation_locator)) Wait(self.marionette).until(expected.element_displayed(confirm)) confirm.tap() Wait(self.marionette, ignored_exceptions=StaleElementException).until( lambda m: len(self.call_list) == 0)
def tap_next(self): # TODO Remove the sleep when Bug 1013249 is fixed time.sleep(2) next = Wait(self.marionette).until( expected.element_present(*self._next_button_locator)) Wait(self.marionette).until(expected.element_displayed(next)) next.tap() return FTUStep2(self.marionette)
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() Wait(self.marionette).until(expected.element_not_displayed(reset_dialog))
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 tap_sync_friends(self): element = Wait(self.marionette).until( expected.element_present(*self._sync_friends_locator)) Wait(self.marionette).until(expected.element_displayed(element)) element.tap() Wait(self.marionette).until( lambda m: m.find_element(*self._sync_friends_locator).location['x'] == 0) from gaiatest.apps.system.regions.facebook import FacebookLogin return FacebookLogin(self.marionette)
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
def set_timezone_city(self, city): element = Wait(self.marionette).until( expected.element_present(*self._timezone_city_locator)) Wait(self.marionette).until(expected.element_displayed(element)) element.tap() self.select(city)
def tap_tour_next(self): next = Wait(self.marionette).until( expected.element_present(*self._tour_next_button_locator)) Wait(self.marionette).until(expected.element_displayed(next)) next.tap()
def enable_data(self): checkbox = Wait(self.marionette).until( expected.element_present(*self._enable_data_checkbox_locator)) Wait(self.marionette).until(expected.element_displayed(checkbox)) checkbox.tap()
def wait_for_networks_available(self): Wait(self.marionette).until(lambda m: len( m.find_elements(*self._found_wifi_networks_locator)) > 0, message='No networks listed on screen')
def step6_header_text(self): header = Wait(self.marionette).until( expected.element_present(*self._step_header_locator)) Wait(self.marionette).until(expected.element_displayed(header)) return header.text
def switch_to_emergency_call_frame(self): frame = Wait(self.marionette).until( expected.element_present(*self._emergency_frame_locator)) Wait(self.marionette).until(expected.element_displayed(frame)) self.marionette.switch_to_frame(frame)
def launch(self): Base.launch(self) Wait(self.marionette).until( expected.element_not_displayed(*self._loading_spinner_locator))
def wait_for_search_results_to_load(self, minimum_expected_results=1): Wait(self.marionette).until( lambda m: len(m.find_elements(*self._search_results_locator) ) > minimum_expected_results)
def a11y_click_call_log_toolbar_button(self): element = Wait(self.marionette).until( expected.element_present(*self._call_log_toolbar_button_locator)) Wait(self.marionette).until(expected.element_displayed(element)) self.accessibility.click(element) return self.call_log
def tap_keypad_toolbar_button(self): element = Wait(self.marionette).until( expected.element_present(*self._keypad_toolbar_button_locator)) Wait(self.marionette).until(expected.element_displayed(element)) element.tap() return self.keypad
def wait_for_confirmation_dialog(self): Wait(self.marionette).until( expected.element_displayed(*self._dialog_locator))
def launch(self): Base.launch(self) Wait(self.marionette).until( expected.element_displayed(*self._keypad_toolbar_button_locator))
def wait_for_finish_tutorial_section(self): Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._section_tutorial_finish_locator))))
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)) element.tap() return CellDataPrompt(self.marionette)
def status_message(self): status = Wait(self.marionette).until( expected.element_present(*self._status_message_locator)) Wait(self.marionette).until(expected.element_displayed(status)) return status.text
def wait_for_music_tiles_displayed(self): Wait(self.marionette).until( expected.element_displayed(*self._music_tiles_locator))
def a11y_click_next_to_finish_section(self): self.a11y_click_next() Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present(*self._section_finish_locator))))
def tap_confirm_delete(self): delete_button = Wait(self.marionette).until( expected.element_present(*self._confirm_delete_locator)) Wait(self.marionette).until(expected.element_displayed(delete_button)) delete_button.tap()
def wait_for_empty_message_to_load(self): element = self.marionette.find_element( *self._empty_music_title_locator) Wait(self.marionette).until(lambda m: not element.text == '')
def tap_settings(self): settings = self.marionette.find_element(*self._settings_button_locator) settings.tap() Wait(self.marionette).until(expected.element_not_displayed(settings)) from gaiatest.apps.contacts.regions.settings_form import SettingsForm return SettingsForm(self.marionette)
def tap_artists_tab(self): element = Wait(self.marionette).until( expected.element_present(*self._artists_tab_locator)) Wait(self.marionette).until(expected.element_displayed(element)) element.tap() return ListView(self.marionette)
def tap_next(self): next_button = Wait(self.marionette).until( expected.element_present(*self._next_button_locator)) Wait(self.marionette).until(expected.element_enabled(next_button)) next_button.tap()
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))))
def a11y_enable_data(self): checkbox = Wait(self.marionette).until( expected.element_present(*self._enable_data_checkbox_locator)) Wait(self.marionette).until(expected.element_displayed(checkbox)) self.accessibility.click(checkbox)
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 a11y_set_timezone_continent(self, continent): element = Wait(self.marionette).until( expected.element_present(*self._timezone_continent_locator)) Wait(self.marionette).until(expected.element_displayed(element)) self.accessibility.click(element) self.a11y_select(continent)
def tap_confirm_deletion_button(self): element = self.marionette.find_element(*self._confirm_delete_locator) element.tap() Wait(self.marionette).until(expected.element_not_displayed(element))
def tap_back(self): back = Wait(self.marionette).until( expected.element_present(*self._tour_back_button_locator)) Wait(self.marionette).until(expected.element_displayed(back)) back.tap()
def tap_take_tour(self): take_tour = Wait(self.marionette).until( expected.element_present(*self._take_tour_button_locator)) Wait(self.marionette).until(expected.element_enabled(take_tour)) take_tour.tap()