1

I am using a simple code for date picker for my Calabash-iOS automation. Whenever I set the today's or some past date to select, it is failed. I hope someone would have the idea about it. Here is my code and error messages:

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 Then I set Reminder Date "05/08/2014" Time "5:24"

If the set date is todays date or a past date, this fails and if it is some future date, it passes. If some friends knows its solution, please suggest.

  • Could you share the error message you get? – Lasse Aug 22 '14 at 07:06
  • Try this out There are some helpful links too.. http://stackoverflow.com/questions/21157580/calabash-select-a-date-from-a-uidatepickerview – Chathura Palihakkara Aug 22 '14 at 12:31
  • Error Message: could not change date on picker to '2014-08-20T23:26:00+00:00' using query 'datePicker' with options '{:animate=>true, :picker_id=>nil, :notify_targets=>true}' (RuntimeError) ./features/step_definitions/my_first_steps.rb:223:in `SetReminder' – Engr. aspSial Aug 26 '14 at 14:01

1 Answers1

0

Check the minimum date of your UIDatePicker.

http://calabashapi.xamarin.com/ios/Calabash/Cucumber/DatePicker.html#picker_set_date_time-instance_method

You mention that 'it fails'. Can you describe how it fails?

If the minimum date turns out to be the problem and a Runtime error is not raised, please file a bug.

(RuntimeError) — if the target date is less than the picker's minimum date

jmoody
  • 2,480
  • 1
  • 16
  • 22