Skip to content

Commit d6fe14c

Browse files
committed
chore(tests): add playwright for e2e testing
1 parent 831e79c commit d6fe14c

File tree

5 files changed

+187
-0
lines changed

5 files changed

+187
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ test_integrations/phoenix_app/db
1717

1818
test_integrations/*/_build
1919
test_integrations/*/deps
20+
test_integrations/*/test-results/

test_integrations/tracing/package-lock.json

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "tracing-e2e-tests",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"scripts": {
6+
"test": "playwright test",
7+
"test:debug": "playwright test --debug",
8+
"test:ui": "playwright test --ui"
9+
},
10+
"devDependencies": {
11+
"@playwright/test": "^1.48.0",
12+
"@types/node": "^22.19.2",
13+
"typescript": "^5.6.0"
14+
}
15+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { defineConfig, devices } from "@playwright/test";
2+
3+
const PHOENIX_URL =
4+
process.env.SENTRY_E2E_PHOENIX_APP_URL || "http://localhost:4000";
5+
const SVELTE_URL =
6+
process.env.SENTRY_E2E_SVELTE_APP_URL || "http://localhost:4001";
7+
8+
// When servers are started externally (e.g., in CI workflow steps), skip webServer config
9+
const serversRunningExternally = process.env.SENTRY_E2E_SERVERS_RUNNING === "true";
10+
11+
export default defineConfig({
12+
testDir: "./tests",
13+
fullyParallel: false,
14+
forbidOnly: !!process.env.CI,
15+
retries: process.env.CI ? 2 : 0,
16+
workers: 1,
17+
reporter: "list",
18+
19+
use: {
20+
baseURL: SVELTE_URL,
21+
trace: "on-first-retry",
22+
screenshot: "only-on-failure",
23+
},
24+
25+
projects: [
26+
{
27+
name: "chromium",
28+
use: {
29+
...devices["Desktop Chrome"],
30+
headless: true,
31+
},
32+
},
33+
],
34+
35+
// Skip webServer when servers are managed externally (better CI debugging)
36+
...(serversRunningExternally
37+
? {}
38+
: {
39+
webServer: [
40+
{
41+
command:
42+
'cd ../phoenix_app && rm -f tmp/sentry_debug_events.log && SENTRY_E2E_TEST_MODE=true mix phx.server',
43+
url: `${PHOENIX_URL}/health`,
44+
reuseExistingServer: true
45+
},
46+
{
47+
command:
48+
'cd svelte_mini && SENTRY_E2E_SVELTE_APP_PORT=4001 npm run dev',
49+
url: `${SVELTE_URL}/health`,
50+
reuseExistingServer: true
51+
},
52+
],
53+
}),
54+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"module": "ESNext",
5+
"moduleResolution": "Bundler",
6+
"strict": true,
7+
"esModuleInterop": true,
8+
"skipLibCheck": true,
9+
"types": ["node"]
10+
},
11+
"include": ["tests/**/*.ts", "playwright.config.ts"]
12+
}

0 commit comments

Comments
 (0)