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; 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. * Ensures that the PDF tools are installed, or installs them if not.
* Returns a promise. * Returns a promise.

View File

@ -9,10 +9,11 @@ describe("Add Item by Identifier", function() {
var win; var win;
before(function() { before(function() {
this.timeout(5000); 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) { return loadZoteroPane().then(function(w) {
win = w; win = w;
}).then(function() { return Zotero.Schema.updateBundledFiles('translators', null, false);
return waitForTranslators();
}); });
}); });
after(function() { after(function() {

View File

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