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 __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)))
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 _switch_to_correct_layout(self, val): if val.isspace() or val in [',', '.']: # certain keys are available on every keyboard panel pass # Alphabetic keys available on the basic page elif val.isalpha(): is_upper_case = self._is_upper_case # If the key to press isalpha and the keyboard layout is not, go back to Basic if not self._layout_page == 0: self._tap_page_switching_key(0) Wait(self.marionette).until(lambda m: self._layout_page == 0) # If the key to press isupper and the keyboard is not (or vice versa) then press shift if not val.isupper() == is_upper_case: self._tap(self._upper_case_key) Wait(self.marionette).until(lambda m: is_upper_case != self._is_upper_case) # Numbers and symbols are in other keyboard panels else: # If it's not space or alpha then it must be in Alternate or Symbol. # It can't be in Basic so let's go into Alternate and then try to find it if self._layout_page == 0 and not self._current_input_type == 'number' and not self._current_input_mode == 'numeric': self._tap_page_switching_key(1) page_0_key_locator = (self._page_switching_key_locator[0], self._page_switching_key_locator[1] % (0)) Wait(self.marionette).until(expected.element_displayed(*page_0_key_locator)) # If it is not present here then it must be in the other non-Basic page # (since we must be in either Alternate or Symbol at this stage) if not self.is_element_present(*self._key_locator(val)): if self._layout_page == 1: self._tap_page_switching_key(2) page_1_key_locator = (self._page_switching_key_locator[0], self._page_switching_key_locator[1] % (1)) Wait(self.marionette).until(expected.element_displayed(*page_1_key_locator)) else: self._tap_page_switching_key(1) page_2_key_locator = (self._page_switching_key_locator[0], self._page_switching_key_locator[1] % (2)) Wait(self.marionette).until(expected.element_displayed(*page_2_key_locator))
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_cancel_button_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 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 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 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_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))
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) # This sleep seems necessary, otherwise on device we get timeout failure on display search_box sometimes, see bug 1136791 import time time.sleep(10) search_toggle = Wait(self.marionette).until( expected.element_present(*self._search_toggle_locator)) Wait(self.marionette).until(expected.element_displayed(search_toggle)) search_toggle.tap() search_box = Wait(self.marionette).until( expected.element_present(*self._search_locator)) Wait(self.marionette).until(expected.element_displayed(search_box)) # This sleep is necessary, otherwise the search results are not shown on desktop b2g import time time.sleep(0.5) # search for the app search_box.send_keys(term) search_box.send_keys(Keys.RETURN) return SearchResults(self.marionette)
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))
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 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))
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 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 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_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()
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_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_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 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()
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 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 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_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))
def tap_rename_my_device(self): _rename_my_device_button_locator = (By.CSS_SELECTOR, 'button.rename-device') _update_device_name_input_locator = (By.CSS_SELECTOR, 'input.settings-dialog-input') Wait(self.marionette, timeout=120).until( expected.element_displayed(*_rename_my_device_button_locator)) rename_my_device_button = self.marionette.find_element(*_rename_my_device_button_locator) Wait(self.marionette).until(expected.element_enabled(rename_my_device_button)) rename_my_device_button.tap() Wait(self.marionette, timeout=120).until( expected.element_displayed(*_update_device_name_input_locator))
def enable_fixed_dialing(self): element = self.marionette.find_element(*self._toggle_fixed_dialing_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._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_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 switch_to_settings_iframe(self): # 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_clear_private_data(self): self.marionette.find_element(*self._clear_private_data_locator).tap() Wait(self.marionette).until( expected.element_displayed( self.marionette.find_element(*self._clear_button_locator)))
def wait_for_view_displayed(self, view_name): title = self.marionette.find_element(*self._title_locator) Wait(self.marionette).until(expected.element_displayed(title)) Wait(self.marionette).until(lambda m: title.text == view_name)
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()
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 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(*self._section_wifi_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 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 media(self): elements = Wait(self.marionette).until( expected.elements_present(*self._list_item_locator)) Wait(self.marionette).until(expected.element_displayed(elements[0])) return [Media(self.marionette, element) for element in elements]
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 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 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_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 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 ArtistsView(self.marionette)
def tap_confirm_delete(self): Wait(self.marionette).until( expected.element_displayed(*self._delete_form_locator)) self.marionette.find_element(*self._confirm_delete_locator).tap()
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 search_results(self): results = Wait(self.marionette).until( lambda m: m.find_elements(*self._search_result_locator)) Wait(self.marionette).until(expected.element_displayed(results[0])) return [Result(self.marionette, result) for result in results]
def a11y_click_next_to_cell_data_section(self): self.a11y_click_next() Wait(self.marionette).until(expected.element_displayed(*self._section_cell_data_locator))
def wait_for_notification(self): Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present(*self._notification_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 wait_for_geolocation_icon_displayed(self): Wait(self.marionette, timeout=40000).until( expected.element_displayed(*self._geoloc_statusbar_locator))
def a11y_click_next_to_wifi_section(self): self.a11y_click_next() Wait(self.marionette).until( expected.element_not_displayed(*self._loading_overlay_locator)) Wait(self.marionette).until(expected.element_displayed(*self._section_wifi_locator))
def wait_for_airplane_mode_icon_displayed(self): Wait(self.marionette).until( expected.element_displayed(*self._airplane_mode_statusbar_locator))
def wait_for_music_tiles_displayed(self): self.switch_to_active_view() Wait(self.marionette).until( expected.element_displayed(*self._music_tiles_locator)) self.apps.switch_to_displayed_app()
def wait_for_system_banner_displayed(self): Wait(self.marionette).until( expected.element_displayed(*self._system_banner_locator))
def cancel_clear(self): self.marionette.find_element(*self._cancel_button_locator).tap() Wait(self.marionette).until( expected.element_displayed( self.marionette.find_element(*self._page_locator)))
def wait_for_software_home_button_displayed(self, timeout=10, message=None): Wait(self.marionette, timeout=timeout).until( expected.element_displayed(*self._software_home_button_locator), message)
def tap_clear_browsing_history(self): self.marionette.find_element( *self._clear_browsing_history_locator).tap() Wait(self.marionette).until( expected.element_displayed( self.marionette.find_element(*self._clear_button_locator)))
def wait_for_element_displayed(self, by, locator): return Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until( expected.element_present(by, locator))))
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))
def a11y_click_albums_tab(self): element = Wait(self.marionette).until( expected.element_present(*self._albums_tab_locator)) Wait(self.marionette).until(expected.element_displayed(element)) self.accessibility.click(element) return AlbumsView(self.marionette)