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
--- 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.