Skip to content

Commit

Permalink
Update e2e tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
onurtemizkan committed Dec 4, 2024
1 parent bcb1cc7 commit 586129a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,23 @@ Sentry.init({

const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes);


const DetailsRoutes = () => (
<SentryRoutes>
<Route path=":detailId" element={<div id="details">Details</div>} />
</SentryRoutes>
);

const ViewsRoutes = () => (
<SentryRoutes>
<Route index element={<div id="views">Views</div>} />
<Route path="views/:viewId/*" element={<DetailsRoutes />} />
</SentryRoutes>
);

const ProjectsRoutes = () => (
<SentryRoutes>
<Route path=":projectId" element={<div>Project Page</div>}>
<Route index element={<div>Project Page Root</div>} />
<Route element={<div>Editor</div>}>
<Route path="*" element={<Outlet />}>
<Route path="views/:viewId" element={<div>View Canvas</div>} />
</Route>
</Route>
</Route>
<Route path="projects/:projectId/*" element={<ViewsRoutes />}></Route>
<Route path="*" element={<div>No Match Page</div>} />
</SentryRoutes>
);
Expand All @@ -62,7 +69,7 @@ root.render(
<BrowserRouter>
<SentryRoutes>
<Route path="/" element={<Index />} />
<Route path="projects/*" element={<ProjectsRoutes />}></Route>
<Route path="/*" element={<ProjectsRoutes />}></Route>
</SentryRoutes>
</BrowserRouter>,
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
const Index = () => {
return (
<>
<Link to="/projects/123/views/456" id="navigation">
<Link to="/projects/123/views/456/789" id="navigation">
navigate
</Link>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) =
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

await page.goto(`/projects/123/views/234`);
await page.goto(`/projects/123/views/234/567`);

const rootSpan = await transactionPromise;

Expand All @@ -17,7 +17,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) =
origin: 'auto.pageload.react.reactrouter_v6',
},
},
transaction: '/projects/:projectId/views/:viewId',
transaction: '/projects/:projectId/views/:viewId/:detailId',
transaction_info: {
source: 'route',
},
Expand Down Expand Up @@ -59,7 +59,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page })
origin: 'auto.navigation.react.reactrouter_v6',
},
},
transaction: '/projects/:projectId/views/:viewId',
transaction: '/projects/:projectId/views/:viewId/:detailId',
transaction_info: {
source: 'route',
},
Expand Down

0 comments on commit 586129a

Please sign in to comment.