www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit f52e93dd165ba8a7970df6622859164b6a438043
parent 5a4dddcbc6c54093933247969c1ae77682295aa7
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 27 Apr 2016 15:57:38 -0400

Fix intermittent test failures saving from loaded RIS file

1c19fe8d81 isn't sufficient for local files, because detection is run
twice, so a translator may not be available when the detect callback is
run. This changes the test to poll for the translate icon, which is a
bit of a hack but does the job.

Unfortunately this isn't perfect either, because it seems the RIS
detection sometimes just isn't run, which means that the icon never
changes and the test times out. Maybe @simonster has an idea why that's
happening.

Diffstat:
Mtest/tests/browserTest.js | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git 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');