✅ 补全并重构高价值 E2E 覆盖#1629
Merged
Merged
Conversation
3 tasks
Collaborator
|
e2e 盡量以integrated test 為測試對象吧 我沒什麼意見,能跑就好 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist / 检查清单
N/A — 本 PR 没有关联 Issue;目标是精简重复 smoke,并补齐只有真实扩展、浏览器 API 和跨上下文才能证明的高价值 E2E。
背景
原有 E2E 中存在多组“页面可见 / 按钮可用”的重复 smoke,但安装、更新、备份恢复、订阅和
@early-start等核心链路没有在真实浏览器中形成可观察的闭环。example/gm_value中的跨脚本共享、前后台运行环境也缺少正反契约。新增的高价值 E2E
@storageName共享、隔离与生命周期@storageName的普通脚本交叉验证GM_setValue/GM.setValue与GM_getValue/GM.getValue,并断言跨脚本 listener 的remote === true。@background脚本与页面脚本跨 Offscreen/Sandbox 和页面注入环境双向传值,两端 listener 均报告remote === true。@storageName使用相同 key 时严格隔离。安装与更新
install.html?url=加载 v1,点击安装后在匹配页面断言 v1 脚本实际执行。备份真正 round-trip
import-complete,再在匹配页面断言脚本重新执行且 GM Value 已恢复。订阅完整生命周期
@early-start+ CSP + worldexample/tests/early_inject_page_test.js和early_inject_content_test.js接入正式 E2E。script-src 'none'CSP 页面运行,分别验证 page world / content world 的 parser 早期注入和 GM API 桥接。重复 E2E 精简
standalone-pages-smoke.spec.ts删除已被专属 spec 覆盖的 Options、Popup、Install smoke,仅保留 Import 缺缓存、Batch Update 空态、Confirm 过期态。script-editor.spec.ts删除 Monaco 可见、模板可见和保存成功的层层子集,保留保存后脚本进入列表的最强用例。agent-navigation.spec.ts只保留真实侧边栏点击导航,删除已被 Agent 专属 spec / 全路由 smoke 覆盖的直达与空态。settings.spec.ts的容器可见和“任意控件数 > 0”两个低判别力用例;Settings 路由挂载仍由options-pages-smoke.spec.ts覆盖。@connect基本成功 GET 的重复 case,将ok/method断言并入更强的真实 header + DNR marker 场景。实现原则
remote语义;不以 DAO / IndexedDB 内部状态代替最终结果。expect.poll,不用固定 sleep 掩盖异步时序。验证
pnpm exec eslint <changed-e2e-files>— 通过pnpm run typecheck— 通过pnpm run build— 通过(仅现有 bundle size / dynamic require 性能警告)CI=1 pnpm exec playwright test e2e/storage-name.spec.ts --workers=1 --repeat-each=2— 10 passedCI=1 pnpm exec playwright test e2e/install.spec.ts e2e/backup-zip.spec.ts e2e/subscribe-lifecycle.spec.ts --workers=1 --repeat-each=2— 6 passedCI=1 pnpm exec playwright test e2e/agent-navigation.spec.ts e2e/script-editor.spec.ts e2e/standalone-pages-smoke.spec.ts e2e/backup-zip.spec.ts e2e/install.spec.ts e2e/subscribe-lifecycle.spec.ts e2e/gm-xhr-site-access.spec.ts --workers=1— 11 passedCI=1 pnpm exec playwright test e2e/gm-api.spec.ts --workers=1 --grep 'local CSP target|GM_ sync API tests|@early-start'— 4 passed;gm_api_sync_test.js29 passed / 0 failedScreenshots / 截图
N/A — 纯 E2E 测试改动,无视觉界面变化。