diff --git a/test/tests/browserTest.js b/test/tests/browserTest.js index 10e8f88c29..8aadad95ce 100644 --- a/test/tests/browserTest.js +++ b/test/tests/browserTest.js @@ -16,6 +16,18 @@ describe("Zotero_Browser", function () { Zotero.ProgressWindowSet.closeAll(); }) + var waitForTranslateIcon = Zotero.Promise.coroutine(function* () { + var button = win.document.getElementById('zotero-toolbar-save-button'); + if (button.classList.contains('translate')) { + return; + } + Zotero.debug("Waiting for translator icon"); + do { + yield Zotero.Promise.delay(50); + } + while (!button.classList.contains('translate')); + }); + it("should save webpage to My Library if the Zotero pane hasn't been opened yet in a Firefox window", function* () { var win = yield loadBrowserWindow(); @@ -114,6 +126,9 @@ describe("Zotero_Browser", function () { win.loadURI(uri); yield deferred.promise; + // Detection runs twice for local files, so wait for the icon to actually appear + yield waitForTranslateIcon(); + yield loadZoteroPane(win); var collection = yield createDataObject('collection');