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_select_button(self): select = self.marionette.find_element(*self._select_button_locator) Wait(self.marionette).until(expected.element_enabled(select)) select.tap() # Fall back to app beneath the picker Wait(self.mariontte).until(lambda m: self.apps.displayed_app.name != self.name) self.apps.switch_to_displayed_app()
def tap_select_button(self): select = self.marionette.find_element(*self._select_button_locator) Wait(self.marionette).until(expected.element_enabled(select)) select.tap() # Fall back to app beneath the picker Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != self.name) self.apps.switch_to_displayed_app()
def tap_select_all(self): # TODO replace this with proper tap when Bug 932804 is resolved self.marionette.execute_script( 'window.wrappedJSObject.importer.ui.selectAll();', special_powers=True) el = self.marionette.find_element(*self._import_button_locator) Wait(self.marionette).until(expected.element_enabled(el))
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_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_toggle_flash_button(self): initial_flash_mode = self.current_flash_mode toggle = self.marionette.find_element( *self._toggle_flash_button_locator) Wait(self.marionette).until(expected.element_enabled(toggle)) toggle.tap() Wait(self.marionette).until( lambda m: self.current_flash_mode != initial_flash_mode)
def enable_bluetooth(self): self.marionette.find_element(*self._bluetooth_label_locator).tap() checkbox = self.marionette.find_element( *self._bluetooth_checkbox_locator) Wait(self.marionette).until(expected.element_selected(checkbox)) rename_device = self.marionette.find_element( *self._rename_my_device_button_locator) Wait(self.marionette).until(expected.element_enabled(rename_device))
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_grant_access(self): grant_access = self.marionette.find_element(*self._grant_access_button_locator) Wait(self.marionette).until(expected.element_enabled(grant_access)) grant_access.tap() # Go back to displayed Contacts app before waiting for the picker Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == 'Contacts') self.apps.switch_to_displayed_app() from gaiatest.apps.contacts.regions.contact_import_picker import ContactImportPicker return ContactImportPicker(self.marionette)
def __init__(self, marionette): Base.__init__(self, marionette) Wait(self.marionette).until(expected.element_displayed( Wait(self.marionette).until(expected.element_present( *self._edit_preview_canvas_locator)))) # I have tried waiting for all the elements in the UI, but the crash # still occurs so the only solution I found was the hardcoded sleep - Bug 1111981 time.sleep(3) done = self.marionette.find_element(*self._crop_done_button_locator) Wait(self.marionette).until(expected.element_enabled(done))
def tap_reset_button(self): button = Wait(self.marionette).until( expected.element_present(*self._reset_pin_button_locator)) Wait(self.marionette).until(expected.element_displayed(button)) Wait(self.marionette).until(expected.element_enabled(button)) # This workaround is required for gaia v2.0, but can be removed in later versions # as the bug has been fixed # Bug 937053 - tap() method should calculate elementInView from the coordinates of the tap self.marionette.execute_script('arguments[0].scrollIntoView(false);', [button]) button.tap()
def tap_grant_access(self): grant_access = self.marionette.find_element( *self._grant_access_button_locator) Wait(self.marionette).until(expected.element_enabled(grant_access)) grant_access.tap() # Go back to displayed Contacts app before waiting for the picker Wait(self.marionette).until( lambda m: self.apps.displayed_app.name == 'Contacts') self.apps.switch_to_displayed_app() from gaiatest.apps.contacts.regions.contact_import_picker import ContactImportPicker return ContactImportPicker(self.marionette)
def __init__(self, marionette): Base.__init__(self, marionette) Wait(self.marionette).until( expected.element_displayed( Wait(self.marionette).until( expected.element_present( *self._edit_preview_canvas_locator)))) # I have tried waiting for all the elements in the UI, but the crash # still occurs so the only solution I found was the hardcoded sleep - Bug 1111981 time.sleep(3) done = self.marionette.find_element(*self._crop_done_button_locator) Wait(self.marionette).until(expected.element_enabled(done))
def tap_select_button(self): select = self.marionette.find_element(*self._select_button_locator) Wait(self.marionette).until(expected.element_enabled(select)) try: select.tap() except FrameSendFailureError: # The frame may close for Marionette but that's expected so we can continue - Bug 1065933 pass # Fall back to app beneath the picker Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != self.name) self.apps.switch_to_displayed_app()
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 enable_bluetooth(self): self.marionette.find_element(*self._bluetooth_label_locator).tap() checkbox = self.marionette.find_element(*self._bluetooth_checkbox_locator) Wait(self.marionette).until(expected.element_selected(checkbox)) rename_device = self.marionette.find_element(*self._rename_my_device_button_locator) Wait(self.marionette).until(expected.element_enabled(rename_device))
def _wait_for_toggle_ready(self, by, locator): checkbox = self.marionette.find_element(by, locator) Wait(self.marionette).until(expected.element_enabled(checkbox))
def tap_approve_access(self): approve_access = Wait(self.marionette).until( expected.element_present(*self._approve_access_locator)) Wait(self.marionette).until(expected.element_enabled(approve_access)) approve_access.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_displayed(take_tour)) Wait(self.marionette).until(expected.element_enabled(take_tour)) take_tour.tap()
def wait_for_phone_number_ready(self): # entering dialer and expecting a phone number there is javascript that # sets the phone value and enables this button add_contact = self.marionette.find_element( *self._add_new_contact_button_locator) Wait(self.marionette).until(expected.element_enabled(add_contact))
def tap_capture(self): capture_button = self.marionette.find_element(*self._capture_button_locator) Wait(self.marionette).until(expected.element_enabled(capture_button)) capture_button.tap()
def tap_phone_number(self): call = self.marionette.find_element(*self._call_phone_number_button_locator) Wait(self.marionette).until(expected.element_enabled(call)) call.tap() from gaiatest.apps.phone.regions.call_screen import CallScreen return CallScreen(self.marionette)
def tap_pin_continue(self): button = Wait(self.marionette).until( expected.element_present(*self._pin_continue_button_locator)) Wait(self.marionette).until(expected.element_displayed(button)) Wait(self.marionette).until(expected.element_enabled(button)) button.tap()
def tap_select_all(self): # TODO replace this with proper tap when Bug 932804 is resolved self.marionette.execute_script('window.wrappedJSObject.importer.ui.selectAll();', special_powers=True) el = self.marionette.find_element(*self._import_button_locator) Wait(self.marionette).until(expected.element_enabled(el))
def wait_for_update_button_enabled(self): update = self.marionette.find_element(*self._update_locator) Wait(self.marionette).until(expected.element_enabled(update))
def tap_toggle_flash_button(self): initial_flash_mode = self.current_flash_mode toggle = self.marionette.find_element(*self._toggle_flash_button_locator) Wait(self.marionette).until(expected.element_enabled(toggle)) toggle.tap() Wait(self.marionette).until(lambda m: self.current_flash_mode != initial_flash_mode)
def tap_subject(self): subject = self.root_element.find_element(*self._subject_locator) Wait(self.marionette).until(expected.element_enabled(subject)) subject.tap() from gaiatest.apps.email.regions.read_email import ReadEmail return ReadEmail(self.marionette)
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)) Wait(self.marionette).until(expected.element_enabled(next)) next.tap()