-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-tests.sh
executable file
·59 lines (46 loc) · 1.51 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
# shellcheck source=../scripts/common-functions.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/scripts/common-functions.sh"
CONTAINER_NAME=ludos-tests-$(openssl rand -hex 4)
function stop() {
docker kill "$CONTAINER_NAME"
}
trap stop EXIT
function server_tests {
pushd server
./gradlew test --rerun-tasks
popd
}
function frontend_unit_tests {
pushd web
npm_ci_if_package_lock_has_changed
npx vitest run
popd
}
readonly RESULTS_DIR="$repo/playwright/playwright-results"
function playwright_tests {
mkdir -p "$RESULTS_DIR"
docker build -t playwright-image -f Dockerfile.playwright --build-arg="PLAYWRIGHT_VERSION=$(get_playwright_version)" .
docker run -it \
--network ludos_default \
-v "$RESULTS_DIR":/playwright/playwright-results \
-v "$repo/playwright/snapshots":/playwright/snapshots \
-v "$repo/playwright/parallel_tests":/playwright/parallel_tests \
-v "$repo/playwright/non_parallel_tests":/playwright/non_parallel_tests \
-v "$repo/playwright/assertPdfDownload.ts":/playwright/assertPdfDownload.ts \
-v "$repo/playwright/models":/playwright/models \
--env HEADLESS=true \
${RUN_LOCAL_TESTS_IN_UI_MODE:+--env RUN_LOCAL_TESTS_IN_UI_MODE} \
${RUN_LOCAL_TESTS_IN_UI_MODE:+-p 127.0.0.1:9876:9876} \
${RUN_LOCAL_TESTS_IN_UI_MODE:+-t -i} \
--name "$CONTAINER_NAME" \
playwright-image "$@"
}
function main {
configure_aws_credentials
playwright_tests "$@"
frontend_unit_tests
server_tests
}
main "$@"