diff --git a/ci/linux/run.sh b/ci/linux/run.sh index 43b19a63ca..dfdc86ee82 100755 --- a/ci/linux/run.sh +++ b/ci/linux/run.sh @@ -7,7 +7,7 @@ PROGRAM='run.sh' SHORTOPTS="h" LONGOPTS="help,\ - root:,config:,\ + root:,config:,samples-profile:,samples-port:,samples-port-api:,\ all,clean,npm-build,sln-restore,sln-build,unit-tests,js-tests,ui-tests,\ no-all,no-clean,no-npm-build,no-sln-restore,no-sln-build,no-unit-tests,no-js-tests,no-ui-tests" TEMP=$(getopt -o "$SHORTOPS" -l "$LONGOPTS" -n "$PROGRAM" -- "$@") @@ -33,8 +33,11 @@ Usage: $PROGRAM [options] Options: -h, --help Show this help. - --root ROOT Path to the repo root (default = \$DOTVVM_ROOT:-\$PWD) - --config CONFIG The build configuration (default = \$BUILD_CONFIGURATION:-Release) + --root ROOT Path to the repo root (default = \$DOTVVM_ROOT:-\$PWD). + --config CONFIG The build configuration (default = \$BUILD_CONFIGURATION:-Release). + --samples-profile (default = \$SAMPLES_PROFILE:-seleniumconfig.aspnetcorelatest.chrome.json). + --samples-port (default = 16019). + --samples-port-api (default = 5001). --[no-]all Enable or disable all phases. --[no-]clean Clean the with 'git clean' first (default = 0). --[no-]npm-build Build the JS part of the Framework (default = 1). @@ -70,6 +73,21 @@ EOF shift 2 continue ;; + '--samples-profile') + SAMPLES_PROFILE="$2" + shift 2 + continue + ;; + '--samples-port') + SAMPLES_PORT="$2" + shift 2 + continue + ;; + '--samples-port-api') + SAMPLES_PORT_API="$2" + shift 2 + continue + ;; '--') shift break @@ -113,10 +131,13 @@ ROOT=${DOTVVM_ROOT:-$(pwd)} # override DOTVVM_ROOT in case this is a local build export DOTVVM_ROOT=$ROOT -CONFIGURATION=${BUILD_CONFIGURATION:-Release} -DISPLAY=${DISPLAY:-":42"} -SLN=$ROOT/ci/linux/Linux.sln -TEST_RESULTS_DIR=$ROOT/artifacts/test +CONFIGURATION="${BUILD_CONFIGURATION:-Release}" +DISPLAY="${DISPLAY:-":42"}" +SLN="$ROOT/ci/linux/Linux.sln" +TEST_RESULTS_DIR="$ROOT/artifacts/test" +SAMPLES_PROFILE="${SAMPLES_PROFILE:-seleniumconfig.aspnetcorelatest.chrome.json}" +SAMPLES_PORT="${SAMPLES_PORT:-16019}" +SAMPLES_PORT_API="${SAMPLES_PORT_API:-5001}" tput sgr0 echo "ROOT=$ROOT" @@ -124,6 +145,9 @@ echo "SLN=$SLN" echo "CONFIGURATION=$CONFIGURATION" echo "DISPLAY=$DISPLAY" echo "TEST_RESULTS_DIR=$TEST_RESULTS_DIR" +echo "SAMPLES_PROFILE=$SAMPLES_PROFILE" +echo "SAMPLES_PORT=$SAMPLES_PORT" +echo "SAMPLES_PORT_API=$SAMPLES_PORT_API" # ================ # helper functions @@ -216,20 +240,29 @@ if [ $UI_TESTS -eq 1 ]; then dotnet run --project "$ROOT/src/DotVVM.Samples.BasicSamples.Api.AspNetCoreLatest" \ --no-build \ --configuration "$CONFIGURATION" \ - --urls http://localhost:5001/ >/dev/null & + --urls "http://localhost:${SAMPLES_PORT_API}/" >/dev/null & + SAMPLES_API_PID=$! dotnet run --project "$ROOT/src/DotVVM.Samples.BasicSamples.AspNetCoreLatest" \ --no-build \ --configuration "$CONFIGURATION" \ - --urls http://localhost:16018/ >/dev/null & + --urls "http://localhost:${SAMPLES_PORT}/" >/dev/null & SAMPLES_PID=$! + SAMPLES_DIR="$ROOT/src/DotVVM.Samples.Tests" + PROFILE_PATH="$SAMPLES_DIR/Profiles/$SELENIUM_CONFIG" + + if [ ! -f "$PROFILE_PATH" ]; then + echo >&2 "Profile '$PROFILE_PATH' doesn't exist." + fi + cp -f "$PROFILE_PATH" "$SAMPLES_DIR/seleniumconfig.json" + run_named_command "UI tests" \ - "dotnet test \"$ROOT/src/DotVVM.Samples.Tests\" \ + "dotnet test \"\" \ --no-build \ --configuration $CONFIGURATION \ --logger trx \ --results-directory \"$TEST_RESULTS_DIR\"" - kill $XVFB_PID $SAMPLES_PID 2>/dev/null + kill $XVFB_PID $SAMPLES_PID $SAMPLES_API_PID 2>/dev/null fi