angularjs - Angular UI datepicker popup with type-in returns one date earlier than typed in protractor -
this bit complicated, i've verified both angular scenario tester , protractor, , in user interface.
- set twitter bootstrap 3.x (i'm using latest had 3.0.3 before) - bower boostrap install
- set angular ui built-in templates (i'm using angular-ui-bootstrap-bower library bower)
set datepicker-popup field in angular-ui this:
<label for='due_date'>due date</label> <input id='due_date' class='form-control' type='text' datepicker-options="dateoptions" datepicker-popup='yyyy-mm-dd' ng-model="task.duedate">
add button , controller method inspect variable.
testing:
- click on date field, , type in date: 2013-01-05
- hit escape or click on field close popup dialog (i.e. don't click done)
- submit form
you'll find date 1 day behind.
interestingly, if click on actual date in date picker, correct. including 'today'. if remove ui datepicker, works fine persisting typed-in data. date format yyyy-mm-dd when type in.
this maddening, i've thought bug in angular scenario, once figured out protractor fails, , reproduce canceling dialog, , typing , submitting, beginning think has localization , timezones.
anyone else run this?
here protractor test fails:
it('should return 1 task', function () { thepage.cleartasksbutton.click(); thepage.newtaskbutton.click(); thepage.taskdescription.clear(); thepage.taskdescription.sendkeys('a new task'); thepage.taskpriority.clear(); thepage.taskpriority.sendkeys('1'); thepage.duedate.clear(); // pick today , dismiss angular datepicker thepage.todaybutton.click(); thepage.createtaskbutton.click(); var task = element.all(by.repeater('task in tasks').row(0).column('duedate')); task.then(function(elems) { // should result in 1 row expect(elems.length).toequal(1); // works expect(elems[0].gettext()).toequal('2014-03-19'); // 2014-03-18 }); ...
thanks
ken
Comments
Post a Comment