test(e2e): S1-01 复验指向线上源时如实跳过题库降级段 - #70
Merged
Merged
Conversation
把 CSP_E2E_ORIGIN 指向线上站点跑 e2e:s1-01 时,「题库异常降级」段要把坏题库写进 lessons/s1-01/index.html 再复验,而线上页面是只读的、注入改不动:其中 6 项报失败(页面 其实没坏),7 项因为线上碰巧满足而假通过。改成按来源判定:本机来源照旧整段跑;来源是 线上只读内容时逐项打印 SKIP 并说明原因,期望项数由 88 减去跳过名单长度推出(75)。 - 跳过名单显式列出,跳过几项由名单算出来,不写死第二套数字 - 本机跑完自查名单与实跑逐项一致,改一段忘了改名单会当场失败(exit 4) - 新增两条静态契约测试,绑定名单与实测检查项、只读判定与推导式 - 手工清单补一句,说明这一段为何在线上来源跳过 验证:bun test 796/796;本机 e2e:s1-01 88/88;线上来源 75/75 且打印 13 项 SKIP。 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
问题
把
CSP_E2E_ORIGIN指向线上站点跑bun run e2e:s1-01(README 记录的复用来源用法)时,E2E-S1-01-05 题库异常降级一段会报 6 项失败:但页面并没有坏:这一段要把坏题库写进
lessons/s1-01/index.html再刷新复验,线上页面是只读的,注入改不动被复验的内容。同一段里另外 7 项则因为线上页面碰巧满足条件而假通过(例如“提交按钮不可点击”在未作答时本来就成立)。也就是说这一段在只读来源下既不出真信号,又制造 6 条假红灯。改法
servesLocalCheckout(origin)(localhost/127.0.0.1/::1)。不能只看“有没有设置CSP_E2E_ORIGIN”——指向自己的本地开发服务器时注入仍然有效。SKIP <检查名> -> <来源> 不是本机 checkout,坏题库注入改不动被复验的页面,既不写成通过也不写成失败;期望项数由expectedChecks - poolFaultCheckNames.length推出(88 → 75),退出码仍为 0。poolFaultCheckNames名单算出来,不写死第二套数字,避免“88 项”和“跳过”各说各话。TDD 与证据
先红后绿(
tests/e2e-count-facts.test.ts新增两条,绑定名单与实测检查项、只读判定与推导式):bun testbun tests/e2e/s1-01-cdp.ts(本机来源)CSP_E2E_ORIGIN=https://cplus.talkincode.net bun tests/e2e/s1-01-cdp.tsbun -e 'new Bun.Transpiler(...).transformSync(...)'线上那一次同时给另外 75 项(含本轮的复习出口检查)产出了对生产站点的真实验收证据。
tests/e2e-manual-checklist.md侧的说明:tests/e2e/s1-01-manual-checklist.md的 E2E-S1-01-05 段补了一句,讲清这一段为何在线上来源跳过、降级行为必须在本机来源复验。