-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
Add testID support to android datepicker #705
Add testID support to android datepicker #705
Conversation
src/datepicker.android.js
Outdated
@@ -22,6 +22,7 @@ export default class DatePickerAndroid { | |||
* - `value` (`Date` object) - date to show by default | |||
* - `minimumDate` (`Date` object) - minimum date that can be selected | |||
* - `maximumDate` (`Date` object) - maximum date that can be selected | |||
* - `testID` (`string`) - testID for usage with e.g. detox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@noomorph I just rephrased it. What do you think about it now?
README.md
Outdated
#### `View Props` (`optional`, `iOS only`) | ||
|
||
On iOS, you can pass any [View props](https://reactnative.dev/docs/view#props) to the component. Given that the underlying component is a native view, not all of them are guaranteed to be supported, but `testID` and `onLayout` are known to work. | ||
On iOS, you can pass any [View props](https://reactnative.dev/docs/view#props) to the component. Given that the underlying component is a native view, not all of them are guaranteed to be supported, but `onLayout` is known to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it doesn't look like testID
stops working after your PR, so why did you have to rephrase here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it from this section to give it its own, right above. This section talks about ios specific props and with this PR testID will work on both android and ios. I thought that was easier to convey by moving testID into its own section.
Feel free to suggest an improvement though.
@mauricedoepke did you run it, did that work? |
@noomorph Yes I ran the android tests locally and they worked for me. I was not able to run the ios tests though. Neither on my branch nor on master. The demo app stayed white for me on the ios simulator. I guess the circle ci tests have to be aproved to run in this repo? Because the error seems to be auth related. |
@mauricedoepke would you mind rebasing this on top of master? The repo now uses the latest version of detox, so the tests should now pass. Thank you! :) |
999e41e
to
423b0c5
Compare
@mauricedoepke thank you for your PR! For some reason GH is showing my icon on the commits as I have rebased them, but you're still the author 🙂 |
@vonovak Thats no problem for me. Thank you for taking the time to merge it. |
# [7.4.0](v7.3.0...v7.4.0) (2023-07-06) ### Features * **android:** add testID support to date (not time) picker ([#705](#705)) ([e571d71](e571d71))
🎉 This issue has been resolved in version 7.4.0 🎉 If this package helps you, consider sponsoring us! 🚀 |
Summary
Makes testID prop work on Android as well.
This makes testing DatePickers with detox easier. Till now this was irrelevant, as detox did not support setting dates on datepickers on Android.
I am currently working on a PR enabling this very functionality though: wix/Detox#3790
Together with that PR it would be very useful having testID support for DatePickers on Android.
Test Plan
The existing tests are sufficient. I only changed the matchers to not use the android className anymore, but the testID instead. This implicitely tests that the testID is working.
Compatibility
Checklist
a device anda simulatorREADME.md
I added a sample use of the API in the example project (Already covered by existing example app.example/App.js
)