-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathe2e-dev.sh
More file actions
executable file
·64 lines (51 loc) · 1.71 KB
/
e2e-dev.sh
File metadata and controls
executable file
·64 lines (51 loc) · 1.71 KB
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
60
61
62
63
64
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"/..
export NEXT_PUBLIC_ISOLATED_ENV=true
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
print_status() { echo -e "${GREEN}[E2E-DEV]${NC} $1"; }
print_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# Check services are running (fail fast with helpful message)
check_services() {
local missing=0
if ! curl -s http://127.0.0.1:9099 > /dev/null 2>&1; then
print_error "Firebase emulator is not running. Run: yarn emulate"
missing=1
fi
if ! curl -s http://localhost:8088/health > /dev/null 2>&1; then
print_error "Backend API is not running. Run: yarn --cwd=backend/api dev"
missing=1
fi
if ! curl -s http://localhost:3000 > /dev/null 2>&1; then
print_error "Next.js is not running. Run: yarn --cwd=web dev"
missing=1
fi
if [ $missing -eq 1 ]; then
echo ""
echo "Start everything with: yarn test:e2e:services"
echo "Or start full clean run: yarn test:e2e"
exit 1
fi
}
print_status "Checking services..."
check_services
print_status "All services running ✅"
npx playwright install chromium
# Run tests - pass all args through to playwright
# Examples:
# yarn test:e2e:dev → all e2e tests
# yarn test:e2e:dev tests/e2e/auth.spec.ts → specific file
# yarn test:e2e:dev --grep "login" → tests matching pattern
# yarn test:e2e:dev --ui → open Playwright UI
if [ $# -eq 0 ]; then
# No arguments: run all tests in tests/e2e
print_status "Running: npx playwright test tests/e2e"
npx playwright test tests/e2e
else
# Arguments provided: pass them directly to playwright
print_status "Running: npx playwright test $@"
npx playwright test "$@"
fi