Skip to content

Commit a18e6cc

Browse files
committed
e2e tests
1 parent 1fe3285 commit a18e6cc

File tree

6 files changed

+29
-24
lines changed

6 files changed

+29
-24
lines changed
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import { HackComponentToRunSideEffectsInSentryClientConfig } from '../sentry.client.config';
2-
31
export default function Layout({ children }: { children: React.ReactNode }) {
42
return (
53
<html lang="en">
6-
<body>
7-
<HackComponentToRunSideEffectsInSentryClientConfig />
8-
{children}
9-
</body>
4+
<body>{children}</body>
105
</html>
116
);
127
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <p>Hello World!</p>;
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as Sentry from '@sentry/nextjs';
2+
3+
Sentry.init({
4+
environment: 'qa', // dynamic sampling bias to keep transactions
5+
dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN,
6+
tunnel: `http://localhost:3031/`, // proxy server
7+
tracesSampleRate: 1.0,
8+
sendDefaultPii: true,
9+
});

dev-packages/e2e-tests/test-applications/nextjs-turbo/pages/_app.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { AppProps } from 'next/app';
2-
import '../sentry.client.config';
32

43
export default function CustomApp({ Component, pageProps }: AppProps) {
54
return <Component {...pageProps} />;

dev-packages/e2e-tests/test-applications/nextjs-turbo/sentry.client.config.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { expect, test } from '@playwright/test';
2+
import { waitForTransaction } from '@sentry-internal/test-utils';
3+
4+
test('Should record pageload transactions (this test verifies that the client SDK is initialized)', async ({
5+
page,
6+
}) => {
7+
const pageloadTransactionPromise = waitForTransaction('nextjs-turbo', async transactionEvent => {
8+
return transactionEvent?.transaction === '/pageload-transaction';
9+
});
10+
11+
await page.goto(`/pageload-transaction`);
12+
13+
const pageloadTransaction = await pageloadTransactionPromise;
14+
15+
expect(pageloadTransaction).toBeDefined();
16+
});

0 commit comments

Comments
 (0)