コード例 #1
0
ファイル: fullscreen_video.py プロジェクト: kuoe0/gaia-dev
 def move_seek_slider(self, offset):
     scale = self.marionette.find_element(*self._video_seek_head_locator)
     finger = Actions(self.marionette)
     finger.press(scale)
     finger.move_by_offset(offset, 0)
     finger.release()
     finger.perform()
コード例 #2
0
ファイル: gaia_graphics_test.py プロジェクト: Anirudh0/gaia
    def edge_scroll(self, frame, direction, dist, release=True):
        """edge scroll - performs task switching action.

        direction = 'LtoR' or 'RtoL' (finger movement direction)
        dist = percentage of horizontal distance travel, max is 1.0
        release = if set to False, the Action object will be returned so the user can complete the release action"""

        start_x = 0
        dist_travelled = 0
        time_increment = 0.01

        if dist > 1:
            dist = 1
        if direction == 'LtoR':
            start_x = 0
        elif direction == 'RtoL':
            start_x = frame.size['width']
            dist *= -1  # travel opposite direction

        limit = dist * frame.size['width']
        dist_unit = limit * time_increment

        action = Actions(self.marionette)
        action.press(frame, start_x, frame.size['height'] / 2)  # press either the left or right edge

        while abs(dist_travelled) < abs(limit):
            action.move_by_offset(dist_unit, 0)
            action.wait(time_increment)
            dist_travelled += dist_unit
        if release:
            action.release()
        action.perform()

        return action
コード例 #3
0
ファイル: fullscreen_video.py プロジェクト: adrm/gaia
 def move_seek_slider(self, offset):
     scale = self.marionette.find_element(*self._video_seek_head_locator)
     finger = Actions(self.marionette)
     finger.press(scale)
     finger.move_by_offset(offset, 0)
     finger.release()
     finger.perform()
コード例 #4
0
    def edge_scroll(self, frame, direction, dist, release=True):
        """edge scroll - performs task switching action.

        direction = 'LtoR' or 'RtoL' (finger movement direction)
        dist = percentage of horizontal distance travel, max is 1.0
        release = if set to False, the Action object will be returned so the user can complete the release action"""

        start_x = 0
        dist_travelled = 0
        time_increment = 0.01

        if dist > 1:
            dist = 1
        if direction == 'LtoR':
            start_x = 0
        elif direction == 'RtoL':
            start_x = frame.size['width']
            dist *= -1  # travel opposite direction

        limit = dist * frame.size['width']
        dist_unit = limit * time_increment

        action = Actions(self.marionette)
        action.press(frame, start_x, frame.size['height'] /
                     2)  # press either the left or right edge

        while abs(dist_travelled) < abs(limit):
            action.move_by_offset(dist_unit, 0)
            action.wait(time_increment)
            dist_travelled += dist_unit
        if release:
            action.release()
        action.perform()

        return action
コード例 #5
0
 def move_slider(self, slider, dir_x):
     scale = self.marionette.find_element(*slider)
     finger = Actions(self.marionette)
     finger.press(scale)
     finger.move_by_offset(dir_x, 0)
     finger.release()
     finger.perform()
     time.sleep(2)
コード例 #6
0
 def move_slider(self, slider, dir_x):
     scale = self.marionette.find_element(*slider)
     finger = Actions(self.marionette)
     finger.press(scale)
     finger.move_by_offset(dir_x, 0)
     finger.release()
     finger.perform()
     time.sleep(2)
コード例 #7
0
def context_menu(marionette, wait_for_condition, expected1, expected2):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    button = marionette.find_element(By.ID, "button1")
    action = Actions(marionette)
    action.press(button).wait(5).perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected1, "return document.getElementById('button1').innerHTML;")
    action.release().perform()
    wait_for_condition_else_raise(marionette, wait_for_condition, expected2, "return document.getElementById('button1').innerHTML;")
コード例 #8
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()
コード例 #9
0
def context_menu(marionette, wait_for_condition, expected1, expected2):
    testAction = marionette.absolute_url("testAction.html")
    marionette.navigate(testAction)
    button = marionette.find_element(By.ID, "button1")
    action = Actions(marionette)
    action.press(button).wait(5).perform()
    wait_for_condition_else_raise(
        marionette, wait_for_condition, expected1,
        "return document.getElementById('button1').innerHTML;")
    action.release().perform()
    wait_for_condition_else_raise(
        marionette, wait_for_condition, expected2,
        "return document.getElementById('button1').innerHTML;")
コード例 #10
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()
コード例 #11
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()
コード例 #12
0
 def test_no_press(self):
     testAction = self.marionette.absolute_url("testAction.html")
     self.marionette.navigate(testAction)
     action = Actions(self.marionette)
     action.release()
     self.assertRaises(MarionetteException, action.perform)