Files
prompt-optimizer/tests/e2e/regression/root-route-bootstrap.spec.ts
linshen 40e1005d81 test(e2e): stabilize route bootstrap and output polling
- Reduce output polling flakes\n- Stabilize route bootstrap and smoke flows\n- Improve i18n label compatibility (incl. zh-TW)
2026-01-18 22:56:00 +08:00

30 lines
1.0 KiB
TypeScript

import { test, expect } from '../fixtures'
async function waitForWorkspace(page: any, mode: string) {
const workspace = page
.locator(`[data-testid="workspace"][data-mode="${mode}"]`)
.first()
await expect(workspace).toBeVisible({ timeout: 45000 })
}
test.describe('Root route bootstrap', () => {
test('navigating to / redirects to default workspace', async ({ page }) => {
await page.goto('/')
await page.waitForLoadState('networkidle')
// In a clean test DB, global-settings defaults to basic/system.
await waitForWorkspace(page, 'basic-system')
})
test('explicit navigation is not overridden by bootstrap redirect', async ({ page }) => {
await page.goto('/')
await page.waitForLoadState('networkidle')
// Immediately navigate to a non-root route; bootstrap logic must not replace it back.
await page.goto('/#/image/text2image')
await page.waitForLoadState('networkidle')
await expect(page).toHaveURL(/#\/image\/text2image/)
await waitForWorkspace(page, 'image-text2image')
})
})