commit 2d88b07855cc8f9186c9d4c3d5f6815a461a8363
parent 12fef05e18e98bcd0a5a91d33bfcf233324351d1
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 24 Jun 2016 18:28:32 -0400
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.)
Diffstat:
5 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -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);
diff --git a/components/zotero-service.js b/components/zotero-service.js
@@ -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;
diff --git a/test/content/runtests.js b/test/content/runtests.js
@@ -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 + " "));
diff --git a/test/runtests.sh b/test/runtests.sh
@@ -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
diff --git a/test/tests/recognizePDFTest.js b/test/tests/recognizePDFTest.js
@@ -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