test(desktop): wait for ready WorkHub layout surface - #3963
Conversation
Generated-by: Codex
Astro-Han
left a comment
There was a problem hiding this comment.
Changes the readiness gate in apps/desktop/e2e/workhub-layout.spec.ts from the main landmark to the projected work count 1 项工作, so the test stops filling the Composer while the Coordination status surface is still resolving (#3961).
What I checked:
- The old locator
getByRole('main', { name: 'WorkHub' })becomes visible as soon as the shell mounts, which is strictly before the projection resolves. The new locator targetsworkCountfromworkhub-surface.tsx:625, which only renders once the projection has a count. So this is a strictly stronger gate, not a lateral move — it waits for the state the rest of the test actually depends on. - The assertion still fails if the WorkHub surface never appears, so no coverage is lost by dropping the landmark check; the count only renders inside that surface.
- The preceding block creates exactly one Session, so
1is the deterministic count rather than an incidental one. - A hard-coded Chinese string is consistent with this file, which already locates by
重新生成and fills支付回调幂等性.
Test-only, no product change. Approving.
AI use: Claude Code (Opus) traced the new locator to the workCount copy in workhub-surface.tsx and checked what the old landmark actually gated on. The stress-loop numbers are the author's, reported and not independently re-run. The reviewer of record reviewed and accepted this.
简体中文
把 apps/desktop/e2e/workhub-layout.spec.ts 的就绪判据从 main landmark 换成投影出来的工作计数 1 项工作,避免在 Coordination 状态面还在解析时就往 Composer 里填内容(#3961)。
核对了四点:
- 旧的
getByRole('main', { name: 'WorkHub' })在外壳挂载时就可见,严格早于投影完成;新定位指向workhub-surface.tsx:625的workCount,只有拿到计数才渲染。所以这是更强的判据,不是平移——它等的正是后续步骤真正依赖的状态。 - WorkHub 面若始终不出现,断言仍会失败,去掉 landmark 检查没有损失覆盖,因为计数只在该面内渲染。
- 前一段只创建了一个 Session,所以
1是确定值而非偶然值。 - 硬编码中文串与本文件既有风格一致(已有
重新生成、支付回调幂等性)。
纯测试改动,无产品行为变化。Approve。
Summary
Wait for the ready WorkHub surface's exact
1 项工作projection before filling and submitting through its Composer. This prevents the layout E2E from treating the resolving Coordination status surface as submission-ready while preserving the existing result and non-overlap assertions.Closes #3961
Verification
--repeat-each=60 --workers=4)--repeat-each=20 --workers=1)npx biome check apps/desktop/e2e/workhub-layout.spec.tsnpm --workspace @maka/desktop run typecheckAI use
Select exactly one:
Tool(s) and scope: Codex analyzed and reproduced the race, implemented the E2E synchronization change, and ran verification.
Checklist
Does this PR entail a change in behavior?