Bug 1336806 - In browser_bookmark_popup.js' hover tests, place the mouse in the middle of the panel to try and avoid intermittents. r?mak draft
authorMark Banner <standard8@mozilla.com>
Mon, 17 Jul 2017 09:59:41 +0100
changeset 609827 800597fb64a06e0e1b93b401e78450c39337ef17
parent 609768 d43779e278d2e4d3e21dba2fcb585a3bf4b1288e
child 637681 acc1c145e9b4969b989926d32626129671c3deb5
push id68696
push userbmo:standard8@mozilla.com
push dateMon, 17 Jul 2017 15:31:33 +0000
reviewersmak
bugs1336806
milestone56.0a1
Bug 1336806 - In browser_bookmark_popup.js' hover tests, place the mouse in the middle of the panel to try and avoid intermittents. r?mak MozReview-Commit-ID: 3X89DkfWxQv
browser/base/content/test/general/browser_bookmark_popup.js
--- a/browser/base/content/test/general/browser_bookmark_popup.js
+++ b/browser/base/content/test/general/browser_bookmark_popup.js
@@ -6,17 +6,17 @@
 
 /**
  * Test opening and closing the bookmarks panel.
  */
 
 let bookmarkPanel = document.getElementById("editBookmarkPanel");
 let bookmarkStar = AppConstants.MOZ_PHOTON_THEME ? BookmarkingUI.star : BookmarkingUI.button;
 let bookmarkPanelTitle = document.getElementById("editBookmarkPanelTitle");
-let editBookmarkPanelRemoveButtonRect;
+let editBookmarkPanelRect;
 
 StarUI._closePanelQuickForTesting = true;
 
 async function test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn,
                                 shouldAutoClose, popupHideFn, isBookmarkRemoved}) {
   await BrowserTestUtils.withNewTab({gBrowser, url: "about:home"}, async function(browser) {
     try {
       if (!isNewBookmark) {
@@ -35,18 +35,18 @@ async function test_bookmarks_popup({isN
       Assert.equal(bookmarkStar.hasAttribute("starred"), !isNewBookmark,
                    "Page should only be starred prior to popupshown if editing bookmark");
       Assert.equal(bookmarkPanel.state, "closed", "Panel should be 'closed' to start test");
       let shownPromise = promisePopupShown(bookmarkPanel);
       await popupShowFn(browser);
       await shownPromise;
       Assert.equal(bookmarkPanel.state, "open", "Panel should be 'open' after shownPromise is resolved");
 
-    editBookmarkPanelRemoveButtonRect =
-      document.getElementById("editBookmarkPanelRemoveButton").getBoundingClientRect();
+    editBookmarkPanelRect =
+      document.getElementById("editBookmarkPanel").getBoundingClientRect();
 
       if (popupEditFn) {
         await popupEditFn();
       }
       let bookmarks = [];
       await PlacesUtils.bookmarks.fetch({url: "about:home"}, bm => bookmarks.push(bm));
       Assert.equal(bookmarks.length, 1, "Only one bookmark should exist");
       Assert.equal(bookmarkStar.getAttribute("starred"), "true", "Page is starred");
@@ -381,18 +381,19 @@ add_task(async function mouse_hovering_p
     return;
   }
   await test_bookmarks_popup({
     isNewBookmark: true,
     async popupShowFn(browser) {
       await new Promise(resolve => {
         EventUtils.synthesizeNativeMouseMove(
           document.documentElement,
-          editBookmarkPanelRemoveButtonRect.left,
-          editBookmarkPanelRemoveButtonRect.top,
+          // Locate the mouse in the middle of the panel.
+          (editBookmarkPanelRect.left + editBookmarkPanelRect.right) / 2,
+          (editBookmarkPanelRect.top + editBookmarkPanelRect.bottom) / 2,
           resolve);
       });
       EventUtils.synthesizeKey("D", {accelKey: true}, window);
     },
     shouldAutoClose: false,
     popupHideFn() {
       document.getElementById("editBookmarkPanelRemoveButton").click();
     },