Skip to content

Commit 022caf9

Browse files
authored
test(e2e): Create event dumps for all Next.js test apps (#14034)
- create dumps for all nextjs apps - wipe old dumps when testing - bump timeouts we experience in other branches too
1 parent 7e39d04 commit 022caf9

File tree

10 files changed

+41
-9
lines changed

10 files changed

+41
-9
lines changed

.github/workflows/build.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1018,12 +1018,12 @@ jobs:
10181018

10191019
- name: Build E2E app
10201020
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1021-
timeout-minutes: 5
1021+
timeout-minutes: 7
10221022
run: pnpm ${{ matrix.build-command || 'test:build' }}
10231023

10241024
- name: Run E2E test
10251025
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1026-
timeout-minutes: 5
1026+
timeout-minutes: 10
10271027
run: pnpm test:assert
10281028

10291029
- name: Upload Playwright Traces
@@ -1039,7 +1039,7 @@ jobs:
10391039
uses: actions/upload-artifact@v4
10401040
if: always()
10411041
with:
1042-
name: playwright-event-dumps-job_e2e_playwright_tests-${{ matrix.test-application }}
1042+
name: e2e-test-event-dumps
10431043
path: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/event-dumps
10441044
overwrite: true
10451045
retention-days: 7
@@ -1176,12 +1176,12 @@ jobs:
11761176

11771177
- name: Build E2E app
11781178
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1179-
timeout-minutes: 5
1179+
timeout-minutes: 7
11801180
run: pnpm ${{ matrix.build-command || 'test:build' }}
11811181

11821182
- name: Run E2E test
11831183
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1184-
timeout-minutes: 5
1184+
timeout-minutes: 10
11851185
run: pnpm ${{ matrix.assert-command || 'test:assert' }}
11861186

11871187
- name: Deploy Astro to Cloudflare
@@ -1282,12 +1282,12 @@ jobs:
12821282

12831283
- name: Build E2E app
12841284
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1285-
timeout-minutes: 5
1285+
timeout-minutes: 7
12861286
run: yarn ${{ matrix.build-command || 'test:build' }}
12871287

12881288
- name: Run E2E test
12891289
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
1290-
timeout-minutes: 5
1290+
timeout-minutes: 10
12911291
run: yarn test:assert
12921292

12931293
job_required_jobs_passed:

.github/workflows/canary.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140

141141
- name: Build E2E app
142142
working-directory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
143-
timeout-minutes: 5
143+
timeout-minutes: 7
144144
run: yarn ${{ matrix.build-command }}
145145

146146
- name: Run E2E test

dev-packages/e2e-tests/test-applications/nextjs-13/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ next-env.d.ts
3838
!*.d.ts
3939

4040
test-results
41+
event-dumps
4142

4243
.vscode
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
import * as fs from 'fs';
2+
import * as path from 'path';
13
import { startEventProxyServer } from '@sentry-internal/test-utils';
24

5+
const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json')));
6+
37
startEventProxyServer({
48
port: 3031,
59
proxyServerName: 'nextjs-13',
10+
envelopeDumpPath: path.join(
11+
process.cwd(),
12+
`event-dumps/next-13-v${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
13+
),
614
});

dev-packages/e2e-tests/test-applications/nextjs-14/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ next-env.d.ts
4343
.vscode
4444

4545
test-results
46+
event-dumps
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
import * as fs from 'fs';
2+
import * as path from 'path';
13
import { startEventProxyServer } from '@sentry-internal/test-utils';
24

5+
const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json')));
6+
37
startEventProxyServer({
48
port: 3031,
59
proxyServerName: 'nextjs-14',
10+
envelopeDumpPath: path.join(
11+
process.cwd(),
12+
`event-dumps/next-14-v${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
13+
),
614
});

dev-packages/e2e-tests/test-applications/nextjs-15/start-event-proxy.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ startEventProxyServer({
99
proxyServerName: 'nextjs-15',
1010
envelopeDumpPath: path.join(
1111
process.cwd(),
12-
`event-dumps/next-${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
12+
`event-dumps/next-15-v${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
1313
),
1414
});

dev-packages/e2e-tests/test-applications/nextjs-app-dir/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ next-env.d.ts
4343
.vscode
4444

4545
test-results
46+
event-dumps
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
import * as fs from 'fs';
2+
import * as path from 'path';
13
import { startEventProxyServer } from '@sentry-internal/test-utils';
24

5+
const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json')));
6+
37
startEventProxyServer({
48
port: 3031,
59
proxyServerName: 'nextjs-app-dir',
10+
envelopeDumpPath: path.join(
11+
process.cwd(),
12+
`event-dumps/next-app-dir-v${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
13+
),
614
});

dev-packages/test-utils/src/event-proxy-server.ts

+5
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ export async function startProxyServer(
171171
export async function startEventProxyServer(options: EventProxyServerOptions): Promise<void> {
172172
if (options.envelopeDumpPath) {
173173
await fs.promises.mkdir(path.dirname(path.resolve(options.envelopeDumpPath)), { recursive: true });
174+
try {
175+
await fs.promises.unlink(path.resolve(options.envelopeDumpPath));
176+
} catch {
177+
// noop
178+
}
174179
}
175180

176181
await startProxyServer(options, async (eventCallbackListeners, proxyRequest, proxyRequestBody, eventBuffer) => {

0 commit comments

Comments
 (0)