#!/bin/bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="$( cd "$( dirname "$SCRIPT_DIR" )" && 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 "$Z_EXECUTABLE" ]; then if [ "`uname`" == "Darwin" ]; then Z_EXECUTABLE="$ROOT_DIR/app/staging/Zotero.app/Contents/MacOS/zotero" else Z_EXECUTABLE="$ROOT_DIR/app/staging/Zotero-x86_64/zotero" fi fi if [ -z "$DISPLAY" ]; then Z_ARGS="" else Z_ARGS="--class=ZTestFirefox" fi function usage { cat >&2 <> "$PROFILE/prefs.js" user_pref("app.update.enabled", 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.automaticScraperUpdates", 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("extensions.zoteroMacWordIntegration.installed", true); user_pref("extensions.zoteroMacWordIntegration.skipInstallation", true); user_pref("extensions.zoteroWinWordIntegration.skipInstallation", true); user_pref("extensions.zoteroOpenOfficeIntegration.skipInstallation", true); EOF if [ -n "$CI" ]; then Z_ARGS="$Z_ARGS -ZoteroAutomatedTest -ZoteroTestTimeout 15000" fi # Clean up on exit trap "{ rm -rf \"$TEMPDIR\"; }" EXIT # Check if build watch process is running # If not, run now if [[ -z "$CI" ]] && ! ps | grep scripts/build.js | grep -v grep > /dev/null; then echo echo "Running JS build process" cd "$ROOT_DIR" npm run build || exit $? echo fi ZOTERO_INCLUDE_TESTS=1 "$ROOT_DIR/app/scripts/dir_build" -q makePath FX_PROFILE "$PROFILE" MOZ_NO_REMOTE=1 NO_EM_RESTART=1 "$Z_EXECUTABLE" -profile "$FX_PROFILE" -jsconsole \ -chrome chrome://zotero-unit/content/runtests.html -test "$TESTS" -grep "$GREP" -ZoteroTest $Z_ARGS # Check for success test -e "$PROFILE/success" STATUS=$? exit $STATUS