git:20260609.e2e224a to git:20260611.9d7f5e4

24 added, 24 removed. Audit A to A.

---
name: fec-e2e-testing
- description: Use when creating, maintaining, debugging, or reviewing real-browser end-to-end tests with Playwright or Cypress, including Page Object models, CI artifacts, traces, flaky tests, cross-page visual regression, and critical user journeys such as login, payment, permissions, or CRUD. For layer planning or tests close to UI components, choose the matching testing workflow first; Chinese triggers include E2E, 端到端测试, Playwright, Cypress.
+ description: Use when creating, maintaining, debugging, or reviewing real-browser end-to-end tests with Playwright or Cypress, including Page Object models, CI artifacts, traces, flaky tests, cross-page visual regression, and critical user journeys such as login, payment, permissions, or CRUD. For layer planning or tests close to UI components, choose the matching testing workflow first; Chinese triggers include E2E, end-to-end testing, Playwright, Cypress.
---
- # E2E 测试规范
+ # E2E Test Specification
## Purpose
- 用真实浏览器验证关键用户旅程,发现单元测试无法覆盖的集成风险。
+ Validate key user journeys with real browsers and uncover integration risks not covered by unit tests.
## Procedure
- 1. 明确关键旅程:登录、购买、创建、搜索、权限、支付等跨页面流程优先;若只是选择测试层级,先做测试分层规划。
- 2. 新项目优先 Playwright;已有 Cypress 项目沿用 Cypress,不为迁移而迁移。
- 3. 用 Page Object 或 fixtures 封装登录、页面定位器和共享数据,spec 中避免裸选择器。
- 4. 断言用户可见结果,依赖 Locator 自动等待、网络响应或可见状态,不使用固定 sleep。
- 5. CI 必须上传 HTML report、截图、trace 或视频;flaky 用例要隔离、复现、标注来源并关联 issue。
- 6. 调试失败时先读 trace、console、network 和截图,再改测试;不要把真实产品缺陷误判成 flaky。
- 7. 对关键浏览器能力、支付、权限、上传和实时通信流程,记录测试环境、种子数据和清理策略。
- 8. 测试数据必须可重复:优先使用 API seed、数据库 fixture、测试账号或 mock 服务;随机数据需带唯一前缀并在 teardown 清理。
+ 1. Clarify the key journeys: cross-page processes such as login, purchase, creation, search, permissions, payment, etc. are given priority; if you only choose the test level, do the test hierarchical planning first.
+ 2. New projects will be given priority by Playwright; existing Cypress projects will continue to use Cypress and will not be migrated for the sake of migration.
+ 3. Use Page Object or fixtures to encapsulate login, page locator and shared data, and avoid naked selectors in the spec.
+ 4. Assert that the user can see the results, relying on Locator automatic waiting, network response or visible status, without using fixed sleep.
+ 5. CI must upload HTML report, screenshots, trace or video; Flaky use cases must be isolated, reproduced, marked with sources and associated with issues.
+ 6. When debugging fails, read the trace, console, network and screenshots first, and then change the test; do not misjudge real product defects as flaky.
+ 7. Record the test environment, seed data and cleanup strategies for key browser capabilities, payment, permissions, uploads and real-time communication processes.
+ 8. Test data must be repeatable: API seeds, database fixtures, test accounts or mock services are preferred; random data must have a unique prefix and be cleaned in teardown.
- ## 详细参考
+ ## Detailed reference
- - 需要目录结构、Page Object、spec 组织、配置、flaky 调试和产物示例时,加载 [references/playwright-patterns.md](references/playwright-patterns.md)。
- - 需要 CI 示例和 Markdown 报告模板时,加载 [references/e2e-ci-reporting.md](references/e2e-ci-reporting.md)。
- - 需要 Web3/钱包流程或高风险金融流程时,加载 [references/e2e-special-scenarios.md](references/e2e-special-scenarios.md)。
- - 需要跨页面截图或视觉回归配置时,加载 [references/e2e-visual-regression.md](references/e2e-visual-regression.md)。
+ - Load [references/playwright-patterns.md](references/playwright-patterns.md) when you need directory structure, Page Object, spec organization, configuration, flaky debugging and production examples.
+ - Load [references/e2e-ci-reporting.md](references/e2e-ci-reporting.md) when you need CI examples and Markdown report templates.
+ - Load [references/e2e-special-scenarios.md](references/e2e-special-scenarios.md) when Web3/wallet flows or high-risk financial flows are required.
+ - When cross-page screenshots or visual regression configuration are required, load [references/e2e-visual-regression.md](references/e2e-visual-regression.md).
## Constraints
- - 禁止依赖 `sleep` / 固定 `setTimeout` 作为主要同步手段。
- - 不在生产环境跑真实 E2E。
- - 避免在 E2E 中断言组件内部像素级样式;跨页面截图/视觉回归仅覆盖用户旅程中的关键页面状态。
- - 失败必须能靠截图、trace 或视频定位。
- - 组件内部契约测试分流到组件测试 workflow。
- - 不把不稳定等待、随机数据或依赖测试顺序带入 CI。
- - 不把重试次数当作 flaky 治理;重试只能保留证据,根因仍需定位。
+ - Disable reliance on `sleep` / fixed `setTimeout` as primary synchronization means.
+ - Do not run real E2E in production environment.
+ - Avoid asserting component internal pixel-level styles in E2E; cross-page screenshots/visual regressions only cover key page states in the user journey.
+ - Failure must be able to be located by taking screenshots, traces or videos.
+ - Component internal contract testing is offloaded to component testing workflow.
+ - Do not bring unstable waits, random data, or dependent test order into CI.
+ - Do not treat the number of retries as flaky management; retries can only retain evidence, and the root cause still needs to be located.
## Expected Output
- 关键用户旅程有稳定 E2E 覆盖,失败产物可定位问题,CI 中报告和 trace 可下载;flaky 用例有复现命令、隔离策略和后续 issue。
+ Key user journeys have stable E2E coverage, failed products can locate problems, and reports and traces in CI can be downloaded; flaky use cases include recurrence commands, isolation strategies, and follow-up issues.