-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (47 loc) · 2.19 KB
/
Copy pathMakefile
File metadata and controls
59 lines (47 loc) · 2.19 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
COMPOSE = docker compose -f docker-compose.test.yml
.PHONY: e2e-up e2e-down e2e-rebuild e2e-rebuild-postgres e2e e2e-ui e2e-logs e2e-logs-backend e2e-db-reset
## Start the test infrastructure (postgres + backend)
e2e-up:
$(COMPOSE) up -d
## Stop and remove test containers
e2e-down:
$(COMPOSE) down
## Rebuild the backend image (after upstream changes)
e2e-rebuild:
$(COMPOSE) build backend
## Rebuild the postgres image (after SQL seed changes)
e2e-rebuild-postgres:
$(COMPOSE) stop postgres backend
$(COMPOSE) rm -f postgres
$(COMPOSE) build postgres
$(COMPOSE) up -d
## Show all service logs
e2e-logs:
$(COMPOSE) logs -f
## Show backend logs only
e2e-logs-backend:
$(COMPOSE) logs -f backend
## Reset the database (drop + recreate + re-seed)
e2e-db-reset:
$(COMPOSE) stop backend
$(COMPOSE) exec -T postgres psql -U postgres -c "DROP DATABASE IF EXISTS noharm;"
$(COMPOSE) exec -T postgres psql -U postgres -c "DROP OWNED BY demo_user;"
$(COMPOSE) exec -T postgres psql -U postgres -c "DROP ROLE IF EXISTS demo_user;"
$(COMPOSE) exec -T postgres psql -U postgres -c "DROP ROLE IF EXISTS api_user;"
$(COMPOSE) exec -T postgres psql -U postgres -c "DROP ROLE IF EXISTS noharmcare;"
$(COMPOSE) exec -T postgres psql -U postgres -c "CREATE DATABASE noharm;"
$(COMPOSE) exec -T postgres psql -v ON_ERROR_STOP=1 -U postgres -d noharm -f /docker-entrypoint-initdb.d/db/noharm-public.sql
$(COMPOSE) exec -T postgres psql -v ON_ERROR_STOP=1 -U postgres -d noharm -f /docker-entrypoint-initdb.d/db/noharm-create.sql
$(COMPOSE) exec -T postgres psql -v ON_ERROR_STOP=1 -U postgres -d noharm -f /docker-entrypoint-initdb.d/db/noharm-newuser.sql
$(COMPOSE) exec -T postgres psql -v ON_ERROR_STOP=1 -U postgres -d noharm -f /docker-entrypoint-initdb.d/db/noharm-triggers.sql
$(COMPOSE) exec -T postgres psql -v ON_ERROR_STOP=1 -U postgres -d noharm -f /docker-entrypoint-initdb.d/db/noharm-insert.sql
$(COMPOSE) start backend
## Run e2e tests (headless) — resets DB first
e2e: e2e-db-reset
VITE_APP_API_URL=http://localhost:5001 npx playwright test
## Run e2e tests in interactive UI mode (no auto-reset)
e2e-ui:
VITE_APP_API_URL=http://localhost:5001 npx playwright test --ui
## Dev environment
dev:
sfw npm run dev