perf: optimize dashboard loading and production assets
Release / release (push) Canceled after 0s

This commit is contained in:
Qiufeng
2026-08-19 15:34:11 +08:00
parent 12d78b4c86
commit 83f1bf82d6
17 changed files with 355 additions and 48 deletions
+15
View File
@@ -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);
});