用途:OPC-Starter 项目的测试驱动开发规范,覆盖单元测试、Playwright E2E 测试、演示模式测试与测试规划文档维护。
主要能力与用法: 单元测试 cd app && npm run test;E2E 全量 cd app && npm run test:e2e;认证专项 cd app && npm run test:e2e:auth;演示模式 cd app && npm run test:e2e:demo;UI 调试 cd app && npm run test:e2e:ui;查看报告 cd app && npm run test:e2e:report。
核心原则:新功能先写测试或完成后立即补充;演示测试独立维护在 tests/e2e/demo/,带打字机效果;可重复执行,注册测试用 Date.now() 生成唯一邮箱、beforeEach 清理状态;完成后更新 tests/TEST_PLAN.md。
目录结构:e2e/auth/ 含 login.spec.ts 与 register.spec.ts,demo/demo-auth.spec.ts,另有 dashboard、profile、persons、settings 等 fixme 用例;support/ 下有 fixtures 与 helpers(test-helpers.ts、demo-helpers.ts)。
新增页面/表单时按 P0–P2 优先级编写用例,并在 demo/ 目录同步演示用例。演示模板使用 demo-helpers 的 fillFormWithEffect、clickWithEffect、highlightElement 等函数,速度配置在 DEMO_CONFIG。测试文件结构为引入、测试数据、辅助函数、按优先级分组的套件。运行器配置见 app/playwright.config.ts,测试规划文档见 tests/TEST_PLAN.md。
限制:资料未提供具体依赖安装、运行环境版本、通过判定标准等细节,暂未提供。