Exemple #1
0
    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)
Exemple #2
0
 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(expected.element_selected(checkbox))
Exemple #3
0
 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))))
Exemple #4
0
    def launch(self):
        Base.launch(self)
        Wait(self.marionette).until(
            expected.element_present(*self._app_loaded_locator))

        # this is located at the end of the page.  If this is shown, everything is rendered.
        Wait(self.marionette).until(
            expected.element_present(*self._bluetooth_menu_item_locator))
Exemple #5
0
 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 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()
Exemple #7
0
 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)
Exemple #8
0
    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))))
Exemple #9
0
 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))
Exemple #10
0
    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') != '')
Exemple #11
0
    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()
Exemple #13
0
    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))
Exemple #14
0
 def gmail_login(self, user, passwd):
     email = Wait(self.marionette).until(
         expected.element_present(*self._email_locator))
     Wait(self.marionette).until(expected.element_displayed(email))
     email.tap()
     email.send_keys(user)
     self.marionette.find_element(*self._next_locator).tap()
     password = Wait(self.marionette).until(
         expected.element_present(*self._password_locator))
     Wait(self.marionette).until(expected.element_displayed(password))
     password.tap()
     password.send_keys(passwd)
     self.keyboard.dismiss()
     self.marionette.find_element(*self._sign_in_locator).tap()
 def __init__(self, marionette, url, video_selector='video', interval=1,
              set_duration=0, stall_wait_time=0, timeout=60,
              autostart=True):
     self.marionette = marionette
     self.test_url = url
     self.interval = interval
     self.stall_wait_time = stall_wait_time
     self.timeout = timeout
     self._set_duration = set_duration
     self.video = None
     self.expected_duration = 0
     self._first_seen_time = 0
     self._first_seen_wall_time = 0
     wait = Wait(self.marionette, timeout=self.timeout)
     with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
         self.marionette.navigate(self.test_url)
         self.marionette.execute_script("""
             log('URL: {0}');""".format(self.test_url))
         verbose_until(wait, self,
                       expected.element_present(By.TAG_NAME, 'video'))
         videos_found = self.marionette.find_elements(By.CSS_SELECTOR,
                                                      video_selector)
         if len(videos_found) > 1:
             self.marionette.log(type(self).__name__ + ': multiple video '
                                                       'elements found. '
                                                       'Using first.')
         if len(videos_found) <= 0:
             self.marionette.log(type(self).__name__ + ': no video '
                                                       'elements found.')
             return
         self.video = videos_found[0]
         self.marionette.execute_script("log('video element obtained');")
         if autostart:
             self.start()
Exemple #16
0
 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
Exemple #17
0
 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)
Exemple #18
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)
Exemple #19
0
 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 _search_ad_duration(self):
        """
        Try and determine ad duration. Refreshes state.

        :return: ad duration in seconds, if currently displayed in player
        """
        self._refresh_state()
        if not (self._last_seen_player_state.player_ad_playing or
                self._player_measure_progress() == 0):
            return None
        if (self._last_seen_player_state.player_ad_playing and
                self._last_seen_video_state.duration):
            return self._last_seen_video_state.duration
        selector = '.html5-video-player .videoAdUiAttribution'
        wait = Wait(self.marionette, timeout=5)
        try:
            with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
                wait.until(expected.element_present(By.CSS_SELECTOR,
                                                    selector))
                countdown = self.marionette.find_element(By.CSS_SELECTOR,
                                                         selector)
                ad_time = self._time_pattern.search(countdown.text)
                if ad_time:
                    ad_minutes = int(ad_time.group('minute'))
                    ad_seconds = int(ad_time.group('second'))
                    return 60 * ad_minutes + ad_seconds
        except (TimeoutException, NoSuchElementException):
            self.marionette.log('Could not obtain '
                                'element: {}'.format(selector),
                                level='WARNING')
        return None
 def __init__(self, marionette, url, autostart=True, **kwargs):
     self.player = None
     self._last_seen_player_state = None
     super(YouTubePuppeteer,
           self).__init__(marionette, url,
                          video_selector='.html5-video-player video',
                          autostart=False,
                          **kwargs)
     wait = Wait(self.marionette, timeout=30)
     with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
         verbose_until(wait, self,
                       expected.element_present(By.CLASS_NAME,
                                                'html5-video-player'))
         self.player = self.marionette.find_element(By.CLASS_NAME,
                                                    'html5-video-player')
         self.marionette.execute_script("log('.html5-video-player "
                                        "element obtained');")
     # When an ad is playing, self.player_duration indicates the duration
     # of the spliced-in ad stream, not the duration of the main video, so
     # we attempt to skip the ad first.
     for attempt in range(5):
         sleep(1)
         self.process_ad()
         if (self._last_seen_player_state.player_ad_inactive and
                 self._last_seen_video_state.duration and not
                 self._last_seen_player_state.player_buffering):
             break
     self._update_expected_duration()
     if autostart:
         self.start()
    def test_ssl_disabled_error_page(self):
        with self.marionette.using_context('content'):
            # Open the test page
            self.assertRaises(MarionetteException, self.marionette.navigate, self.url)

            # Wait for the DOM to receive events
            time.sleep(1)

            # Verify "Secure Connection Failed" error page title
            title = self.marionette.find_element(By.CLASS_NAME, 'title-text')
            nss_failure2title = self.browser.get_entity('nssFailure2.title')
            self.assertEquals(title.get_property('textContent'), nss_failure2title)

            # Verify the error message is correct
            short_description = self.marionette.find_element(By.ID, 'errorShortDescText')
            self.assertIn('SSL_ERROR_UNSUPPORTED_VERSION',
                          short_description.get_property('textContent'))
            self.assertIn('mozqa.com', short_description.get_property('textContent'))

            # Verify that the "Restore" button appears and works
            reset_button = self.marionette.find_element(By.ID, 'prefResetButton')
            reset_button.click()

            # With the preferences reset, the page has to load correctly
            Wait(self.marionette).until(expected.element_present(By.LINK_TEXT,
                                                                 'http://quality.mozilla.org'))
Exemple #23
0
 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)
Exemple #24
0
 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)
Exemple #25
0
 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)
Exemple #26
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)
Exemple #27
0
    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"
        )
Exemple #28
0
 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))))
Exemple #29
0
 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)))
Exemple #30
0
 def tap_back_button(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._test_panel_header_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     # TODO: remove tap with coordinates after Bug 1061698 is fixed
     element.tap(25, 25)
     Wait(self.marionette).until(expected.element_not_displayed(element))
Exemple #31
0
 def _wait_for_homescreen(self, timeout):
     log.info("Waiting for home screen to load")
     Wait(self.marionette, timeout).until(
         expected.element_present(By.CSS_SELECTOR,
                                  '#homescreen[loading-state=false]'))
Exemple #32
0
 def tap_settings(self):
     settings = Wait(self.marionette).until(
         expected.element_present(*self._settings_locator))
     Wait(self.marionette).until(expected.element_displayed(settings))
     settings.tap()
Exemple #33
0
 def a11y_click_manual_setup(self):
     manual_setup = Wait(self.marionette).until(
         expected.element_present(*self._manual_setup_locator))
     Wait(self.marionette).until(expected.element_displayed(manual_setup))
     self.accessibility.click(manual_setup)
     return ManualSetupEmail(self.marionette)
Exemple #34
0
 def enable_lockscreen(self):
     self._lockscreen_switch.enable()
     Wait(self.marionette).until(
         expected.element_present(*self._passcode_checkbox_locator)
         and expected.element_present(*self._passcode_checkbox_locator))
Exemple #35
0
 def tap_search(self):
     search = Wait(self.marionette).until(
         expected.element_present(*self._search_locator))
     Wait(self.marionette).until(expected.element_displayed(search))
     search.tap()
Exemple #36
0
 def tap_sim_1_setting(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._sim_1_settings_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     return SimSettings(self.marionette)
Exemple #37
0
 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 wait_until_call_barring_info_received(self):
     Wait(self.marionette, timeout=120, interval=1).until(
         expected.element_present(
             *self._call_barring_status_disabled_locator))
Exemple #39
0
 def tap_refresh(self):
     refresh = Wait(self.marionette).until(
         expected.element_present(*self._refresh_locator))
     Wait(self.marionette).until(expected.element_displayed(refresh))
     refresh.tap()
Exemple #40
0
 def tap_edit(self):
     edit = Wait(self.marionette).until(
         expected.element_present(*self._edit_locator))
     Wait(self.marionette).until(expected.element_displayed(edit))
     edit.tap()
Exemple #41
0
 def tap_manual_setup(self):
     manual_setup = Wait(self.marionette).until(
         expected.element_present(*self._manual_setup_locator))
     Wait(self.marionette).until(expected.element_displayed(manual_setup))
     manual_setup.tap()
     return ManualSetupEmail(self.marionette)
Exemple #42
0
 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()