I'm using one of the user contributed step definitions for the date picker (https://gist.github.com/e952bf49099279e3c212). Running into a problem where when it scrolls up or down, it'll quickly jump back to its original selection.
This happens through the console also. With the date picker open on the simulator, I enter on the console: scroll("scrollView index:0","up"). I'll get the same behavior where it scrolls up, then jumps back to it's original selection.
Is there a workaround for this to set the date without scrolling? I know it sees the date correctly:
irb(main):039:0> query("datePicker","date")
=> ["2012-10-11 02:00:00 +0000"]
Would like to pass a statement that'll just update that date/time.
Thanks
This happens through the console also. With the date picker open on the simulator, I enter on the console: scroll("scrollView index:0","up"). I'll get the same behavior where it scrolls up, then jumps back to it's original selection.
Is there a workaround for this to set the date without scrolling? I know it sees the date correctly:
irb(main):039:0> query("datePicker","date")
=> ["2012-10-11 02:00:00 +0000"]
I'm using one of the user contributed step definitions for the date picker (https://gist.github.com/e952bf49099279e3c212). Running into a problem where when it scrolls up or down, it'll quickly jump back to its original selection.
This happens through the console also. With the date picker open on the simulator, I enter on the console: scroll("scrollView index:0","up"). I'll get the same behavior where it scrolls up, then jumps back to it's original selection.
Is there a workaround for this to set the date without scrolling? I know it sees the date correctly:
irb(main):039:0> query("datePicker","date")
=> ["2012-10-11 02:00:00 +0000"]
Would like to pass a statement that'll just update that date/time.
1. AUTOMATIC <== setting the date directly using a UIDatePicker category method2. MANUAL <== setting the date by manipulating the picker wheelsbe sure to read the long (sorry - it is really long) comment at the beginning of the date_picker_steps.rb and be aware that the gist contains 2 files.
Hmm, is all of that code really necessary? How about:
def select_date(date_string)
date = Date.parse(date_string)
# Go in order of year, month, day so that the expected day range is available
query("view:'_UIDatePickerView'", [{:selectRow => date.year - 1}, {:inComponent => 2}, {:animated => 0}])
query("view:'_UIDatePickerView'", [{:selectRow => date.month - 1}, {:inComponent => 0}, {:animated => 0}])
query("view:'_UIDatePickerView'", [{:selectRow => date.day - 1}, {:inComponent => 1}, {:animated => 0}])
end
Granted, this doesn't support time mode, but these few lines are all I've needed for my UIDatePicker steps so far.
Then(/^I set Reminder Date "(.*?)" Time "(.*?)"$/) do |date10, time10|
target_time = Time.parse(time10)
target_date = Date.parse(date10)
current_time = date_time_from_picker()
current_date = date_time_from_picker()
date_time = DateTime.new(target_date.year,
target_date.mon,
target_date.day,
target_time.hour,
target_time.min,
0,
target_time.gmt_offset)
picker_set_date_time date_time
sleep(3)
end