Bug 1484636 - When testing with a callback, use assert instead of assertJS; fix testTimezones.js. r=philipp DONTBUILD
authorGeoff Lankow <geoff@darktrojan.net>
Mon, 17 Sep 2018 12:35:31 +1200
changeset 33169 47c06b0b47c3147f355054507bcc1001f922b1a8
parent 33168 b027417cfd9fabc5e60db7e57b7d3047a0b99092
child 33170 92d500eaee7f62857e0d063f0506309589d286e3
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersphilipp
bugs1484636
Bug 1484636 - When testing with a callback, use assert instead of assertJS; fix testTimezones.js. r=philipp DONTBUILD
calendar/test/mozmill/eventDialog/testEventDialog.js
calendar/test/mozmill/eventDialog/testUTF8.js
calendar/test/mozmill/shared-modules/test-calendar-utils.js
calendar/test/mozmill/testTimezones.js
mail/test/resources/mozmill/test/dnd/testTabView.js
--- a/calendar/test/mozmill/eventDialog/testEventDialog.js
+++ b/calendar/test/mozmill/eventDialog/testEventDialog.js
@@ -302,14 +302,14 @@ function checkTooltip(monthView, row, co
 
     controller.waitFor(() => {
         let text = dateTime.getNode().textContent;
         dump(`${text}\n`);
         return text.includes(`${startDate} ${startTime} – `);
     });
 
     // This could be on the next day if it is 00:00.
-    controller.assertJS(() => dateTime.getNode().textContent.endsWith(endTime));
+    controller.assert(() => dateTime.getNode().textContent.endsWith(endTime));
 }
 
 function teardownTest(module) {
     deleteCalendars(controller, CALENDARNAME);
 }
--- a/calendar/test/mozmill/eventDialog/testUTF8.js
+++ b/calendar/test/mozmill/eventDialog/testUTF8.js
@@ -67,17 +67,17 @@ function testUTF8() {
     eventBox = lookupEventBox("day", EVENT_BOX, null, 1, 8, eventPath);
     invokeEventDialog(controller, eventBox, (event, iframe) => {
         let { eid: iframeId } = helpersForController(iframe);
 
         // check values
         event.assertValue(iframeId("item-title"), UTF8STRING);
         event.assertValue(iframeId("item-location"), UTF8STRING);
         event.assertValue(iframeId("item-description"), UTF8STRING);
-        event.assertJS(() => iframeId("item-categories").getNode().querySelector(`menuitem[label="${UTF8STRING}"][checked]`));
+        event.assert(() => iframeId("item-categories").getNode().querySelector(`menuitem[label="${UTF8STRING}"][checked]`));
 
         // escape the event window
         event.keypress(null, "VK_ESCAPE", {});
     });
 }
 
 function teardownTest(module) {
     deleteCalendars(controller, UTF8STRING);
--- a/calendar/test/mozmill/shared-modules/test-calendar-utils.js
+++ b/calendar/test/mozmill/shared-modules/test-calendar-utils.js
@@ -709,34 +709,37 @@ function setData(dialog, iframe, data) {
         }
         dialog.keypress(startDateInput, "a", { accelKey: true });
         dialog.type(startDateInput, startdate);
     }
 
     // starttime
     if (data.starttime != undefined && data.starttime.constructor.name == "Date") {
         let starttime = dateFormatter.formatTime(cal.dtz.jsDateToDateTime(data.starttime, cal.dtz.floating));
-        startTimeInput.getNode().value = starttime;
-        sleep();
+        dialog.click(startTimeInput);
+        dialog.keypress(startTimeInput, "a", { accelKey: true });
+        dialog.type(startTimeInput, starttime);
     }
 
     // enddate
     if (data.enddate != undefined && data.enddate.constructor.name == "Date") {
         let enddate = dateFormatter.formatDateShort(cal.dtz.jsDateToDateTime(data.enddate, cal.dtz.floating));
         if (!isEvent) {
             dialog.check(iframeId("todo-has-duedate"), true);
         }
         dialog.keypress(endDateInput, "a", { accelKey: true });
         dialog.type(endDateInput, enddate);
     }
 
     // endtime
     if (data.endtime != undefined && data.endtime.constructor.name == "Date") {
         let endtime = dateFormatter.formatTime(cal.dtz.jsDateToDateTime(data.endtime, cal.dtz.floating));
-        endTimeInput.getNode().value = endtime;
+        dialog.click(endTimeInput);
+        dialog.keypress(endTimeInput, "a", { accelKey: true });
+        dialog.type(endTimeInput, endtime);
     }
 
     // recurrence
     if (data.repeat != undefined) {
         menulistSelect(iframeId("item-repeat"), data.repeat, dialog);
     }
 
     // reminder
--- a/calendar/test/mozmill/testTimezones.js
+++ b/calendar/test/mozmill/testTimezones.js
@@ -47,20 +47,20 @@ function testTimezones1_SetGMT() {
 }
 
 function testTimezones2_CreateEvents() {
     controller.click(eid("calendar-tab-button"));
     switchToView(controller, "day");
     goToDate(controller, 2009, 1, 1);
 
     // create weekly recurring events in all TIMEZONES
-    let times = [[4, 30], [4, 30], [3, 0], [3, 0], [9, 0], [14, 0], [19, 45], [1, 30]];
+    let times = [[4, 30], [5, 0], [3, 0], [3, 0], [9, 0], [14, 0], [19, 45], [1, 30]];
     let time = new Date();
     for (let i = 0; i < TIMEZONES.length; i++) {
-        let eventBox = lookupEventBox("day", CANVAS_BOX, null, 1, i + 8);
+        let eventBox = lookupEventBox("day", CANVAS_BOX, null, 1, i + 11);
         invokeEventDialog(controller, eventBox, (event, iframe) => {
             time.setHours(times[i][0]);
             time.setMinutes(times[i][1]);
 
             // set timezone
             setTimezone(event, TIMEZONES[i]);
 
             // set title and repeat
@@ -328,12 +328,12 @@ function verify(controller, dates, timez
             if (day != undefined && day == 1) {
                 viewBack(controller, 1);
             }
 
             if (day != undefined && day == -1) {
                 viewForward(controller, 1);
             }
 
-            controller.assertJS(() => eventNodes.some(node => Math.abs(timeY - node) < allowedDifference));
+            controller.assert(() => eventNodes.some(node => Math.abs(timeY - node) < allowedDifference));
         }
     }
 }
--- a/mail/test/resources/mozmill/test/dnd/testTabView.js
+++ b/mail/test/resources/mozmill/test/dnd/testTabView.js
@@ -15,12 +15,12 @@ var testFoo = function() {
 
   var tab = new elementslib.Selector(doc, ".tab");
   var content = new elementslib.ID(doc, "content");
   controller.dragToElement(tab, content, 500, 600);
 
   var looseTabs = new elementslib.Selector(doc, ".tabInGroupItem");
   controller.assertNode(looseTabs);
   // there should only be one tab in the group now
-  controller.assertJS(function() { return !looseTabs.getNode(1); });
+  controller.assert(function() { return !looseTabs.getNode(1); });
 
   tabView.close();
 }