Skip to content

Commit a0d52d7

Browse files
committed
Add e2e test
1 parent 8596086 commit a0d52d7

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { expect, test } from '@playwright/test';
2+
import { waitForTransaction } from '@sentry-internal/test-utils';
3+
4+
// we have more thorough tests for tanstack-router in a separate e2e test
5+
// so here we just do a basic check to verify that the integration is automatically enabled if tracing is enabled
6+
test('sends a pageload transaction', async ({ page }) => {
7+
const transactionPromise = waitForTransaction('tanstackstart-react', async transactionEvent => {
8+
console.log('transactionEvent', transactionEvent);
9+
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
10+
});
11+
12+
await page.goto(`/`);
13+
14+
const rootSpan = await transactionPromise;
15+
16+
expect(rootSpan).toMatchObject({
17+
contexts: {
18+
trace: {
19+
data: {
20+
'sentry.source': 'route',
21+
'sentry.origin': 'auto.pageload.react.tanstackstart_react',
22+
'sentry.op': 'pageload',
23+
},
24+
op: 'pageload',
25+
origin: 'auto.pageload.react.tanstackstart_react',
26+
},
27+
},
28+
transaction: '/',
29+
transaction_info: {
30+
source: 'route',
31+
},
32+
spans: expect.arrayContaining([
33+
expect.objectContaining({
34+
description: 'loading-home',
35+
}),
36+
]),
37+
});
38+
});

0 commit comments

Comments
 (0)