EarlGrey icon indicating copy to clipboard operation
EarlGrey copied to clipboard

Add precise swipe actions for swipes from a start to an end point

Open steviki opened this issue 7 years ago • 14 comments

This PR implements and fixes https://github.com/google/EarlGrey/issues/674.

Introduces new swipe actions, that take a starPoint and an endPoint and perform a swipe along those points via two new public functions:

grey_swipeFastFromStartToEndPoint(CGPoint startPoint, CGPoint endPoint); grey_swipeSlowFromStartToEndPoint(CGPoint startPoint, CGPoint endPoint);


This is done via the new GREYPreciseSwipeAction class, that is implemented similar to GREYSwipeAction, but instead of taking a direction, duration and startPercents, the precise swipe action takes a startPoint, endPoint and duration.

When performing this action, a swipe with a single touch is executed that follows the path from the startPoint to the endPoint in the time of the given duration.

steviki avatar Jan 23 '18 12:01 steviki

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address on your commit. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot. The email used to register you as an authorized contributor must be the email used for the Git commit.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

googlebot avatar Jan 23 '18 12:01 googlebot

I signed it!

steviki avatar Jan 23 '18 13:01 steviki

CLAs look good, thanks!

googlebot avatar Jan 23 '18 13:01 googlebot

Just wanted to check in on the status here. I'd love to get this PR merged, so let me know if there is anything left for me to take care of. Thank you!

steviki avatar Apr 27 '18 06:04 steviki

It looks like you want precision here. Is there a reason for not using scroll API which is much more precise than swipe?

khandpur avatar May 01 '18 23:05 khandpur

Is there a reason for not using scroll API which is much more precise than swipe?

@khandpur I'm not quite sure if I understand your question correctly, so please correct me if I'm wrong. If you are referring to GREYScrollAction, then the reason is that it doesn't allow scrolling from one point to another in any arbitrary directions, but only in predefined GREYDirections.

steviki avatar May 04 '18 07:05 steviki

@khandpur Sorry for the long delay, but I've now added unit and functional tests for the precise swipe actions. Looking forward to your feedback!

steviki avatar Aug 16 '18 20:08 steviki

@khandpur Just wanted to ping to check on the status of this PR. I would really appreciated if you could have another look at this PR and consider merging it. Let me know if there are any questions!

steviki avatar Nov 14 '18 09:11 steviki

Thanks for the review @khandpur. I addressed all your feedback, and fixed the code style nits, adjusted the wrong indentations, added nullability macros to GREYPreciseSwipeAction.h, and also rebased this branch to the latest master.

steviki avatar Nov 15 '18 10:11 steviki

@tirodkar PTAL and merge if it looks good.

khandpur avatar Nov 16 '18 02:11 khandpur

And thank you Stefan for adding this feature request!

khandpur avatar Nov 16 '18 02:11 khandpur

Thank you for reviewing this PR and getting it merged! I really appreciate it.

@tirodkar I also addressed your review feedback now and fixed the typo.

steviki avatar Nov 16 '18 07:11 steviki

@tirodkar I've restarted the CI. Could we merge this and make it available in earlgrey 2?

khandpur avatar Jan 25 '19 00:01 khandpur

Hi! Are there any blockers left for merging this?

steipete avatar Jul 19 '19 10:07 steipete