Skip to content

✅ 添加 Firefox E2E 自动化测试#1503

Draft
CodFrm wants to merge 1 commit into
release/v1.4-agentfrom
test/firefox-e2e-automation
Draft

✅ 添加 Firefox E2E 自动化测试#1503
CodFrm wants to merge 1 commit into
release/v1.4-agentfrom
test/firefox-e2e-automation

Conversation

@CodFrm

@CodFrm CodFrm commented Jun 12, 2026

Copy link
Copy Markdown
Member

变更内容

  • 新增 pnpm run test:e2e:firefox,先通过 PACK_FIREFOX=true pnpm run pack 产出 Firefox 包,再用 Playwright Firefox 跑 E2E。
  • 新增 playwright.firefox.config.ts,复用原 Playwright 配置,仅清空 Firefox 不支持的 Chromium clipboard permissions。
  • 扩展 E2E fixture:Firefox 模式下解包 Firefox zip,用 Firefox 内核加载扩展页面,并注入页面级 chrome/browser API mock。
  • 统一扩展页面 URL helper,支持 chrome-extension://moz-extension://file://
  • 修正 settings / vscode-connect spec 中硬编码 chrome-extension:// 的 URL 拼接。
  • scripts/pack.js 支持通过 PACK_FIREFOX=true 打 Firefox 包。

验证结果

  • pnpm run typecheck:通过
  • pnpm exec playwright test e2e/gm-api.spec.ts --reporter=list:7 passed
  • pnpm run test:e2e:50 passed
  • pnpm run test:e2e:firefox:46 passed / 1 failed

Firefox E2E 当前结果

分组 结果 说明
Agent Chat / Conversation / Error Handling 6 passed 这些 spec 内部使用 Chromium fixture,当前结果不是 Firefox 真实 userscript 链路
Agent Navigation / Provider 8 passed Firefox file harness 下通过
GM API 7 passed 该 spec 内部使用 Chromium fixture,当前结果不是 Firefox 真实 GM API 链路
Install / Options / Popup / Settings 14 passed Firefox file harness 下通过
Script Editor / Script Management 8 passed Firefox file harness 下通过
VSCode Connect 3 passed / 1 failed UI 流程通过;真实 WebSocket 同步等待 hello 超时

已知限制

当前 Firefox E2E 采用 Firefox 内核 + Firefox 打包产物解包 + file:// 页面加载 + 页面级扩展 API mock。它可以覆盖扩展页面、路由、Monaco、脚本列表管理等页面流程,但还不是真实 moz-extension:// 扩展后台 / content script / userScripts / GM API 链路。

完整失败项:

  • e2e/vscode-connect.spec.ts应能通过 WebSocket 连接并接收脚本同步
    • 失败原因:Timeout waiting for action: hello
    • 当前 file harness 没有真实 background/offscreen WebSocket 连接链路。

@cyfung1031

cyfung1031 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

vscode-connect 理论上可以在 event page 直接搞
但我没详细测试过可行性

之前 AI搞的那个连接器好像有把 vscode-connect 放在iframe里做。没测试

@CodFrm CodFrm force-pushed the release/v1.4-agent branch 3 times, most recently from 87f6b00 to 238062a Compare June 12, 2026 13:20
@CodFrm CodFrm marked this pull request as draft June 13, 2026 13:50
@CodFrm

CodFrm commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

vscode-connect 理论上可以在 event page 直接搞 但我没详细测试过可行性

之前 AI搞的那个连接器好像有把 vscode-connect 放在iframe里做。没测试

还是有很多问题,还得去查,先draft了

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants