a6cc190751
P1b Task 9: apps/admin based on art-design-pro v3.0.2 (tag, commit d224dd4; source recorded in apps/admin/SOURCE.md), trimmed to layout/login/i18n/request/table-form core. Login wired to real POST /v1/auth/password (single-token session), Bearer header on all requests, 401 interceptor logout+redirect, request-driven sliding renewal (refresh at ~80% TTL, single-flight), best-effort POST /v1/auth/logout on user-menu logout. One protected stub page (相册管理). Dev port 5176 strictPort + /v1 proxy to 8080. Admin keeps its own eslint9 flat config; root eslint ignores apps/admin/**. vitest unit tests for renewal pacing + Playwright e2e (guard redirect, localized wrong-password error, login lands on stub, token persists across reload, logout clears session). Co-Authored-By: Claude Code <noreply@anthropic.com>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test'
|
||
|
||
// 同 apps/viewer 约定:webServer 先等 API(8080,仓库根 `pnpm dev:api` 构建+启动,
|
||
// 已在跑的实例直接复用),再等 admin dev(5176,/v1 代理 → 8080)。
|
||
// globalSetup 幂等种子管理员(services/api seed:ADMIN_ACCOUNT/ADMIN_PASSWORD,
|
||
// 账号已存在则跳过且不改写密码)。compose 基础设施需预先 `docker compose up -d`。
|
||
export default defineConfig({
|
||
testDir: './e2e',
|
||
timeout: 60_000,
|
||
// dev server 首次按需编译 + 动态路由初始化较慢,放宽断言超时(默认 5s 偏紧)
|
||
expect: { timeout: 20_000 },
|
||
fullyParallel: true,
|
||
reporter: [['list']],
|
||
use: {
|
||
baseURL: 'http://127.0.0.1:5176',
|
||
trace: 'on-first-retry'
|
||
},
|
||
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
|
||
globalSetup: './e2e/global-setup.ts',
|
||
webServer: [
|
||
{
|
||
command: 'pnpm dev:api',
|
||
cwd: '../..',
|
||
url: 'http://127.0.0.1:8080/v1/health',
|
||
reuseExistingServer: true,
|
||
timeout: 180_000 // 首次含 tsc 全量构建
|
||
},
|
||
{
|
||
command: 'pnpm run dev',
|
||
url: 'http://127.0.0.1:5176',
|
||
reuseExistingServer: true,
|
||
timeout: 120_000 // 首次含依赖预构建
|
||
}
|
||
]
|
||
})
|