Bug 1491269 - Fix test failure in testTaskView.js by avoiding double delete; r=darktrojan
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Tue, 20 Nov 2018 14:23:55 +0200
changeset 33748 73d35ac1dec481f3e310a12d27ca420532f51b41
parent 33747 72a2e97895e9d58585d4647fdb79f5d4010244d2
child 33749 77d43522f4597c01058c879866ca8fece95a7d12
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersdarktrojan
bugs1491269
Bug 1491269 - Fix test failure in testTaskView.js by avoiding double delete; r=darktrojan
calendar/test/mozmill/views/testTaskView.js
--- a/calendar/test/mozmill/views/testTaskView.js
+++ b/calendar/test/mozmill/views/testTaskView.js
@@ -73,18 +73,18 @@ function testTaskView() {
     `);
     controller.type(taskInput, TITLE);
     controller.keypress(taskInput, "VK_RETURN", {});
 
     // Verify added.
     let countAfter;
     controller.waitFor(() => {
         countAfter = taskTreeNode.mTaskArray.length;
-        return countBefore + 1 == countAfter;
-    }, "Added Task did not appear");
+        return countAfter == (countBefore + 1);
+    }, "Added Task did not appear; countBefore=" + countBefore + ", countAfter=" + countAfter);
 
     // Last added task is automatically selected so verify detail window data.
     controller.assertJSProperty(eid("calendar-task-details-title"), "textContent", TITLE);
 
     // Open added task
     // Doubleclick on completion checkbox is ignored as opening action, so don't
     // click at immediate left where the checkbox is located.
     controller.doubleClick(lookup(treeChildren), 50, 0);
@@ -150,21 +150,20 @@ function testTaskView() {
     // Mark completed, verify.
     controller.click(eid("task-actions-markcompleted"));
     sleep();
 
     toolTipNode.ownerGlobal.showToolTip(toolTipNode, taskTreeNode.getTaskAtRow(0));
     controller.assertJSProperty(toolTipStatus, "textContent", "Completed");
 
     // Delete task and verify.
-    controller.click(eid("task-context-menu-delete"));
     controller.click(eid("calendar-delete-task-button"));
-    let countAfterDelete;
+    countBefore = countAfter;
     controller.waitFor(() => {
-        countAfterDelete = taskTreeNode.mTaskArray.length;
-        return countAfter - 1 == countAfterDelete;
-    });
+        countAfter = taskTreeNode.mTaskArray.length;
+        return countAfter == (countBefore - 1);
+    }, "Task did not delete; countBefore=" + countBefore + ", countAfter=" + countAfter);
 }
 
 function teardownTest(module) {
     deleteCalendars(controller, CALENDARNAME);
     closeAllEventDialogs();
 }