✨ e2e: 本地验证增加手工驱动轨道(pnpm serve + pnpm drive) - #14
Merged
Conversation
一次性验证原来只有一条路:写一条 scratch spec,再整轮冷启跑一遍。改一个选择器就 要重付一次构建 + 播种,而且 spec 只断言事先想到的那几件事——上一轮控制台验证就是 这么只证明了元素存在、没证明视觉一致(docs/specs/2026-08-12-console-design-fidelity.md)。 新轨道与桌面端 agentre/e2e/drive.mjs 同形:两仓独立、不共享代码,但同一套命令、 同一套选择器 DSL、同一份 drive.log。 - pnpm serve:run-e2e-web.mjs 起完环境后撑住不退,不跑 spec。这套环境(真 server + 播种账号 + 在线 agentred)原来只活在一次 spec 运行的生命周期里,看完就随 workDir 一起消失。Ctrl-C 仍精确删掉本次播的行。 - pnpm drive up/…/down:一次调用一个动作,打在活过单次调用的浏览器上。snapshot 列出 屏幕上可定位的元素,sql 是只读的独立 oracle,logs 读 server 与 agentred 自己的日志; 每次调用(含失败)当场追加进 scratch/<场景>/logs/drive.log。 四条护栏是机械的,不靠记:只驱动本次 target 自己的 origin;oracle 只读;证据只落在 场景目录内;默认无头。库口令只经 MYSQL_PWD 传给 mysql 客户端,不进 argv——否则同机 ps 就能看到整条口令。 WEBE2E_CONFIG_DIR 是 source: etcd 那类配置的出口:cago 在 source 非 file 时会把整个 配置源换掉,http.address 也来自 etcd,runner 起的 server 会去绑 8443 而不是它挑的空闲 端口,隔离直接作废。 44 条 harness 单测挂进 playwright.runner.config.ts,随 make test-e2e 进 CI。
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.
为什么
一次性验证原来只有一条路:写一条 scratch spec,再整轮冷启跑一遍。改一个选择器就要重付一次构建 + 播种;而且 spec 只断言你事先想到的那几件事——上一轮控制台验证就是这么只证明了元素存在、没证明视觉一致(
docs/specs/2026-08-12-console-design-fidelity.md)。新轨道与桌面端
agentre/e2e/drive.mjs同形:两仓独立、不共享代码,但同一套命令、同一套选择器 DSL、同一份drive.log。做了什么
pnpm serve—run-e2e-web.mjs --serve:起完整环境后撑住不退,不跑任何 spec。这套环境(真 server + 播种账号 + 在线 agentred)原来只活在一次 spec 运行的生命周期里,看完就随workDir一起消失。Ctrl-C 仍精确删掉本次播的行。pnpm drive up/…/down— 一次调用一个动作,打在活过单次调用的浏览器上(CDP attach → 动作 → disconnect)。snapshot列出屏幕上每个可见可交互元素及其定位方式,看不懂发生什么时第一个跑它;sql是只读的独立 oracle(MySQL /--db agentred读 SQLite);logs读 server 与 agentred 自己的日志,浏览器关了也能用——写报告时正是这个时候;scratch/<场景>/logs/drive.log。四条护栏是机械的,不靠记:只驱动本次 target 自己的 origin(外网地址、同机别的端口一律拒绝);oracle 只读;证据只落在场景目录内;默认无头。库口令只经
MYSQL_PWD传给客户端,不进argv——否则同机ps就能看到整条口令。WEBE2E_CONFIG_DIR—source: etcd那类配置的出口。cago 在 source 非file时会把整个配置源换掉(configs/config.go的init),http.address也来自 etcd,runner 起的 server 会去绑0.0.0.0:8443而不是它挑的空闲端口,隔离直接作废。验证
真环境跑通端到端(证据在 gitignored 的
e2e/scratch/2026-08-13-drive-track/):drive up落在/overview而不是登录页(播种的会话 Cookie 生效);drive sql从真 MySQL 独立读回users与两台agentred设备——不是拿界面的话当证据;cleaned up account 2: {...} (no residue),事后直连复查leftover_webe2e_users=0/total_users=0/total_devices=0。闸门:44 条 harness 单测(新挂进
playwright.runner.config.ts,随make test-e2e进 CI)、14 条 smoke、make lint、make test全绿。已知问题(本轮未改)
locateAgentreCheckout固定往上退四级求工作区根,主检出里跑pnpm serve/pnpm web仍需AGENTRE_DIR=。既有问题,pnpm web同样受影响。