@@ -491,7 +491,55 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
491491 } ) ;
492492 } ) ;
493493
494- it ( 'works with descendant wildcard routes' , ( ) => {
494+ it ( 'works with descendant wildcard routes - pageload' , ( ) => {
495+ const client = createMockBrowserClient ( ) ;
496+ setCurrentClient ( client ) ;
497+
498+ client . addIntegration (
499+ reactRouterV6BrowserTracingIntegration ( {
500+ useEffect : React . useEffect ,
501+ useLocation,
502+ useNavigationType,
503+ createRoutesFromChildren,
504+ matchRoutes,
505+ } ) ,
506+ ) ;
507+ const SentryRoutes = withSentryReactRouterV6Routing ( Routes ) ;
508+
509+ const ProjectsRoutes = ( ) => (
510+ < SentryRoutes >
511+ < Route path = ":projectId" element = { < div > Project Page</ div > } >
512+ < Route index element = { < div > Project Page Root</ div > } />
513+ < Route element = { < div > Editor</ div > } >
514+ < Route path = "*" element = { < Outlet /> } >
515+ < Route path = "views/:viewId" element = { < div > View Canvas</ div > } />
516+ </ Route >
517+ </ Route >
518+ </ Route >
519+ < Route path = "*" element = { < div > No Match Page</ div > } />
520+ </ SentryRoutes >
521+ ) ;
522+
523+ render (
524+ < MemoryRouter initialEntries = { [ '/projects/foo/views/bar' ] } >
525+ < SentryRoutes >
526+ < Route path = "projects/*" element = { < ProjectsRoutes /> } > </ Route >
527+ </ SentryRoutes >
528+ </ MemoryRouter > ,
529+ ) ;
530+
531+ expect ( mockStartBrowserTracingPageLoadSpan ) . toHaveBeenCalledTimes ( 1 ) ;
532+ expect ( mockStartBrowserTracingPageLoadSpan ) . toHaveBeenLastCalledWith ( expect . any ( BrowserClient ) , {
533+ name : '/projects/:projectId/views/:viewId' ,
534+ attributes : {
535+ [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'route' ,
536+ [ SEMANTIC_ATTRIBUTE_SENTRY_OP ] : 'pageload' ,
537+ [ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ] : 'auto.pageload.react.reactrouter_v6' ,
538+ } ,
539+ } ) ;
540+ } ) ;
541+
542+ it ( 'works with descendant wildcard routes - navigation' , ( ) => {
495543 const client = createMockBrowserClient ( ) ;
496544 setCurrentClient ( client ) ;
497545
0 commit comments