This commit is contained in:
@@ -132,10 +132,12 @@ const dashboard = {
|
||||
};
|
||||
|
||||
async function installFixture(page: Page) {
|
||||
const requests = { setupStatus: 0 };
|
||||
await page.route('**/api/v1/**', async (route: Route) => {
|
||||
const request = route.request();
|
||||
const pathname = new URL(request.url()).pathname;
|
||||
if (pathname === '/api/v1/setup/status') {
|
||||
requests.setupStatus += 1;
|
||||
await route.fulfill({ json: { data: { required: false, locked: true } } });
|
||||
return;
|
||||
}
|
||||
@@ -153,6 +155,7 @@ async function installFixture(page: Page) {
|
||||
}
|
||||
await route.fulfill({ json: { data: [], meta: { page: 1, size: 20, totalElements: 0, totalPages: 0 } } });
|
||||
});
|
||||
return requests;
|
||||
}
|
||||
|
||||
test('hybrid dashboard renders the cockpit, safe fallback and big-screen mode', async ({ page }) => {
|
||||
@@ -173,3 +176,15 @@ test('hybrid dashboard renders the cockpit, safe fallback and big-screen mode',
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByRole('button', { name: '进入大屏' })).toBeVisible();
|
||||
});
|
||||
|
||||
test('installed setup status is reused across authenticated route navigation', async ({ page }) => {
|
||||
const requests = await installFixture(page);
|
||||
await page.goto('/dashboard');
|
||||
await expect(page.getByRole('heading', { name: '系统经营仪表盘', exact: true })).toBeVisible();
|
||||
|
||||
await page.getByText('系统治理', { exact: true }).click();
|
||||
await page.getByText('权限与配置', { exact: true }).click();
|
||||
await expect(page).toHaveURL(/\/governance\/settings$/);
|
||||
|
||||
expect(requests.setupStatus).toBe(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user