Bug 1377598 - When testing the page action menu, wait for the bookmark to be removed before continuing to avoid issues when enabling async transactions. r?mak draft
authorMark Banner <standard8@mozilla.com>
Wed, 12 Jul 2017 11:42:31 +0100
changeset 607620 8e20947278100f4df1e1c4cf6c591feb14f7f501
parent 607503 09a4282d1172ac255038e7ccacfd772140b219e2
child 637088 438e609cdba4e705bf1a53073a5193e95b7ae861
push id68046
push userbmo:standard8@mozilla.com
push dateWed, 12 Jul 2017 14:44:59 +0000
reviewersmak
bugs1377598
milestone56.0a1
Bug 1377598 - When testing the page action menu, wait for the bookmark to be removed before continuing to avoid issues when enabling async transactions. r?mak MozReview-Commit-ID: JbjlxGarXPj
browser/base/content/test/urlbar/browser_page_action_menu.js
--- a/browser/base/content/test/urlbar/browser_page_action_menu.js
+++ b/browser/base/content/test/urlbar/browser_page_action_menu.js
@@ -50,19 +50,25 @@ add_task(async function bookmark() {
     await new Promise(resolve => {
       if (StarUI.panel.state == "open") {
         resolve();
         return;
       }
       StarUI.panel.addEventListener("popupshown", resolve, { once: true });
     });
 
+    let onItemRemovedPromise = PlacesTestUtils.waitForNotification("onItemRemoved",
+      (id, parentId, index, type, itemUrl) => url == itemUrl.spec);
+
     // Click the remove-bookmark button in the panel.
     StarUI._element("editBookmarkPanelRemoveButton").click();
 
+    // Wait for the bookmark to be removed before continuing.
+    await onItemRemovedPromise;
+
     // Open the panel again.
     await promisePageActionPanelOpen();
 
     // The bookmark button should read "Bookmark This Page" and not be starred.
     Assert.equal(bookmarkButton.label, "Bookmark This Page");
     Assert.ok(!bookmarkButton.hasAttribute("starred"));
 
     // Done.