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.
This commit is contained in:
Dan Stillman 2016-06-02 16:47:27 -04:00
parent b5b8f2cd2f
commit 19714d5b9b
2 changed files with 9 additions and 0 deletions

View file

@ -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);

View file

@ -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);