Skip to content

Commit

Permalink
test(e2e): Create event dumps for all Next.js test apps (#14034)
Browse files Browse the repository at this point in the history
- create dumps for all nextjs apps
- wipe old dumps when testing
- bump timeouts we experience in other branches too
  • Loading branch information
lforst authored Oct 22, 2024
1 parent 7e39d04 commit 022caf9
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 9 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1018,12 +1018,12 @@ jobs:

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

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

- name: Upload Playwright Traces
Expand All @@ -1039,7 +1039,7 @@ jobs:
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-event-dumps-job_e2e_playwright_tests-${{ matrix.test-application }}
name: e2e-test-event-dumps
path: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/event-dumps
overwrite: true
retention-days: 7
Expand Down Expand Up @@ -1176,12 +1176,12 @@ jobs:

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

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

- name: Deploy Astro to Cloudflare
Expand Down Expand Up @@ -1282,12 +1282,12 @@ jobs:

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

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

job_required_jobs_passed:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:

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

- name: Run E2E test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ next-env.d.ts
!*.d.ts

test-results
event-dumps

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

const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json')));

startEventProxyServer({
port: 3031,
proxyServerName: 'nextjs-13',
envelopeDumpPath: path.join(
process.cwd(),
`event-dumps/next-13-v${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
),
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ next-env.d.ts
.vscode

test-results
event-dumps
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import * as fs from 'fs';
import * as path from 'path';
import { startEventProxyServer } from '@sentry-internal/test-utils';

const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json')));

startEventProxyServer({
port: 3031,
proxyServerName: 'nextjs-14',
envelopeDumpPath: path.join(
process.cwd(),
`event-dumps/next-14-v${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
),
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ startEventProxyServer({
proxyServerName: 'nextjs-15',
envelopeDumpPath: path.join(
process.cwd(),
`event-dumps/next-${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
`event-dumps/next-15-v${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
),
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ next-env.d.ts
.vscode

test-results
event-dumps
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import * as fs from 'fs';
import * as path from 'path';
import { startEventProxyServer } from '@sentry-internal/test-utils';

const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json')));

startEventProxyServer({
port: 3031,
proxyServerName: 'nextjs-app-dir',
envelopeDumpPath: path.join(
process.cwd(),
`event-dumps/next-app-dir-v${packageJson.dependencies.next}-${process.env.TEST_ENV}.dump`,
),
});
5 changes: 5 additions & 0 deletions dev-packages/test-utils/src/event-proxy-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ export async function startProxyServer(
export async function startEventProxyServer(options: EventProxyServerOptions): Promise<void> {
if (options.envelopeDumpPath) {
await fs.promises.mkdir(path.dirname(path.resolve(options.envelopeDumpPath)), { recursive: true });
try {
await fs.promises.unlink(path.resolve(options.envelopeDumpPath));
} catch {
// noop
}
}

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

0 comments on commit 022caf9

Please sign in to comment.