Bug 1519226: browser_toolbarButtonKeyPress.js: Wait for the bookmarked status to finish updating before pressing the Bookmark this page button. r=Gijs
authorJames Teh <jteh@mozilla.com>
Mon, 25 Feb 2019 09:56:04 +0000
changeset 518743 f4c45ebf34aca62e14ca3eaf92b80070b8c22f5e
parent 518742 81adda1cb3f2d0ddcc71c389ff851396387412b0
child 518744 6fd0fad9f4f11314b29eaf6697c6abdc3497825e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1519226
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1519226: browser_toolbarButtonKeyPress.js: Wait for the bookmarked status to finish updating before pressing the Bookmark this page button. r=Gijs The status regarding whether a page is bookmarked or not is updated async. While the update is pending, the Bookmark this page button ignores activation. Thus, the test must wait for the update to be finished before trying to press the button. This fixes intermittent timeouts in this test. Differential Revision: https://phabricator.services.mozilla.com/D20978
browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js
--- a/browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js
+++ b/browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js
@@ -211,16 +211,20 @@ add_task(async function testSidebarsButt
 // This is an image with a click handler on its parent and no command handler,
 // but the toolbar keyboard navigation code should handle keyboard activation.
 add_task(async function testBookmarkButtonPress() {
   await BrowserTestUtils.withNewTab("https://example.com", async function(aBrowser) {
     let button = document.getElementById("star-button");
     forceFocus(button);
     let panel = document.getElementById("editBookmarkPanel");
     let focused = BrowserTestUtils.waitForEvent(panel, "focus", true);
+    // The button ignores activation while the bookmarked status is being
+    // updated. So, wait for it to finish updating.
+    await TestUtils.waitForCondition(() =>
+      BookmarkingUI.status != BookmarkingUI.STATUS_UPDATING);
     EventUtils.synthesizeKey(" ");
     await focused;
     ok(true, "Focus inside edit bookmark panel after Bookmark button pressed");
     let hidden = BrowserTestUtils.waitForEvent(panel, "popuphidden");
     EventUtils.synthesizeKey("KEY_Escape");
     await hidden;
   });
 });