Open PhoenixLeeSin opened 4 years ago
This is expected behavior:
If you manually launch the "Test Host" app and open the Picker page, you can scroll up in the "month & day" component of the Date/Time picker back to 2019, 2018, etc... The default for selectDatePickerValue:
implies withSearchOrder:KIFPickerSearchForwardFromStart
. This means that it will choose the first matching value that the DatePicker contains in its set of elements (were you to scroll back far enough). This is the reason that KIFPickerSearchForwardFromCurrentValue
and KIFPickerSearchBackwardFromCurrentValue
are useful, though require some knowledge of the state of the UI (which is definitely not ideal).
There isn't anything in the UI that distinguishes choosing "Jan 1" of 2020, 2019, or 2007. If the ViewController sets a dateTimePicker.minimumDate = [NSDate dateWithTimeIntervalSinceNow:0];
. I believe this reproduces the error that you encountered in #1142.
There is probably some way to fix this such that it can ensure that the date component being selected is less than maximumDate
and more than minimumDate
. I don't have much time to dig into this issue, but it seems like you're on the right track here.
If you've got ideas of a way to fix this, I'm definitely open to suggestions.
@justinseanmartin Thanks for your suggestions and replies, but the setup time does not meet our business needs, I am thinking of a solution
@justinseanmartin i am not sure it is right or not ,i see u secletor about - (void)selectDatePickerValue:(NSArray *)datePickerColumnValues withSearchOrder:(KIFPickerSearchOrder)searchOrder;
and in my code :
let dateTime_1 = ["Jun 18","12","55","PM"] tester().selectDatePickerValue(dateTime_1) _ = tester().waitForView(withAccessibilityLabel: "XFPickerView.datePicker") as! UIDatePicker viewTester().selectDatePickerValue(dateTime_1, with: KIFPickerSearchOrder.forwardFromCurrentValue)
and all goes well ....
the demo in KIF
and code in viewcontroller
the result shows ' 2007-Jun 17, 06:43 AM '