Exemplo n.º 1
0
Arquivo: app.py Projeto: pottierg/gaia
    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)
Exemplo n.º 2
0
 def write_and_save_note(self, text):
     note_content = Wait(self.marionette).until(expected.element_present(*self._note_content_locator))
     Wait(self.marionette).until(expected.element_displayed(note_content))
     note_content.tap()
     note_content.send_keys(text)
     self.marionette.find_element(*self._save_note).tap()
     return NotesMainMenu(self.marionette)
Exemplo n.º 3
0
 def _type_in_field(self, add_locator, field_locator, value):
     Wait(self.marionette).until(
         expected.element_present(*add_locator)).tap()
     element = Wait(self.marionette).until(
         expected.element_present(*field_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.clear()
     element.send_keys(value)
Exemplo n.º 4
0
 def email(self, value):
     """Set the value of the email field."""
     email = Wait(self.driver, self.timeout).until(
         expected.element_present(*self._email_input_locator))
     Wait(self.driver, self.timeout).until(
         expected.element_displayed(email))
     email.clear()
     email.send_keys(value)
Exemplo n.º 5
0
 def email(self, value):
     """Set the value of the email field."""
     email = Wait(self.driver, self.timeout).until(
         expected.element_present(*self._email_input_locator))
     Wait(self.driver,
          self.timeout).until(expected.element_displayed(email))
     email.clear()
     email.send_keys(value)
Exemplo n.º 6
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)
     password = self.marionette.find_element(*self._password_locator)
     password.tap()
     password.send_keys(passwd)
     self.keyboard.dismiss()
     self.marionette.find_element(*self._sign_in_locator).tap()
Exemplo n.º 7
0
Arquivo: gmail.py Projeto: uniony/gaia
 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)
     password = self.marionette.find_element(*self._password_locator)
     password.tap()
     password.send_keys(passwd)
     self.keyboard.dismiss()
     self.marionette.find_element(*self._sign_in_locator).tap()
Exemplo n.º 8
0
    def a11y_connect_to_wifi(self, network_ssid, password, key_management=None):
        wifi_network = self.find_wifi_network(network_ssid)
        self.accessibility.click(wifi_network)

        # This is in the event we are using a Wifi Network that requires a password
        # We cannot be sure of this thus need the logic
        if key_management:
            password_element = Wait(self.marionette).until(
                expected.element_present(*self._password_input_locator))
            Wait(self.marionette).until(expected.element_displayed(password_element))
            password_element.send_keys(password)
            self.accessibility.click(self.marionette.find_element(*self._join_network_locator))
Exemplo n.º 9
0
Arquivo: app.py Projeto: Anirudh0/gaia
    def a11y_connect_to_wifi(self, network_ssid, password, key_management=None):
        wifi_network = self.find_wifi_network(network_ssid)
        self.accessibility.click(wifi_network)

        # This is in the event we are using a Wifi Network that requires a password
        # We cannot be sure of this thus need the logic
        if key_management:
            password_element = Wait(self.marionette).until(
                expected.element_present(*self._password_input_locator))
            Wait(self.marionette).until(expected.element_displayed(password_element))
            password_element.send_keys(password)
            self.accessibility.click(self.marionette.find_element(*self._join_network_locator))
Exemplo n.º 10
0
    def enter_password(self, password=None):
        self._switch_to_fxa_iframe()
        passwd_field = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._password_locator))
        passwd_field.send_keys(password)

        # Wait until the keyboard is completely displayed, otherwise tapping
        # the next button is unreliable
        self.marionette.switch_to_frame()
        Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
        self._switch_to_fxa_iframe()
        self.marionette.find_element(*self._next_locator).tap()
Exemplo n.º 11
0
    def select_when_use_is_above_unit_and_value(self, unit, value):
        when_use_is_above_button = self.marionette.find_element(*self._when_use_is_above_button_locator)
        Wait(self.marionette).until(lambda m: when_use_is_above_button.get_attribute('disabled') == 'false')
        when_use_is_above_button.tap()

        current_unit = Wait(self.marionette).until(
            expected.element_present(*self._unit_button_locator))
        Wait(self.marionette).until(expected.element_displayed(current_unit))
        if current_unit.text != unit:
            current_unit.tap()
            # We need to wait for the javascript to do its stuff
            Wait(self.marionette).until(lambda m: current_unit.text == unit)

        # clear the original assigned value and set it to the new value
        size = Wait(self.marionette).until(expected.element_present(*self._size_input_locator))
        Wait(self.marionette).until(expected.element_displayed(size))
        size.clear()
        size.send_keys(value)
        self.marionette.find_element(*self._usage_done_button_locator).tap()
Exemplo n.º 12
0
    def enter_email(self, email=None):
        self.marionette.switch_to_frame()
        iframe = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._iframe_locator))
        Wait(self.marionette).until(expected.element_displayed(iframe))
        Wait(self.marionette, timeout=60).until(lambda m: iframe.get_attribute('data-url') != 'about:blank')
        self.marionette.switch_to_frame(iframe)

        input = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._input_locator))
        Wait(self.marionette).until(expected.element_displayed(input))
        input.send_keys(email)

        # Wait until the keyboard is completely displayed, otherwise tapping
        # the next button is unreliable
        self.marionette.switch_to_frame()
        Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
        self.marionette.switch_to_frame(iframe)

        self.marionette.find_element(*self._next_locator).tap()
Exemplo n.º 13
0
    def enter_email(self, email=None):
        self.marionette.switch_to_frame()
        iframe = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._iframe_locator))
        Wait(self.marionette).until(expected.element_displayed(iframe))
        Wait(self.marionette, timeout=60).until(
            lambda m: iframe.get_attribute('data-url') != 'about:blank')
        self.marionette.switch_to_frame(iframe)

        input = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._input_locator))
        Wait(self.marionette).until(expected.element_displayed(input))
        input.send_keys(email)

        # Wait until the keyboard is completely displayed, otherwise tapping
        # the next button is unreliable
        self.marionette.switch_to_frame()
        Wait(self.marionette).until(
            lambda m: self.keyboard.is_keyboard_displayed)
        self.marionette.switch_to_frame(iframe)

        self.marionette.find_element(*self._next_locator).tap()
Exemplo n.º 14
0
    def select_when_use_is_above_unit_and_value(self, unit, value):
        when_use_is_above_button = self.marionette.find_element(
            *self._when_use_is_above_button_locator)
        Wait(self.marionette).until(lambda m: when_use_is_above_button.
                                    get_attribute('disabled') == 'false')
        when_use_is_above_button.tap()

        current_unit = Wait(self.marionette).until(
            expected.element_present(*self._unit_button_locator))
        Wait(self.marionette).until(expected.element_displayed(current_unit))
        if current_unit.text != unit:
            current_unit.tap()
            # We need to wait for the javascript to do its stuff
            Wait(self.marionette).until(lambda m: current_unit.text == unit)

        # clear the original assigned value and set it to the new value
        size = Wait(self.marionette).until(
            expected.element_present(*self._size_input_locator))
        Wait(self.marionette).until(expected.element_displayed(size))
        size.clear()
        size.send_keys(value)
        self.marionette.find_element(*self._usage_done_button_locator).tap()
Exemplo n.º 15
0
 def _type_in_field(self, add_locator, field_locator, value):
     Wait(self.marionette).until(expected.element_present(*add_locator)).tap()
     element = Wait(self.marionette).until(expected.element_present(*field_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.clear()
     element.send_keys(value)
Exemplo n.º 16
0
 def type_password(self, password):
     element = Wait(self.marionette).until(
         expected.element_present(*self._password_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.send_keys(password)
Exemplo n.º 17
0
    def test_fxa_sync(self):
        hostname = 'restmail.net'
        password = ''.join(
            [random.choice(string.ascii_letters) for i in range(8)])
        account_email = 'fxa-e2e-' + ''.join(
            random.choice(string.ascii_lowercase) for _ in range(12))
        email_pattern = account_email + '@' + hostname

        with self.marionette.using_context('content'):
            self.marionette.navigate(self.url_signup)

            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.ID, 'fxa-pp'))

            input_email = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR,
                                             '.input-row .email'))
            input_email.send_keys(email_pattern)

            input_password = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.ID, 'password'))
            input_password.send_keys(password)

            input_age = Wait(self.marionette,
                             timeout=self.marionette.timeout.page_load).until(
                                 expected.element_present(By.ID, 'age'))

            # repeat the send keys twice due to a bug with fast test runner typing
            input_age.send_keys('23')
            input_age.send_keys('23')

            self.marionette.find_element(By.ID, 'submit-btn').click()

            # Choose what to sync
            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(
                         By.ID, 'fxa-choose-what-to-sync-header'))

            self.marionette.find_element(By.ID, 'submit-btn').click()

            # Confirm your account
            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.ID, 'fxa-confirm-header'))

            # Waiting for the email
            time.sleep(6)

            response = urllib.urlopen(self.url_restmail + account_email)
            email_data = json.loads(response.read())

            self.marionette.navigate(email_data[0]['headers']['x-link'])

            # Due to A/B testing here we need to take a different path:
            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.ID, 'fox-logo'))

            # Account Confirmed
            time.sleep(4)
            if "connect_another_device" in self.marionette.get_url():
                Wait(self.marionette,
                     timeout=self.marionette.timeout.page_load).until(
                         expected.element_present(
                             By.CSS_SELECTOR,
                             '.graphic-connect-another-device'))
            else:
                Wait(self.marionette,
                     timeout=self.marionette.timeout.page_load).until(
                         expected.element_present(By.CSS_SELECTOR,
                                                  '.graphic-checkbox'))

            # give time for sync to kick in...
            time.sleep(3)

            self.marionette.navigate('about:preferences#sync')

            button_manage = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.ID, 'verifiedManage'))
            button_manage.click()

            # Wait for the window to open
            time.sleep(3)

            # Switch to the new Window
            self.marionette.switch_to_window(self.marionette.window_handles[1])

            # Account settings

            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.ID,
                                              'fxa-settings-profile-header'))

            # Login to reliers with this account

            # Add-ons
            self.marionette.navigate(
                'https://addons.mozilla.org/en-US/firefox/')

            button_login = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR,
                                             '.login > a:nth-child(2)'))
            button_login.click()

            fxa_login = Wait(self.marionette,
                             timeout=self.marionette.timeout.page_load).until(
                                 expected.element_present(
                                     By.CSS_SELECTOR, '.use-logged-in'))
            fxa_login.click()

            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.CSS_SELECTOR, '.logout'))

            # Pocket
            self.marionette.navigate('https://getpocket.com/login')

            button_login = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR,
                                             '.login-btn-firefox'))
            button_login.click()

            fxa_login = Wait(self.marionette,
                             timeout=self.marionette.timeout.page_load).until(
                                 expected.element_present(
                                     By.CSS_SELECTOR, '.use-logged-in'))
            fxa_login.click()

            fxa_accept = Wait(self.marionette,
                              timeout=self.marionette.timeout.page_load).until(
                                  expected.element_present(
                                      By.CSS_SELECTOR, '#accept'))
            fxa_accept.click()

            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.CSS_SELECTOR,
                                              '.gsf_pocketlogo'))

            # Pontoon
            self.marionette.navigate('https://pontoon.mozilla.org/teams/')

            button_menu = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR, '.menu-icon'))
            button_menu.click()

            button_login = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR, '#fxa-sign-in'))
            button_login.click()

            fxa_login = Wait(self.marionette,
                             timeout=self.marionette.timeout.page_load).until(
                                 expected.element_present(
                                     By.CSS_SELECTOR, '.use-logged-in'))
            fxa_login.click()

            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.CSS_SELECTOR, '#sign-out'))

            # Test Basket Subscription

            self.marionette.navigate(self.url_settings)

            comm_prefs = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(
                        By.CSS_SELECTOR,
                        '#communication-preferences .settings-button'))
            comm_prefs.click()

            sub_button = Wait(self.marionette,
                              timeout=self.marionette.timeout.page_load).until(
                                  expected.element_present(
                                      By.CSS_SELECTOR,
                                      '#marketing-email-optin'))
            sub_button.click()

            time.sleep(6)

            self.marionette.refresh()

            time.sleep(2)

            comm_prefs = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(
                        By.CSS_SELECTOR,
                        '#communication-preferences .settings-button'))
            comm_prefs.click()

            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.CSS_SELECTOR,
                                              '#preferences-url'))

            # Unsubscribe

            sub_button = Wait(self.marionette,
                              timeout=self.marionette.timeout.page_load).until(
                                  expected.element_present(
                                      By.CSS_SELECTOR,
                                      '#marketing-email-optin'))
            sub_button.click()

            # Devices, check the device is in settings

            device_prefs = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR,
                                             '#clients .settings-button'))
            device_prefs.click()

            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.CSS_SELECTOR,
                                              '#clients .client-current'))

            # Display Name

            display_name_prefs = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR,
                                             '#display-name .settings-button'))
            display_name_prefs.click()

            display_input = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR,
                                             'input.display-name'))

            display_input.send_keys('Display')

            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(
                         By.CSS_SELECTOR, '#display-name .primary')).click()

            # Display Name - wait for close if successful
            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(
                         By.CSS_SELECTOR,
                         '#display-name.settings-unit:not(.open)'))

            # Delete account
            button_delete = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(
                        By.CSS_SELECTOR, '#delete-account .settings-button'))
            button_delete.click()

            input_delete_password = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(By.CSS_SELECTOR,
                                             '#delete-account input.password'))
            input_delete_password.send_keys(password)

            button_delete = Wait(
                self.marionette,
                timeout=self.marionette.timeout.page_load).until(
                    expected.element_present(
                        By.CSS_SELECTOR,
                        '#delete-account button[type=submit]'))
            button_delete.click()

            # Deleted
            Wait(self.marionette,
                 timeout=self.marionette.timeout.page_load).until(
                     expected.element_present(By.ID, 'fxa-signup-header'))

            self.marionette.close()

            print "FxA / Sync work!"
Exemplo n.º 18
0
 def type_password(self, password):
     element = Wait(self.marionette).until(expected.element_present(*self._password_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.send_keys(password)