www

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

commit 19714d5b9bdba12ba90d1800f72f9f3125163228
parent b5b8f2cd2f685eb0ae2e96db6cb44c291c4e6d1f
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu,  2 Jun 2016 16:47:27 -0400

Avoid logged error after server_connector saveSnapshot tests

Indexing currently happens a second after the 201 is returned to the
connector, so we have to wait for that before continuing tests, or else
a DB clear in a later test (e.g., storageLocal) will cause an error to
be logged when the indexing kicks off.

Diffstat:
Mchrome/content/zotero/xpcom/attachments.js | 3+++
Mtest/tests/server_connectorTest.js | 6++++++
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js @@ -393,6 +393,9 @@ Zotero.Attachments = new function(){ // We don't have any way of knowing that the file is flushed to disk, // so we just wait a second before indexing and hope for the best. // We'll index it later if it fails. (This may not be necessary.) + // + // If this is removed, the afterEach() delay in the server_connector /connector/saveSnapshot + // tests can also be removed. setTimeout(function () { Zotero.Fulltext.indexItems([attachmentItem.id]); }, 1000); diff --git a/test/tests/server_connectorTest.js b/test/tests/server_connectorTest.js @@ -104,6 +104,12 @@ describe("Connector Server", function () { }); describe("/connector/saveSnapshot", function () { + // TEMP: Wait for indexing to complete, which happens after a 1-second delay, after a 201 has + // been returned to the connector. Would be better to make sure indexing has completed. + afterEach(function* () { + yield Zotero.Promise.delay(1050); + }); + it("should save a webpage item and snapshot to the current selected collection", function* () { var collection = yield createDataObject('collection'); yield waitForItemsLoad(win);