ios - UIDatePicker Automation using KIF dateChangedAction not called -


i'm automating date selection on uidatepicker using kif. added accessibility label , set target picker if date changes.

ref: http://bit.ly/140icwo

+(id) changedate: (nsdate *) mydate {    [s addstep:[kifteststep steptoenterdate:mydate   todatepickerwithaccessibilitylabel:@"datepicker"]];   [self wait:s timeinseconds:3];   [s addstep:[kifteststep steptotapviewwithaccessibilitylabel:@"done" traits:uiaccessibilitytraitbutton]];  return s; }  - (void) viewdidload {        ...      datepicker.maximumdate = lastavailabledate;     datepicker.date = (datevalue ? datevalue : [nsdate date]);     [datepicker addtarget:self action:@selector(datechangedaction:)      forcontrolevents:uicontroleventvaluechanged];     self.datepicker.accessibilitylabel = @"datepicker";     self.footerlabel.accessibilitylabel = @"datelabel"; }   - (ibaction)datechangedaction:(id)sender {   [datevalue release];   datevalue = [datepicker.date retain];   datecell.detailtextlabel.text = [[[self class] sharedformatter]  stringfromdate:datevalue];   [self setdatetitletext:[[[self class] sharedformatter] stringfromdate:datevalue]]; } 

the picker rotates , stops @ given date "datechangedaction" function not getting called, hence label displays selected date not getting updated.

if run app out kif works fine. tried manually select date when running kif check it updates label seems ui gets frozen , cannot click ui controls.

looks problem related posting

http://bit.ly/10xtbqu

any appreciated.

thanks

i run same problem you're missing

[picker sendactionsforcontrolevents:uicontroleventvaluechanged]; 

to trigger datechangedaction callback, in other words try this:

+ (id)steptoenterdate:(nsdate*)date todatepickerwithaccessibilitylabel:(nsstring*)label {     nsstring *description=[nsstring stringwithformat:@"enter date date picker accessibility label '%@'",[date description]];     return [self stepwithdescription:description executionblock:^(kifteststep *step, nserror **error)             {                 uiaccessibilityelement *element = [[uiapplication sharedapplication] accessibilityelementwithlabel:label];                 kiftestcondition(element, error, @"view label %@ not found", label);                 if(!element)                 {                     return kifteststepresultwait;                 }                 uidatepicker *picker = (uidatepicker*)[uiaccessibilityelement viewcontainingaccessibilityelement:element];                  kiftestcondition([picker iskindofclass:[uidatepicker class]], error, @"specified view not picker");                  [picker setdate:date animated:yes];                  // trigger uicontroleventvaluechanged in case of event listener                 [picker sendactionsforcontrolevents:uicontroleventvaluechanged];                  return kifteststepresultsuccess;                      }]; } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -