fix(e2e): mock /api/setup/status to prevent redirect to /setup
The app's App.tsx calls /api/setup/status after auth resolution when
authDisabled=true and a dev user is present. If this endpoint is not
mocked, the browser's network request to the live dev API returns a
200 with needsSetup:true, triggering a redirect to /setup before the
test content can render.
This caused the "no services available" and "clients page" tests to
fail with element not found, since the SetupWizard page was shown
instead of the admin book/clients pages.
Added mock for /api/setup/status in fixtures.ts returning
{needsSetup:false} to match the existing mocking strategy for other
dev-mode API endpoints.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -43,6 +43,10 @@ export const test = base.extend({
|
||||
},
|
||||
})
|
||||
);
|
||||
// Mock the setup status endpoint so the app does not redirect to /setup
|
||||
await page.route("**/api/setup/status", (route) =>
|
||||
route.fulfill({ json: { needsSetup: false } })
|
||||
);
|
||||
// Seed localStorage as a fallback in case the mock is bypassed
|
||||
await page.addInitScript(() => {
|
||||
localStorage.setItem(
|
||||
|
||||
Reference in New Issue
Block a user