Files
photo-live/apps/admin/playwright.config.ts
T
浅念 0238f505c4 feat(admin): embed slot management with code snippet
P4b Task 5:/system/embed-slots 管理页(Task 8/9 页面模式:useCursorList
游标累积 + 对话框治理)。列表(名称/绑定相册/启停/configVersion/更新时间,
启停开关行内 PATCH → configVersion+1 toast 提示)+ 新建/编辑对话框
(设置表单位置/尺寸/间隔/语言/默认收起,intervalMs 契约区间夹取;编辑按
整体替换语义提交完整 settings)+ 绑定相册对话框(相册标题/ID 搜索选中 →
确认框携带 A22 文案「configVersion 将递增,官网无需改动」;清空即解绑)+
嵌入代码卡({EMBED_ORIGIN}/embed/v1/loader.js + data-slot 令牌,一键复制;
EMBED_ORIGIN=VITE_EMBED_ORIGIN 缺省本机 viewer dev,.env.example 登记)。

- API 层 src/api/embedSlots.ts + types/api/embedSlot.d.ts(契约镜像)
- vitest 9 例:表单→载荷(缺省+夹取)、编辑载荷收敛、snippet 拼接、
  环境基址兜底、绑定变更分类、zh/en 键一致 + A22 短语断言
- Playwright e2e(真实 cn+ov 后端):新建→绑定(gov-photos 直种 +
  seed-fixture 新增 sync-flush 模式经 bootstrap/真实发送管线投影 photos_ov)
  →嵌入代码卡含 token→ov 公开 feed 返回相册照片→换绑 configVersion+1 +
  feed 切换(A22)→停用 feed 404;admin playwright 配置补 ov webServer
- i18n zh/en(embedSlotsManage.* + menus.system.embedSlots)

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-20 23:25:59 +08:00

45 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig, devices } from '@playwright/test'
// 同 apps/viewer 约定:webServer 先等 cn API(8080,仓库根 `pnpm dev:api` 构建+
// 启动,已在跑的实例直接复用),再等 ov API(8081,`pnpm dev:ov`——P4b Task 5
// 展示位 e2e 断言公开嵌入 feed 读 ov 副本端点),再等 admin dev(5176,
// /v1 代理 → 8080)。globalSetup 幂等种子管理员(services/api seed:
// ADMIN_ACCOUNT/ADMIN_PASSWORD,账号已存在则跳过且不改写密码)。compose 基础
// 设施(MySQL/MinIO/Redis×2)需预先 `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 dev:ov',
cwd: '../..',
url: 'http://127.0.0.1:8081/v1/health',
reuseExistingServer: true,
timeout: 180_000 // 复用同一构建产物,首次仍可能全量构建
},
{
command: 'pnpm run dev',
url: 'http://127.0.0.1:5176',
reuseExistingServer: true,
timeout: 120_000 // 首次含依赖预构建
}
]
})