Skip to content

sidebar-browser 焦点用例在 CI 上偶发失败 #346

Done

Description

@JJasonSun

dsh-electron/tests/sidebar-browser.test.mjs 中的 conversations working at once keep their own marker and the user's focus 在 CI 上偶发失败,与提交内容无关,重跑即过。

原因

两个对话同时点击后固定等待 200ms,再断言焦点回到消息输入框:

await Promise.all([pageA.getByRole('button', { name: 'Slow' }).click(), pageB.getByRole('button', { name: 'Greet' }).click()])
await wait(200)
assert.equal(await page('document.activeElement.id'), 'chat')

CI 机器负载高时 200ms 不够,焦点还没回来就断言,于是失败。

频次

2026-11-05 引入该用例(#250)以来,validate-pinned-dsh-source 共 195 次运行,161 次完整跑完,其中 4 次因它失败(约 2.5%),Windows 与 macOS 各 2 次,分布在 3 个不同分支:

运行 日期 环境 分支
43170141936 11-12 windows-latest chore/plugins-rc2-compat-20261112
43377817957 11-13 macos-26 feat/command-auto-approval
44708266442 11-20 windows-latest feat/windows-installed-layout
45136179270 11-23 macos-26 feat/windows-installed-layout(重跑通过)

同文件另两个用例 hidden tabs, a collapsed Sidebar and a conversation in the background keep working 和 the user only watches the tab the Agent acts on until its turn ends, asks them something or they stop it,在 11-14、11-19 也各有一次 macOS 失败,当时没有重跑确认,可能同源。

建议

把固定等待换成轮询:每 100ms 查一次焦点,最多约 2 秒,超时再让断言失败。只改测试,不动产品代码。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions