You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hélio, we are reviewing this PR. We have some initial discussion noting we want to look at gestures and thus paths as part of a whole language of "gestures".
For those following along here, this was a recent comment I made that tries to outline some of my thinking in this area.
For gestures and paths, in particular, I have been thinking about how different applications, specifications, languages describe paths. For example in svg there are paths. How do they describe them.
And in addition to markers along path what else do we need to describe movement. Timing is one. How quickly do we move along a path. There might be other attributes we need to attach to a path (randomness, curves like Bézier). And what is one wants to describe not the time it takes to cover a path but what is they want a “resolution”. Then there is what if we want a path that is made up of other paths. How is this described.
Some paths are closed in that they go back to the starting point. Talking about points we have discussed different coordinate systems or words/syntax for describe a “point“ on the screen. For example go to this point, direction and distance, location of this element (it’s center, a corner of it - thinking of a closure point.
Then the higher level of gesturers. How do you create a two or three finger path. Given all these how you you easir write, create, debug these in the natural language of Robot Framework ..
As you can see the complexity of this I would like to get to a unified and complete language of gestures and paths that tie neatly together.
I had a quick look at the implementation and tried to fix it. This solution draws something:
def swipe_path(self, duration: int = 100, *path):
"""
Presses down at start of path and releases at end of path with delay duration.
Args:
- duration: in milliseconds, defines the swipe speed as time taken to swipe between each point of path list.
- path: name of a variable of type list, containing the coordinates sequence. List starts at X0, Y0
and ends at Xn, Yn.
Examples:
| @path = | Create List | 100 | 100 | 300 | 100 | 150 | 300 | 100 | 100 !
| Swipe Path | @{path} |
| Swipe Path | duration=200 | ${path} |
"""
actions = ActionChains(self._current_application())
actions.w3c_actions = ActionBuilder(self._current_application(), mouse=touch_input)
actions.w3c_actions.pointer_action.move_to_location(path[0], path[1])
actions.w3c_actions.pointer_action.pointer_down()
for i in range(2, psz, 2):
actions.w3c_actions.pointer_action.move_to_location(path[i], path[i + 1])
actions.pause(duration)
actions.w3c_actions.pointer_action.pointer_up()
actions.perform()
else:
AssertionError(f"Parameter 'path' is mandatory and must be a list of coordinates, "
f"meaning its size must be an even number. You provided a 'path' with length = {psz}.")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
Draws a path defined by a list of points, with a delay by default of 100ms between each segment.
User presses at starting point and releases at end point.
This keyword was working in Appium 1, but now, after adaptation to Appium 2, it does not draw.