Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS UI testing - picker wheel adjusting only swipes by one item

I am trying to write a test for UIPickerView to pick certain values. I use picker.adjust(toPickerWheelValue: pickValue) to do so. But the problem is that for some reason this only swipes picker by one value.

For example on the gif you can see that initial value was 52, then I called picker.adjust(toPickerWheelValue: "15") and it became 51 instead of 15, then I called it again and it became 50:

wrong picker behaviour

So the pattern is that it only changes it by one value up or down closer to the desired value.

What is the problem here?

like image 576
Simon Moshenko Avatar asked Dec 05 '25 05:12

Simon Moshenko


1 Answers

Referencing with initial value works for me. So my code looks like this:

app.pickerWheels["52"].adjust(toPickerWheelValue: "15")
like image 133
Sathish Kumar Avatar answered Dec 07 '25 21:12

Sathish Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!