Skip to content

Commit 94588fd

Browse files
author
Luca Forstner
committed
test
1 parent 5ac833a commit 94588fd

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Link from 'next/link';
2+
3+
export default function Page() {
4+
return (
5+
<Link prefetch id="prefetch-link" href="/prefetching/to-be-prefetched">
6+
link
7+
</Link>
8+
);
9+
}
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</p>;
3+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { expect, test } from '@playwright/test';
2+
import { waitForTransaction } from '@sentry-internal/test-utils';
3+
4+
test('Prefetch client spans should have the right op', async ({ page }) => {
5+
const pageloadTransactionPromise = waitForTransaction('nextjs-15', async transactionEvent => {
6+
return transactionEvent?.transaction === '/prefetching';
7+
});
8+
9+
await page.goto(`/prefetching`);
10+
11+
// Make it more likely that nextjs prefetches
12+
await page.hover('#prefetch-link');
13+
14+
expect((await pageloadTransactionPromise).spans).toContainEqual(
15+
expect.objectContaining({
16+
op: 'http.client.prefetch',
17+
}),
18+
);
19+
});

0 commit comments

Comments
 (0)