前置条件:
pnpm dev启动,浏览器打开 playground 页面(至少一个 tab) 自动测试:npx tsx scripts/test.ts程序化执行 Agent 参与:需要观察浏览器行为或手动验证的用例
测试脚本自动检测已连接的浏览器实例(Vue/React/HTML),对每个实例运行基础测试。 Vue playground 运行完整测试(功能最全)。
打开多个 tab 可同时测试多个框架:
http://localhost:5173/vue/— Vue 3 playground(完整测试)http://localhost:5173/react/— React playground(基础 + React 特有测试)http://localhost:5173/html/— Vanilla JS playground(基础 + HTML 特有测试)
- 操作元素时,浏览器中显示蓝色虚线边框 + 四角角标锁定动画
- 动画 1.5s 后淡出消失
- 按住 Alt 键移动鼠标,元素高亮跟随
- Alt+Click 弹出提示词面板
- Alt+组合键(Ctrl+Alt、Alt+Shift 等)不触发选择模式
pnpm build后浏览器自动刷新加载最新代码
- 切换到其他 tab 后,exec 仍可正常执行(setTimeout fallback)
- page 返回 compact snapshot 含 # url: / # title:
- page cached 返回缓存版本
- 1+1 返回 2
- document.title 返回页面标题
- await __pilot_wait(50); "done" 返回 done
- throw new Error 返回 ERROR
- void 0 不输出 undefined
- findByText 匹配和未找到
- 无操作时无 → 标记和 · 折叠
- 操作元素后 → 标记 + · 折叠(仅 Vue playground 元素足够多时出现)
- 元素不存在 / idx 不存在
- exec 失败时自动附带 snapshot
- runcode 行 / snapshot 头部 / nopage 无 snapshot
- status 返回 JSON 含 instances 数组
- help 输出包含 __pilot_clickByText
- clickByText / typeByPlaceholder / selectValueByText / checkByText / uncheckByText
- setValueByPlaceholder / checkMultipleByText / dblclickByText / keydownByText
- waitFor appear / disappear / waitEnabled / nth 越界
- click / setValue / getRect / scrollIntoView / hover
- checkbox label 匹配 / 多操作多 → 标记
- disabled 元素
- 多步操作(setValueByPlaceholder + selectValueByText)
- input val 更新(setValueByPlaceholder 后 compact snapshot 反映新值,验证 v-model 响应式更新)
- select check 更新(selectValueByText 后 compact snapshot 反映新选中项)
- checkbox check 更新(checkByText 后 compact snapshot 反映勾选状态)
- bridge / userscript 输出
- clickByText(添加) / typeByPlaceholder / clickByText(面板 B)
- selectValueByText / checkByText / dblclickByText
- input 值更新(验证原生 JS 事件监听器正确触发)
- a 标签显示 href 路径(内部链接仅 pathname+hash,外部链接含 host)
- clickByText(console.log) / dblclickByText
- input 响应式(setValueByPlaceholder 后 compact snapshot 反映新值)
- select 响应式(selectValueByText 后 compact snapshot 反映新选中项)
- checkbox 响应式(checkByText 后 compact snapshot 反映勾选状态)