Detox: UIPickerView does not contain desired value

Created on 23 Nov 2018  路  19Comments  路  Source: wix/Detox

Sorry guys, but all about iOS Picker was closed without any conclusion. I have exactly the same issue as https://github.com/wix/Detox/issues/798. Also, the question on stackoverflow has no answer https://stackoverflow.com/questions/50082463/testing-picker-with-detox-in-react-native

so

if I use "testID":
await element(by.id('testIdPicker')).setColumnToValue(0, 'en');
I get
"Description" : "Interaction cannot continue because the desired element was not found."
If I use "type":
await element(by.type('UIPickerView')).setColumnToValue(0, 'en');
I get
"Description" : "UIPickerView does not contain desired value!"

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 9.0.4
  • React Native: 0.57.4
  • Node: 11.1.0
  • Device:*
  • Xcode: 10.0
  • macOS: 10.13.6

detox

acceptebug ios 馃搶 pinned

Most helpful comment

I'll be providing a fix soon. As a bonus, I will also simplify setting picker values in RN date pickers (allow selecting by id, not just by class).

All 19 comments

Can you please create a demo project that reproduces this?

Sorry I can not share our project with you, but I created an example based on https://github.com/wix/Detox/issues/798. There are the same issues as I reported.
You can find it here: https://github.com/petrmrakava/Detox/tree/petrmrakava/iosPicker

Great, thank you!

Hi @LeoNatan, any progress in this? i'm facing the same issue.

Sorry, I am busy with other projects at the moment.

It seems like an RN bug.

thanks @LeoNatan i'll be waiting for the next version with that fix.

@fedeerbes Can you please test to see if the issue still reproduces with modern version of RN? Thanks

Hi, first of all thanks for the great work.

It seems that the issue still reproduces also with RN 0.59.9

await element(by.type("UIPickerView")).setColumnToValue(0, "value");

results in

"Description" : "UIPickerView does not contain desired value!"

I can see that you are using DatePickerIOS Component for the test, but I got the issue with Picker or PickerIOS Components.

DatePickerIOS is mapped to a UIDatePicker, which is a wrapper around UIPickerView. The same API should work with both.

Thanks for your reply, I see your point.

I tried to add into my project the same test as the one that @noomorph quoted and the same DatePickerIOS component and everything worked as expected.
So this let me wonder if there are any subtle differences between those two Picker and DatePickerIOS implementations.

Hmm, I think I see the problem. Earl Grey expect the picker view to implement a data source, but the clowns in RN just implement the methods and rely on undocumented behavior of iOS. Investigating.

I'll be providing a fix soon. As a bonus, I will also simplify setting picker values in RN date pickers (allow selecting by id, not just by class).

Hi @LeoNatan, thanks for the work you did it here. Reading the above, I'll try with the new version and let you know how it goes.

Thanks!

I tested the new implementation and it seems to be working properly now.
Thanks @LeoNatan 馃 馃憤

Was this page helpful?
0 / 5 - 0 ratings