Unable to select date in month_view in android date picker in detox

Viewed 513

Writing ui automation tests using detox. The following date picker view is being used for android.
enter image description here

I can select the current date by selecting the "OK" button, but I don't seem to be able to select a specific value in the month_view. Research on interacting with android calendar pickers has not born any fruit, so looking for someone to point me in the right direction.

Thanks.

1 Answers

@TopLuddite I can advise on 2 things:

  1. As a first step, try to inspect the layout when the date picker shows (*), using Android Studio's Layout Inspector tool (under the Tools menu). In the captured layout, look up values in methods > getTag() associated with the views you wish to tap on. These are equivalent to what Detox sees as test-IDs, which means that if the value is not null, it is applicable for usage in Detox' by.id(<value>) view-matching API. That's one straightforward way to solve your issue.

  2. As an alternative, consider using Android's UIAutomator (UIDevice) API, available via Detox using the device.getUiDevice() call. In particular, API's such as UiDevice.pressDPadDown can come in handy, or, as a last resort - UiDevice.click(x, y).


(*) Note: you must run the app in Debug mode for that to work.

Related