Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add duration and point (optional) parameters for longPress() action. #4475

Merged
merged 36 commits into from
May 12, 2024

Conversation

asafkorem
Copy link
Contributor

This pull request introduces optional parameters for the longPress() action on both iOS and Android:

  • duration: number: Specifies the duration of the long press (in ms). This parameter was previously supported on iOS but has now been extended to Android.
  • point: {x: number, y: number}: Defines the position of the long press within the element's coordinate space.

Documentation has been updated accordingly, and relevant end-to-end tests have been added.

detox/detox.d.ts Outdated Show resolved Hide resolved
detox/detox.d.ts Outdated Show resolved Hide resolved
docs/api/actions.md Outdated Show resolved Hide resolved
@asafkorem asafkorem marked this pull request as draft April 29, 2024 09:36
detox/detox.d.ts Outdated Show resolved Hide resolved
@asafkorem asafkorem linked an issue Apr 30, 2024 that may be closed by this pull request
Copy link
Collaborator

@noomorph noomorph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏 Looks very promising, but I see a couple of things that should be addressed early. Please see my comments.

detox/detox.d.ts Outdated Show resolved Hide resolved
detox/src/android/core/NativeElement.js Outdated Show resolved Hide resolved
detox/src/android/core/NativeElement.js Outdated Show resolved Hide resolved
detox/src/android/core/NativeElement.js Outdated Show resolved Hide resolved
detox/src/android/espressoapi/DetoxAction.js Show resolved Hide resolved
detox/src/ios/expectTwo.js Show resolved Hide resolved
detox/src/android/actions/native.js Outdated Show resolved Hide resolved
docs/api/actions.md Outdated Show resolved Hide resolved
)
}
);
return t.functionDeclaration(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the overload generation is a brilliant mechanism and this is worth its own pull request, can we stop for a a second and discuss if a DTO argument could be a better idea, still?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to align with the current longPress(duration) API we have (iOS-only)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can, possibly, enable both DTO and duration only but it feels a bit dirty.
also, it makes sense to align with tap({x: number, y: number}) for the point param.

Copy link
Collaborator

@d4vidi d4vidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commenting my 2 cent notes

@asafkorem asafkorem linked an issue May 8, 2024 that may be closed by this pull request
@asafkorem asafkorem marked this pull request as ready for review May 8, 2024 12:39
@asafkorem asafkorem merged commit 620ca86 into master May 12, 2024
7 checks passed
@asafkorem asafkorem deleted the feat/long-press-point branch May 12, 2024 13:22
@asafkorem
Copy link
Contributor Author

Released with Detox 20.21.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add point (optional) parameter for longPress action Introduce longpress(duration) for android
3 participants