Skip to content

Commit ad6b021

Browse files
committed
revert: Revert Spotlight migration for react-router-7-lazy-routes
The Spotlight approach had a fundamental architecture issue: - Playwright's webServer spawns Spotlight as a separate process - Tests run in the Playwright test runner process - The event buffer in spotlight.ts only gets populated if startSpotlight() is called in the same process as the tests - Since they're different processes, the buffer is always empty Keeping spotlight.ts for future use but marking exports as experimental. The test app is reverted to use the original event proxy approach.
1 parent 6e7eb39 commit ad6b021

File tree

7 files changed

+85
-124
lines changed

7 files changed

+85
-124
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
22

33
const config = getPlaywrightConfig({
4-
useSpotlight: true,
4+
startCommand: `pnpm start`,
55
});
66

77
export default config;

dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/src/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,9 @@ function getRuntimeConfig(): { lazyRouteTimeout?: number; idleTimeout?: number }
5555

5656
const runtimeConfig = getRuntimeConfig();
5757

58-
// Use Spotlight DSN workaround - this makes the SDK send events directly to Spotlight
59-
// Spotlight runs on port 8969 by default and captures all Sentry events
60-
const SPOTLIGHT_DSN = 'http://spotlight@localhost:8969/0';
61-
6258
Sentry.init({
6359
environment: 'qa', // dynamic sampling bias to keep transactions
64-
dsn: SPOTLIGHT_DSN,
60+
dsn: process.env.REACT_APP_E2E_TEST_DSN,
6561
integrations: [
6662
Sentry.reactRouterV7BrowserTracingIntegration({
6763
useEffect: React.useEffect,
@@ -79,6 +75,8 @@ Sentry.init({
7975
// for finer control
8076
tracesSampleRate: 1.0,
8177
release: 'e2e-test',
78+
79+
tunnel: 'http://localhost:3031',
8280
});
8381

8482
const sentryCreateBrowserRouter = Sentry.wrapCreateBrowserRouterV7(createBrowserRouter);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { startEventProxyServer } from '@sentry-internal/test-utils';
2+
3+
startEventProxyServer({
4+
port: 3031,
5+
proxyServerName: 'react-router-7-lazy-routes',
6+
});

dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/timeout-behaviour.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { expect, test } from '@playwright/test';
2-
import { waitForSpotlightTransaction } from '@sentry-internal/test-utils';
2+
import { waitForTransaction } from '@sentry-internal/test-utils';
33

44
test('lazyRouteTimeout: Routes load within timeout window', async ({ page }) => {
5-
const transactionPromise = waitForSpotlightTransaction(async transactionEvent => {
5+
const transactionPromise = waitForTransaction('react-router-7-lazy-routes', async transactionEvent => {
66
return (
77
!!transactionEvent?.transaction &&
88
transactionEvent.contexts?.trace?.op === 'navigation' &&
@@ -27,7 +27,7 @@ test('lazyRouteTimeout: Routes load within timeout window', async ({ page }) =>
2727
});
2828

2929
test('lazyRouteTimeout: Infinity timeout always waits for routes', async ({ page }) => {
30-
const transactionPromise = waitForSpotlightTransaction(async transactionEvent => {
30+
const transactionPromise = waitForTransaction('react-router-7-lazy-routes', async transactionEvent => {
3131
return (
3232
!!transactionEvent?.transaction &&
3333
transactionEvent.contexts?.trace?.op === 'navigation' &&
@@ -51,7 +51,7 @@ test('lazyRouteTimeout: Infinity timeout always waits for routes', async ({ page
5151
});
5252

5353
test('idleTimeout: Captures all activity with increased timeout', async ({ page }) => {
54-
const transactionPromise = waitForSpotlightTransaction(async transactionEvent => {
54+
const transactionPromise = waitForTransaction('react-router-7-lazy-routes', async transactionEvent => {
5555
return (
5656
!!transactionEvent?.transaction &&
5757
transactionEvent.contexts?.trace?.op === 'navigation' &&
@@ -79,7 +79,7 @@ test('idleTimeout: Captures all activity with increased timeout', async ({ page
7979
});
8080

8181
test('idleTimeout: Finishes prematurely with low timeout', async ({ page }) => {
82-
const transactionPromise = waitForSpotlightTransaction(async transactionEvent => {
82+
const transactionPromise = waitForTransaction('react-router-7-lazy-routes', async transactionEvent => {
8383
return (
8484
!!transactionEvent?.transaction &&
8585
transactionEvent.contexts?.trace?.op === 'navigation' &&
@@ -107,7 +107,7 @@ test('idleTimeout: Finishes prematurely with low timeout', async ({ page }) => {
107107
});
108108

109109
test('idleTimeout: Pageload on deeply nested route', async ({ page }) => {
110-
const pageloadPromise = waitForSpotlightTransaction(async transactionEvent => {
110+
const pageloadPromise = waitForTransaction('react-router-7-lazy-routes', async transactionEvent => {
111111
return (
112112
!!transactionEvent?.transaction &&
113113
transactionEvent.contexts?.trace?.op === 'pageload' &&

0 commit comments

Comments
 (0)