test(dashboard): wait for saved answer hydration on reload - #5048
Conversation
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
#5047 修复源码断言后,远端 Dashboard 验收仍在独立答复页的刷新步骤报错。旧测试把 networkidle 当成已保存消息完成加载,随后立即数表格;React 的异步读取尚未完成时,零张表格被误报为内容丢失或 Turn 重放。这一 PR 的目标是恢复可信的验收信号,同时保留真正的内容丢失和重复执行检查。产品运行代码没有变化。
改动思路
沿用现有 Playwright locator,在刷新后等待答复表格可见,再执行原来的“恰好一张表格”和 Turn 请求计数断言。等待有 15 秒上限;若读取持续失败,它仍会报错。这里没有新增任意 sleep、模拟 API 分支或产品状态,也没有删除原断言。浏览器场景仍从 Dashboard 的个人工作区 smoke 入口运行,检验真实页面上的加载态到已保存答复的转换。
具体改动
唯一新增行位于 answer-presentation.mjs 的第二次独立答复页刷新之后。它等待 .answer-report-content table 处于可见状态;紧接着保留精确表格数量和 api.turnRequests.length === originalTurnCount 的判断。originalTurnCount 仍在进入独立答复页前记录,等待不会重置计数,因此真实 Turn 重放仍会失败。这个改动仅调整测试观察时点,不改变页面、存储、接口或文案。
关键内容讲解
- 刷新后先等已保存 Markdown 的表格,明确“页面已完成异步读取”这一前提。
- 原有精确内容与不重放 Turn 的断言继续决定验收结果;超时只代表内容确实未在限定时间出现。
对主干的风险
风险是等待可能让测试多花少量时间,但它有固定上限,不会无限挂起,也不会把真实重放归为成功。之前的远端失败位置已定位在旧即时断言;Node 22 下全部 15 个个人工作区浏览器场景以及最新基线的针对性场景均通过,公开边界检查零错误,精确范围质量收据 cqr_179bae7640f589ae4208 有效,风险分级 premerge 通过且无跳过。远端 CI 仍须单独完成,不能把本地通过当成已合并的证明。
我的整体评价
在精确提交 4646b43d4ad7273dd9b46d09fd2e80393599e046 上给出 APPROVE。这是修复现有高价值浏览器验收的最小改动:维护了长期 CI 的可用性,用户可见行为保持不变。查过现有测试及同作者近期 PR,未发现新增重复 smoke 或以拆分制造产出;#5047 和本 PR 分别修复静态断言与之后暴露的浏览器时序问题。合并应再看当前远端验收与仓库 readiness。
English verdict: APPROVE - Head 4646b43; a bounded locator wait observes saved-answer hydration before the unchanged content and no-Turn-replay assertions. Node 22 full and focused browser smokes and premerge pass; remote CI remains a separate merge gate.
The dashboard browser acceptance run for #5047 still failed after the contract assertion fix. On the standalone saved-answer page, the reload check inspected the answer table immediately after
networkidle, while React could still be loading the saved chat message. The check reported content loss or Turn replay before either condition was established.Wait for the persisted answer table to become visible, then keep the existing exact-content and no-Turn-replay assertions. This changes only the browser smoke; the product loading state and saved-answer implementation are unchanged.
Validation: the complete personal-workspace smoke passed under Node 22 (15 browser scenarios), the answer-presentation scenario passed again on the rebased head, the changed-file public-boundary scan passed, quality receipt
cqr_179bae7640f589ae4208is valid, and risk-based premerge passed without skips. The related simplification is using Playwright's existing locator readiness at the asynchronous boundary; no fixture or sleep was added.