-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe2e-stress-run.sh
More file actions
executable file
·42 lines (35 loc) · 905 Bytes
/
Copy pathe2e-stress-run.sh
File metadata and controls
executable file
·42 lines (35 loc) · 905 Bytes
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
#!/usr/bin/env bash
# End-to-end stress test runner script
set -uo pipefail
SUCCESS_FILE="/tmp/e2e-stress-run-success-count"
if [[ ! -f .env.development ]]; then
echo "Missing .env.development file" >&2
exit 1
fi
# Load dev environment variables so every Playwright run matches local stress conditions.
set -a
source .env.development
set +a
if [[ ! -f "$SUCCESS_FILE" ]]; then
echo "0" > "$SUCCESS_FILE"
fi
while true; do
CI=1 FORCE_COLOR=1 npx playwright test
status=$?
if [[ $status -eq 0 ]]; then
count=$(<"$SUCCESS_FILE")
if ! [[ "$count" =~ ^[0-9]+$ ]]; then
count=0
fi
count=$((count + 1))
echo "$count" > "$SUCCESS_FILE"
echo "Number of successful runs: $count"
else
count=$(<"$SUCCESS_FILE")
if ! [[ "$count" =~ ^[0-9]+$ ]]; then
count=0
fi
echo "Number of successful runs before failure: $count"
exit $status
fi
done