Set Zotero.automatedTest flag instead of .noUserInput on Travis

And don't skip alerts in Zotero.alert() during automated tests. (That
was intended to avoid long timeouts after unexpected failures, but,
e.g., PDF metadata lookups (which are currently disabled in automated
tests) should just be mocked so they don't intermittently fail.)
This commit is contained in:
Dan Stillman 2016-06-24 18:28:32 -04:00
parent 12fef05e18
commit 2d88b07855
5 changed files with 6 additions and 14 deletions

View file

@ -178,7 +178,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
if (options) {
if (options.openPane) this.openPane = true;
if (options.noUserInput) this.noUserInput = true;
if (options.automatedTest) this.automatedTest = true;
if (options.skipBundledFiles) this.skipBundledFiles = true;
}
@ -1348,19 +1348,11 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
/**
* Display an alert in a given window
*
* This is just a wrapper around nsIPromptService.alert() that takes the Zotero.noUserInput
* flag into consideration
*
* @param {Window}
* @param {String} title
* @param {String} msg
*/
this.alert = function (window, title, msg) {
if (this.noUserInput) {
Zotero.debug("Not displaying alert: " + title + ": " + msg);
return;
}
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
ps.alert(window, title, msg);

View file

@ -489,8 +489,8 @@ ZoteroCommandLineHandler.prototype = {
}
}
if (cmdLine.handleFlag("ZoteroNoUserInput", false)) {
zInitOptions.noUserInput = true;
if (cmdLine.handleFlag("ZoteroAutomatedTest", false)) {
zInitOptions.automatedTest = true;
}
if (cmdLine.handleFlag("ZoteroSkipBundledFiles", false)) {
zInitOptions.skipBundledFiles = true;

View file

@ -141,7 +141,7 @@ function Reporter(runner) {
// Dark red X for errors
+ "\033[31;40m" + Mocha.reporters.Base.symbols.err + " [FAIL]\033[0m"
// Trigger bell if interactive
+ (Zotero.noUserInput ? "" : "\007")
+ (Zotero.automatedTest ? "" : "\007")
+ " " + test.title + "\n"
+ indentStr + " " + err.toString() + " at\n"
+ err.stack.replace(/^/gm, indentStr + " "));

View file

@ -132,7 +132,7 @@ fi
if [ "$TRAVIS" = true ]; then
FX_ARGS="$FX_ARGS -ZoteroNoUserInput -ZoteroTestTimeout 10000"
FX_ARGS="$FX_ARGS -ZoteroAutomatedTest -ZoteroTestTimeout 10000"
fi
# Clean up on exit

View file

@ -52,7 +52,7 @@ describe.skip("PDF Recognition", function() {
});
it("should recognize a PDF without a DOI", function* () {
if (Zotero.noUserInput) this.skip(); // CAPTCHAs make this fail
if (Zotero.automatedTest) this.skip(); // CAPTCHAs make this fail
this.timeout(30000);
// Import the PDF