Skip to content

Commit 702ce7b

Browse files
committed
chore(tests): add e2e github workflow
1 parent c873733 commit 702ce7b

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

.github/workflows/e2e.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: E2E Tracing Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release/**
8+
pull_request:
9+
10+
jobs:
11+
tracing-e2e:
12+
name: Tracing E2E Tests
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 15
15+
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Elixir and Erlang
21+
uses: erlef/setup-beam@v1
22+
with:
23+
elixir-version: "1.18"
24+
otp-version: "27.2"
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: "20"
30+
31+
- name: Cache Elixir dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
deps
36+
_build
37+
test_integrations/phoenix_app/deps
38+
test_integrations/phoenix_app/_build
39+
key: ${{ runner.os }}-elixir-1.18-otp-27.2-mix-${{ hashFiles('**/mix.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-elixir-1.18-otp-27.2-mix-
42+
43+
- name: Cache Node.js dependencies
44+
uses: actions/cache@v4
45+
with:
46+
path: |
47+
test_integrations/tracing/node_modules
48+
test_integrations/tracing/svelte_mini/node_modules
49+
key: ${{ runner.os }}-node-20-${{ hashFiles('test_integrations/tracing/package-lock.json', 'test_integrations/tracing/svelte_mini/package-lock.json') }}
50+
restore-keys: |
51+
${{ runner.os }}-node-20-
52+
53+
- name: Install main project dependencies
54+
run: mix deps.get
55+
56+
- name: Install Phoenix app dependencies
57+
working-directory: test_integrations/phoenix_app
58+
run: mix deps.get
59+
60+
- name: Compile Phoenix app
61+
working-directory: test_integrations/phoenix_app
62+
run: mix compile
63+
64+
- name: Install tracing test npm dependencies
65+
working-directory: test_integrations/tracing
66+
run: npm install
67+
68+
- name: Install Svelte app dependencies
69+
working-directory: test_integrations/tracing/svelte_mini
70+
run: npm install
71+
72+
- name: Install Playwright browsers
73+
working-directory: test_integrations/tracing
74+
run: npx playwright install --with-deps --only-shell chromium
75+
76+
- name: Start Phoenix server
77+
working-directory: test_integrations/phoenix_app
78+
run: |
79+
rm -f tmp/sentry_debug_events.log
80+
SENTRY_E2E_TEST_MODE=true mix phx.server &
81+
echo $! > /tmp/phoenix.pid
82+
echo "Phoenix server started with PID $(cat /tmp/phoenix.pid)"
83+
84+
- name: Start Svelte server
85+
working-directory: test_integrations/tracing/svelte_mini
86+
run: |
87+
SENTRY_E2E_SVELTE_APP_PORT=4001 npm run dev &
88+
echo $! > /tmp/svelte.pid
89+
echo "Svelte server started with PID $(cat /tmp/svelte.pid)"
90+
91+
- name: Wait for Phoenix server
92+
run: |
93+
echo "Waiting for Phoenix server at http://localhost:4000/health..."
94+
timeout 60 bash -c 'until curl -s http://localhost:4000/health > /dev/null 2>&1; do echo "Waiting..."; sleep 2; done'
95+
echo "Phoenix server is ready!"
96+
curl -s http://localhost:4000/health
97+
98+
- name: Wait for Svelte server
99+
run: |
100+
echo "Waiting for Svelte server at http://localhost:4001/health..."
101+
timeout 60 bash -c 'until curl -s http://localhost:4001/health > /dev/null 2>&1; do echo "Waiting..."; sleep 2; done'
102+
echo "Svelte server is ready!"
103+
curl -s http://localhost:4001/health
104+
105+
- name: Run Playwright tests
106+
working-directory: test_integrations/tracing
107+
env:
108+
SENTRY_E2E_PHOENIX_APP_URL: http://localhost:4000
109+
SENTRY_E2E_SVELTE_APP_URL: http://localhost:4001
110+
SENTRY_E2E_SERVERS_RUNNING: "true"
111+
run: npx playwright test --reporter=list
112+
113+
- name: Upload Playwright report
114+
uses: actions/upload-artifact@v4
115+
if: failure()
116+
with:
117+
name: playwright-report
118+
path: test_integrations/tracing/playwright-report/
119+
retention-days: 7
120+
121+
- name: Upload test screenshots
122+
uses: actions/upload-artifact@v4
123+
if: failure()
124+
with:
125+
name: test-screenshots
126+
path: test_integrations/tracing/test-results/
127+
retention-days: 7
128+
129+
- name: Show Phoenix server logs
130+
if: failure()
131+
run: |
132+
echo "=== Sentry debug events log ==="
133+
cat test_integrations/phoenix_app/tmp/sentry_debug_events.log 2>/dev/null || echo "No events logged"
134+
135+
- name: Cleanup servers
136+
if: always()
137+
run: |
138+
[ -f /tmp/phoenix.pid ] && kill $(cat /tmp/phoenix.pid) 2>/dev/null || true
139+
[ -f /tmp/svelte.pid ] && kill $(cat /tmp/svelte.pid) 2>/dev/null || true

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ jobs:
117117
run: mix test
118118

119119
- name: Run integration tests
120+
env:
121+
SKIP_TRACING_E2E: "true"
120122
run: mix test.integrations
121123

122124
- name: Cache Dialyzer PLT

0 commit comments

Comments
 (0)