コード例 #1
0
ファイル: app.py プロジェクト: uniony/gaia
    def send(self, string):
        self.switch_to_keyboard()
        for val in string:
            if ord(val) > 127:
                # this would get the right key to long press and switch to the right keyboard
                middle_key_val = self._find_key_for_longpress(
                    val.encode('UTF-8'))
                self._switch_to_correct_layout(middle_key_val)

                # find the key to long press and press it to get the extended characters list
                middle_key = self.marionette.find_element(
                    *self._key_locator(middle_key_val))
                action = Actions(self.marionette)
                action.press(middle_key).wait(1).perform()

                # find the targeted extended key to send
                key = Wait(self.marionette).until(
                    expected.element_present(*self._key_locator(val)))
                Wait(self.marionette).until(expected.element_displayed(key))
                action.move(key).release().perform()
            else:
                # after switching to correct keyboard, tap/click if the key is there
                self._switch_to_correct_layout(val)
                self._tap(val)

                # when we tap on '@' the layout switches to the default keyboard - Bug 996332
                if val == '@':
                    Wait(self.marionette).until(
                        lambda m: self._layout_page == 0)

        self.apps.switch_to_displayed_app()
コード例 #2
0
ファイル: app.py プロジェクト: nullaus/gaia
    def send(self, string):
        self.switch_to_keyboard()
        for val in string:
            if ord(val) > 127:
                # this would get the right key to long press and switch to the right keyboard
                middle_key_val = self._find_key_for_longpress(val.encode("UTF-8"))
                self._switch_to_correct_layout(middle_key_val)

                # find the key to long press and press it to get the extended characters list
                middle_key = self.marionette.find_element(*self._key_locator(middle_key_val))
                action = Actions(self.marionette)
                action.press(middle_key).wait(1).perform()

                # find the targeted extended key to send
                key = Wait(self.marionette).until(expected.element_present(*self._key_locator(val)))
                Wait(self.marionette).until(expected.element_displayed(key))
                action.move(key).release().perform()
            else:
                # after switching to correct keyboard, tap/click if the key is there
                self._switch_to_correct_layout(val)
                self._tap(val)

                # when we tap on '@' the layout switches to the default keyboard - Bug 996332
                if val == "@":
                    Wait(self.marionette).until(lambda m: self._layout_page == 0)

        self.apps.switch_to_displayed_app()
コード例 #3
0
def chain(marionette, wait_for_condition, expected1, expected2):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    marionette.timeout.implicit = 15
    action = Actions(marionette)
    button1 = marionette.find_element(By.ID, "button1")
    action.press(button1).perform()
    button2 = marionette.find_element(By.ID, "delayed")
    wait_for_condition_else_raise(marionette, wait_for_condition, expected1, "return document.getElementById('button1').innerHTML;")
    action.move(button2).release().perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected2, "return document.getElementById('delayed').innerHTML;")
コード例 #4
0
    def _flick_menu_down(self, locator):
        self.parent.parent.wait_for_element_displayed(*self._current_element(*locator), timeout=2)
        current_element = self.marionette.find_element(*self._current_element(*locator))
        next_element = self.marionette.find_element(*self._next_element(*locator))

        # TODO: update this with more accurate Actions
        action = Actions(self.marionette)
        action.press(current_element)
        action.move(next_element)
        action.release()
        action.perform()
コード例 #5
0
ファイル: app.py プロジェクト: nullaus/gaia
    def switch_keyboard_language(self, lang_code):
        # TODO At the moment this doesn't work because the UI has changed
        # An attempted repair ran into https://bugzilla.mozilla.org/show_bug.cgi?id=779284 (Modal dialog)

        keyboard_language_locator = (By.CSS_SELECTOR, ".keyboard-row button[data-keyboard='%s']" % lang_code)

        self.switch_to_keyboard()
        language_key = self.marionette.find_element(*self._language_key_locator)
        action = Actions(self.marionette)
        action.press(language_key).wait(1).perform()
        target_kb_layout = self.marionette.find_element(*keyboard_language_locator)
        action.move(target_kb_layout).release().perform()
        self.apps.switch_to_displayed_app()
コード例 #6
0
def chain(marionette, wait_for_condition, expected1, expected2):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    marionette.timeout.implicit = 15
    action = Actions(marionette)
    button1 = marionette.find_element(By.ID, "button1")
    action.press(button1).perform()
    button2 = marionette.find_element(By.ID, "delayed")
    wait_for_condition_else_raise(
        marionette, wait_for_condition, expected1,
        "return document.getElementById('button1').innerHTML;")
    action.move(button2).release().perform()
    wait_for_condition_else_raise(
        marionette, wait_for_condition, expected2,
        "return document.getElementById('delayed').innerHTML;")
コード例 #7
0
ファイル: app.py プロジェクト: uniony/gaia
    def switch_keyboard_language(self, lang_code):
        # TODO At the moment this doesn't work because the UI has changed
        # An attempted repair ran into https://bugzilla.mozilla.org/show_bug.cgi?id=779284 (Modal dialog)

        keyboard_language_locator = (
            By.CSS_SELECTOR,
            ".keyboard-row button[data-keyboard='%s']" % lang_code)

        self.switch_to_keyboard()
        language_key = self.marionette.find_element(
            *self._language_key_locator)
        action = Actions(self.marionette)
        action.press(language_key).wait(1).perform()
        target_kb_layout = self.marionette.find_element(
            *keyboard_language_locator)
        action.move(target_kb_layout).release().perform()
        self.apps.switch_to_displayed_app()
コード例 #8
0
ファイル: app.py プロジェクト: nullaus/gaia
    def choose_extended_character(self, long_press_key, selection, movement=True):
        self.switch_to_keyboard()
        action = Actions(self.marionette)

        # after switching to correct keyboard, set long press if the key is there
        self._switch_to_correct_layout(long_press_key)
        key = Wait(self.marionette).until(expected.element_present(*self._key_locator(long_press_key)))
        Wait(self.marionette).until(expected.element_displayed(key))
        action.press(key).wait(1).perform()

        # find the extended key and perform the action chain
        extend_keys = self.marionette.find_elements(*self._highlight_key_locator)
        if movement is True:
            action.move(extend_keys[selection - 1]).perform()
        action.release().perform()

        self.apps.switch_to_displayed_app()
コード例 #9
0
ファイル: app.py プロジェクト: uniony/gaia
    def choose_extended_character(self,
                                  long_press_key,
                                  selection,
                                  movement=True):
        self.switch_to_keyboard()
        action = Actions(self.marionette)

        # after switching to correct keyboard, set long press if the key is there
        self._switch_to_correct_layout(long_press_key)
        key = Wait(self.marionette).until(
            expected.element_present(*self._key_locator(long_press_key)))
        Wait(self.marionette).until(expected.element_displayed(key))
        action.press(key).wait(1).perform()

        # find the extended key and perform the action chain
        extend_keys = self.marionette.find_elements(
            *self._highlight_key_locator)
        if movement is True:
            action.move(extend_keys[selection - 1]).perform()
        action.release().perform()

        self.apps.switch_to_displayed_app()