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 @@ -8,22 +8,15 @@ Sentry.init({
environment: 'qa', // dynamic sampling bias to keep transactions
// Could not find a working way to set the DSN in the browser side from the environment variables
dsn: 'https://public@dsn.ingest.sentry.io/1337',
debug: true,
integrations: [
Sentry.browserTracingIntegration({
useEffect,
useLocation,
useMatches,
}),
Sentry.replayIntegration({
maskAllText: true,
blockAllMedia: true,
}),
],

tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
tunnel: 'http://localhost:3031/', // proxy server
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForError, waitForTransaction } from '@sentry-internal/test-utils';

test('Sends a client-side exception to Sentry', async ({ page }) => {
// The pageload transaction only completes once the client SDK and Remix have hydrated.
// Awaiting it before clicking guarantees the button's onClick handler is attached — a click
// that lands before hydration would do nothing, and the exception would never be captured.
const pageloadTransactionPromise = waitForTransaction('remix-hydrogen', transactionEvent => {
return transactionEvent.contexts?.trace?.op === 'pageload' && transactionEvent.transaction === '/';
});

const errorPromise = waitForError('remix-hydrogen', errorEvent => {
return errorEvent.exception?.values?.[0].value === 'I am an error!';
});

await page.goto('/');

await pageloadTransactionPromise;

const exceptionButton = page.locator('id=exception-button');
await exceptionButton.click();

Expand Down
Loading