Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ function HomePage(handle: Handle<Record<string, never>>) {
<a id="to-user" href="/users/12345">
User
</a>
<a id="to-user-prefetch-intent" href="/users/intent" data-rmx-prefetch="intent">
User (prefetch on intent)
</a>
<a id="to-user-prefetch-viewport" href="/users/viewport" data-rmx-prefetch="viewport">
User (prefetch in viewport)
</a>
<button type="button" id="component-error">
Component error
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"@sentry/remix": "file:../../packed/sentry-remix-packed.tgz",
"remix": "3.0.0"
"remix": "3.1.0"
},
"devDependencies": {
"@playwright/test": "1.64.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,37 @@ test('sends a navigation span for a link the runtime intercepts', async ({ page
expect(span.attributes?.['sentry.segment.name.source']?.value).toBe('route');
});

// The span is named by the navigation's own fetch, not the earlier prefetch.
for (const mode of ['intent', 'viewport'] as const) {
test(`names a navigation to a link prefetched on ${mode} by the route`, async ({ page }) => {
const prefetchPromise = page.waitForRequest(
request => request.url().endsWith(`/users/${mode}`) && request.headers()['x-remix-frame'] === 'true',
);

await page.goto('/');
const link = page.locator(`#to-user-prefetch-${mode}`);
if (mode === 'intent') {
await link.hover();
}
await (await prefetchPromise).response();

const spanPromise = waitForStreamedSpan(
APP_NAME,
span =>
getSpanOp(span) === 'navigation' &&
span.attributes?.['sentry.origin']?.value === 'auto.navigation.remix_v3' &&
span.attributes?.['url.path']?.value === `/users/${mode}`,
);

await link.click();
await expect(page.locator('#user')).toBeVisible();

const span = await spanPromise;
expect(span.name).toBe('/users/:id');
expect(span.attributes?.['sentry.segment.name.source']?.value).toBe('route');
});
}

test('names a navigation to a route it loaded before right at the start', async ({ page }) => {
await page.goto('/');
await page.locator('#to-user').click();
Expand Down
Loading