diff --git a/waspc/data/Generator/templates/react-app/src/router.tsx b/waspc/data/Generator/templates/react-app/src/router.tsx index ba4a2442c7..534e1f5132 100644 --- a/waspc/data/Generator/templates/react-app/src/router.tsx +++ b/waspc/data/Generator/templates/react-app/src/router.tsx @@ -26,6 +26,14 @@ export const routeNameToRouteComponent = { } as const; export function RouterRoutes() { + const waspDefinedRoutes = [ + {=# isExternalAuthEnabled =} + { + path: "{= oAuthCallbackPath =}", + element: + }, + {=/ isExternalAuthEnabled =} + ] const userDefinedRoutes = Object.entries(routes).map(([routeKey, route]) => { const Component = routeNameToRouteComponent[routeKey] return { @@ -34,17 +42,12 @@ export function RouterRoutes() { } }) const routerRoutes = useRoutes([ - {=# isExternalAuthEnabled =} /* Wasp specific routes *must* go first to prevent user defined routes from overriding them. Details in https://github.com/wasp-lang/wasp/issues/2029 */ - { - path: "{= oAuthCallbackPath =}", - element: - }, - {=/ isExternalAuthEnabled =} + ...waspDefinedRoutes, ...userDefinedRoutes, ]) diff --git a/waspc/headless-test/tests/simple.spec.ts b/waspc/headless-test/tests/simple.spec.ts index ad0188257b..637310fff4 100644 --- a/waspc/headless-test/tests/simple.spec.ts +++ b/waspc/headless-test/tests/simple.spec.ts @@ -53,6 +53,7 @@ test.describe("signup and login", () => { await page.goto("/"); + // Create a new task const randomTask = `New Task ${Math.random().toString(36).substring(7)}`; await page.locator("input[type='text']").fill(randomTask); await page.getByText("Create new task").click(); @@ -61,5 +62,10 @@ test.describe("signup and login", () => { await page.waitForSelector(`text=${fullTaskText}`); await expect(page.locator("body")).toContainText(fullTaskText); + + // Navigate to task page + await page.locator(`text=${fullTaskText}`).click(); + const taskPageText = `description: ${randomTask}`; + await page.waitForSelector(`text=${taskPageText}`); }); });