Skip to content

test(e2e): Create event dumps for all Next.js test apps #14034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading