11#! /bin/bash
22
3- # set -e
3+ set -euo pipefail
4+
5+ # Function to clean up background processes
6+ cleanup () {
7+ echo " Stopping background processes..."
8+ for pid in " ${PIDS[@]:- } " ; do
9+ if kill -0 " $pid " 2> /dev/null; then
10+ kill " $pid " || true
11+ wait " $pid " 2> /dev/null || true
12+ echo " Killed PID $pid "
13+ fi
14+ done
15+ }
16+
17+ # Trap EXIT, INT, TERM to run cleanup automatically
18+ trap cleanup EXIT INT TERM
419
520cd " $( dirname " $0 " ) " /..
621
722npx playwright install chromium
823
924export NEXT_PUBLIC_API_URL=localhost:8088
1025export NEXT_PUBLIC_FIREBASE_ENV=DEV
26+ export NEXT_PUBLIC_FIREBASE_EMULATOR=true
27+ export FIREBASE_AUTH_EMULATOR_HOST=127.0.0.1:9099
28+ export FIREBASE_STORAGE_EMULATOR_HOST=127.0.0.1:9199
29+
30+ # Start servers in background and store their PIDs
31+ PIDS=()
32+ npx nyc --reporter=lcov yarn --cwd=web serve & PIDS+=($! )
33+ npx nyc --reporter=lcov yarn --cwd=backend/api dev & PIDS+=($! )
34+ yarn emulate & PIDS+=($! )
1135
12- npx nyc --reporter=lcov yarn --cwd=web serve &
13- npx nyc --reporter=lcov yarn --cwd=backend/api dev &
1436npx wait-on http://localhost:3000
15- npx playwright test tests/e2e --headed
16- SERVER_PID=$( fuser -k 3000/tcp)
17- echo $SERVER_PID
18- kill $SERVER_PID
19-
20- SERVER_PID=$( fuser -k 8088/tcp)
21- echo $SERVER_PID
22- kill $SERVER_PID
37+
38+ npx tsx scripts/setup-auth.ts
39+
40+ npx playwright test tests/e2e
41+
42+ exit ${TEST_FAILED:- 0}
0 commit comments