diff --git a/dev-packages/e2e-tests/test-applications/remix-hydrogen/app/entry.client.tsx b/dev-packages/e2e-tests/test-applications/remix-hydrogen/app/entry.client.tsx index 82d9ae571fe1..6b9287e6f709 100644 --- a/dev-packages/e2e-tests/test-applications/remix-hydrogen/app/entry.client.tsx +++ b/dev-packages/e2e-tests/test-applications/remix-hydrogen/app/entry.client.tsx @@ -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 }); diff --git a/dev-packages/e2e-tests/test-applications/remix-hydrogen/tests/client-errors.test.ts b/dev-packages/e2e-tests/test-applications/remix-hydrogen/tests/client-errors.test.ts index 747ce8677afb..531bfd82f3f0 100644 --- a/dev-packages/e2e-tests/test-applications/remix-hydrogen/tests/client-errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/remix-hydrogen/tests/client-errors.test.ts @@ -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();