zotero/test/tests/preferences_searchTest.js
Dan Stillman 5ba344516e Update PDF tool handling in tests
The test runner now downloads and caches the PDF tools for the current
platform within the test data directory and only redownloads them when
out of date, and it updates the download URL so that the full-text code
pulls from the cache directory via a file:// URL.

The installPDFTools() support function now installs the files directly
instead of going through the prefs, and a new uninstallPDFTools()
function removes the tools. Since the presence of the PDF tools can
affect other tests, tests that need the tools should install them in a
before() and uninstall them in an after(), leaving most tests to run
without PDF indexing.

This also adds a callback to the waitForWindow() support function. If a
modal dialog is opened, it blocks the next promise handler from running,
so a callback has to be used to interact with and close the dialog
immediately.
2015-05-31 23:50:26 -04:00

24 lines
788 B
JavaScript

describe("Search Preferences", function () {
describe("PDF Indexing", function () {
it("should install PDF tools if not installed", function* () {
// Begin install procedure
var win = yield loadWindow("chrome://zotero/content/preferences/preferences.xul", {
pane: 'zotero-prefpane-search',
action: 'pdftools-install'
});
// Wait for confirmation dialog
yield waitForWindow("chrome://global/content/commonDialog.xul", function (dialog) {
// Accept confirmation dialog
dialog.document.documentElement.acceptDialog();
});
// Wait for install to finish
yield waitForCallback(function() {
return Zotero.Fulltext.pdfConverterIsRegistered()
&& Zotero.Fulltext.pdfInfoIsRegistered();
}, 500)
.finally(() => win.close());
})
})
})