Skip to content

Commit 17f7480

Browse files
committed
test: added webvitals test
1 parent 183d552 commit 17f7480

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,47 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) =
3535
});
3636
});
3737

38+
test('sends pageload transaction with web vitals measurements', async ({ page }) => {
39+
const transactionPromise = waitForTransaction('tanstack-router', async transactionEvent => {
40+
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
41+
});
42+
43+
await page.goto(`/`);
44+
45+
const transaction = await transactionPromise;
46+
47+
expect(transaction).toMatchObject({
48+
contexts: {
49+
trace: {
50+
op: 'pageload',
51+
origin: 'auto.pageload.react.tanstack_router',
52+
},
53+
},
54+
transaction: '/',
55+
transaction_info: {
56+
source: 'route',
57+
},
58+
measurements: expect.objectContaining({
59+
ttfb: expect.objectContaining({
60+
value: expect.any(Number),
61+
unit: 'millisecond',
62+
}),
63+
lcp: expect.objectContaining({
64+
value: expect.any(Number),
65+
unit: 'millisecond',
66+
}),
67+
fp: expect.objectContaining({
68+
value: expect.any(Number),
69+
unit: 'millisecond',
70+
}),
71+
fcp: expect.objectContaining({
72+
value: expect.any(Number),
73+
unit: 'millisecond',
74+
}),
75+
}),
76+
});
77+
});
78+
3879
test('sends a navigation transaction with a parameterized URL', async ({ page }) => {
3980
const pageloadTxnPromise = waitForTransaction('tanstack-router', async transactionEvent => {
4081
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';

0 commit comments

Comments
 (0)