#!/bin/bash CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" case "$OSTYPE" in msys*|mingw*|cygwin*) IS_CYGWIN=1 ;; esac function makePath { local __assignTo=$1 local __path=$2 if [ ! -z $IS_CYGWIN ]; then __path="`cygpath -aw \"$__path\"`" fi eval $__assignTo="'$__path'" } if [ -z "$FX_EXECUTABLE" ]; then if [ "`uname`" == "Darwin" ]; then FX_EXECUTABLE="/Applications/Firefox Unbranded.app/Contents/MacOS/firefox" else FX_EXECUTABLE="firefox" fi fi if [ -z "$DISPLAY" ]; then FX_ARGS="" else FX_ARGS="--class=ZTestFirefox" fi function usage { cat >&2 < "$PROFILE/extensions/zotero@chnm.gmu.edu" makePath ZOTERO_UNIT_PATH "$ZOTERO_PATH/test" echo "$ZOTERO_UNIT_PATH" > "$PROFILE/extensions/zotero-unit@zotero.org" # Create data directory mkdir "$TEMPDIR/Zotero" cat < "$PROFILE/prefs.js" user_pref("app.update.enabled", false); user_pref("extensions.autoDisableScopes", 0); user_pref("browser.tabs.remote.autostart", false); user_pref("browser.tabs.remote.autostart.2", false); user_pref("browser.uitour.enabled", false); user_pref("browser.shell.checkDefaultBrowser", false); user_pref("dom.max_chrome_script_run_time", 0); // It would be better to leave this on and handle it in Sinon's FakeXMLHttpRequest user_pref("extensions.zotero.sync.server.compressData", false); user_pref("extensions.zotero.debug.log", $DEBUG); user_pref("extensions.zotero.debug.level", $DEBUG_LEVEL); user_pref("extensions.zotero.debug.time", $DEBUG); user_pref("extensions.zotero.firstRun.skipFirefoxProfileAccessCheck", true); user_pref("extensions.zotero.firstRunGuidance", false); user_pref("extensions.zotero.firstRun2", false); user_pref("extensions.zotero.reportTranslationFailure", false); user_pref("extensions.zotero.httpServer.enabled", true); user_pref("extensions.zotero.backup.numBackups", 0); user_pref("extensions.zotero.sync.autoSync", false); user_pref("xpinstall.signatures.required", false); user_pref("datareporting.healthreport.uploadEnabled", false); user_pref("datareporting.healthreport.service.enabled", false); user_pref("datareporting.healthreport.service.firstRun", false); user_pref("datareporting.policy.dataSubmissionEnabled", false); user_pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true); EOF # -v flag on Windows makes Firefox process hang if [ -z $IS_CYGWIN ]; then echo "`MOZ_NO_REMOTE=1 NO_EM_RESTART=1 \"$FX_EXECUTABLE\" -v`" fi if [ "$TRAVIS" = true ]; then FX_ARGS="$FX_ARGS -ZoteroAutomatedTest -ZoteroTestTimeout 10000" fi # Clean up on exit trap "{ rm -rf \"$TEMPDIR\"; }" EXIT # Check if build watch process is running # If not, run now if [[ "$TRAVIS" != true ]] && ! ps | grep scripts/build.js | grep -v grep > /dev/null; then echo echo "Running JS build process" cd "$CWD/.." npm run build || exit $? echo fi makePath FX_PROFILE "$PROFILE" MOZ_NO_REMOTE=1 NO_EM_RESTART=1 "$FX_EXECUTABLE" -profile "$FX_PROFILE" \ -chrome chrome://zotero-unit/content/runtests.html -test "$TESTS" -grep "$GREP" -ZoteroTest $FX_ARGS # Check for success test -e "$PROFILE/success" STATUS=$? exit $STATUS