Skip to content
Merged
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 @@ -14,12 +14,23 @@ test('Sends a pageload transaction to Sentry', async ({ page }) => {
});

test('Sends a navigation transaction to Sentry', async ({ page }) => {
// Wait for the initial pageload transaction first. This ensures the client SDK and
// Remix router are fully hydrated before we click the link. Clicking before hydration
// completes makes the `<Link>` behave like a plain anchor, triggering a full page
// navigation (a `pageload` transaction) instead of a client-side `navigation` one,
// which makes this test flaky.
const pageloadTransactionPromise = waitForTransaction('remix-hydrogen', transactionEvent => {
return transactionEvent.contexts?.trace?.op === 'pageload' && transactionEvent.transaction === '/';
});

const transactionPromise = waitForTransaction('remix-hydrogen', transactionEvent => {
return transactionEvent.contexts?.trace?.op === 'navigation' && transactionEvent.transaction === '/user/:id';
});

await page.goto('/');

await pageloadTransactionPromise;

const linkElement = page.locator('id=navigation');
await linkElement.click();

Expand Down
Loading