Skip to content

✅ 加固 UI 异步断言与 E2E 保存结果观察 - #1727

Open
cyfung1031 wants to merge 6 commits into
scriptscat:mainfrom
cyfung1031:codex/stabilize-ui-test-timeouts
Open

✅ 加固 UI 异步断言与 E2E 保存结果观察#1727
cyfung1031 wants to merge 6 commits into
scriptscat:mainfrom
cyfung1031:codex/stabilize-ui-test-timeouts

Conversation

@cyfung1031

@cyfung1031 cyfung1031 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

目的

修正 PR #1727 中两层测试在 #1532 合并后出现的异步观察偏差,并把可重复执行的约束写入 agent 文档和 ESLint 配置。

实际改动

  • 为 Testing Library 的 waitFor 交互、重复包装查询和固定休眠增加三个边界明确的 ESLint 规则及规则测试;交互/查询规则按真实导入绑定识别本地别名并尊重词法遮蔽,同名普通函数或对象不会误报;timer Promise 规则覆盖直接 resolver 回调,不提供自动修复。
  • 清理现有 UI 测试中的重复交互、waitFor(getBy*) 和无条件 timer,保留请求完成、拖拽监听器注册及有限负向观察窗口等真实契约。
  • 调整 E2E helper:保存成功只接受本次新增、与保存语义匹配的 success toast;执行前观察同类旧通知归零,避免自动卸载造成计数竞争;保存失败用例显式传入 { saveOutcome: "failure" },等待对应的 error toast。旧通知、任意 toast 和列表外壳都不能完成断言。
  • 补充 E2E 和测试文档,明确请求开始与操作完成、正向与负向结果、计时契约与任意休眠的区别;AGENTS.md 要求修改测试、helper 或 runner 前走测试规范路由并建模成功/失败两种结果。
  • 为 WebSocket action 的有限观察窗口保留逐处 timer 豁免,并记录其清理监听器、传播超时失败的契约。
  • 修正测试运行文档中与实际配置不符的 worker 描述。

CI 失败修正

CI shard 2 的 user-config-yaml.spec.ts 失败原因是恶意 __proto__ 配置本应触发保存失败,但 helper 无条件等待成功通知。当前用例显式等待失败信号,并在重建后的本地完整 E2E 与 CI 中通过。

验证

  • ESLint 规则 harness:33 tests passed。
  • 相关 UI 定向测试:84 tests passed;完整 UI project:196 files / 1484 tests passed。
  • coverage 分片 1:182 files / 2212 tests passed;分片 2 passed。
  • pnpm run typecheck、Prettier、完整 ESLint、i18n/issue-template checks、pnpm run build passed。
  • 目标 E2E:user-config-yaml.spec.ts 2/2 passed。
  • 完整本地 Playwright:64 tests 首次 63 passed;唯一 GM_xhr 的 138 项内嵌测试中有一次 abort onloadend 观察窗口波动。隔离重跑该用例(含一次 retry)通过,138/138。
  • 提交 6e064871 的 CI:Lint、Vitest 两分片、E2E 四分片、Run tests、Codecov、FOSSA 全部通过。

@cyfung1031 cyfung1031 changed the title test: stabilize heavy network rules UI cases test: isolate UI files and await observable state Sep 4, 2026
@cyfung1031 cyfung1031 changed the title test: isolate UI files and await observable state ✅ 使用可观察状态同步网络规则 UI 测试 Sep 5, 2026
@cyfung1031 cyfung1031 changed the title ✅ 使用可观察状态同步网络规则 UI 测试 ✅ 加固 UI 异步断言与 E2E 保存结果观察 Sep 5, 2026
@cyfung1031
cyfung1031 marked this pull request as draft September 5, 2026 02:39
@cyfung1031

Copy link
Copy Markdown
Collaborator Author

astra 烧了整个上午的token. 下午做最终审查后改回正式PR

@cyfung1031
cyfung1031 marked this pull request as ready for review September 5, 2026 05:17
@cyfung1031 cyfung1031 added the P1 🔥 重要但是不紧急的内容 label Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 🔥 重要但是不紧急的内容

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant