updateBundledFiles before using translators and wait for completion

This commit is contained in:
Simon Kornblith 2015-03-09 17:06:01 -04:00
parent c2d32c2e27
commit 4a4073652f
3 changed files with 8 additions and 16 deletions

View file

@ -114,16 +114,6 @@ function waitForCallback(cb, interval, timeout) {
return deferred.promise;
}
/**
* Returns a promise that is resolved once the translators are loaded.
*/
function waitForTranslators() {
return waitForCallback(function() {
// Just wait for the zotero.org translator to load
return !!Zotero.Translators.get("c82c574d-7fe8-49ca-a360-a05d6e34fec0");
});
}
/**
* Ensures that the PDF tools are installed, or installs them if not.
* Returns a promise.

View file

@ -9,10 +9,11 @@ describe("Add Item by Identifier", function() {
var win;
before(function() {
this.timeout(5000);
// Load a Zotero pane and update the translators (needed to
// make sure they're available before we run the tests)
return loadZoteroPane().then(function(w) {
win = w;
}).then(function() {
return waitForTranslators();
return Zotero.Schema.updateBundledFiles('translators', null, false);
});
});
after(function() {

View file

@ -4,11 +4,12 @@ describe("PDF Recognition", function() {
var win;
before(function() {
this.timeout(60000);
return installPDFTools().then(function() {
return loadZoteroPane();
}).then(function(w) {
// Load Zotero pane, install PDF tools, and load the
// translators
return Q.all([loadZoteroPane().then(function(w) {
win = w;
});
return Zotero.Schema.updateBundledFiles('translators', null, false);
}), installPDFTools()]);
});
afterEach(function() {
for(let win of getWindows("chrome://zotero/content/pdfProgress.xul")) {