SuperAPI AI 工具集

e2e-tester

通用与其它

查看项目

更新于 10-16 05:46

技能介绍

用途:通过 agent-browser 交互式探索 UI,再自动生成可提交到 CI 的端到端测试代码。适用于“e2e test”“write e2e tests”“test the UI”“/e2e-tester”等触发场景。

主要能力:分两阶段工作。探索阶段使用 agent-browser CLI,命令包括 agent-browser open <url>、snapshot -i、click @e1、fill @e1 "text"、screenshot、wait --text "Done"、is visible @e1,并可用 --headed 可视化调试;导航或 DOM 变化后需重新 snapshot。生成阶段输出 Playwright Test 文件(JS/TS)或 Pest Browser 测试(Laravel/PHP),使用稳定定位器,不使用 @ref。

使用方式:前置要求为加载 agent-browser 技能(use agent browser),应用运行在可访问 URL,先用 agent-browser open <url> 再用 agent-browser snapshot -i 验证。生成测试时定位器优先级依次为 getByTestId、getByRole + name、getByLabel,最后才是稳定的 data 属性 CSS 选择器。等待策略应使用 Playwright 内建等待(如 expect(page).toHaveURL、toBeVisible、waitForResponse),认证可采用 storageState 模式登录一次复用会话(global-setup.ts 保存 .auth/user.json,playwright.config.ts 中配置 globalSetup 与 storageState)。

限制:@ref 仅用于探索,绝不提交;避免 .nth()、CSS 工具类(如 bg-blue-500、flex)、动态/生成式选择器与 waitForTimeout。可参考 reference/pest-browser.md、reference/advanced-patterns.md、reference/ci-cd.md。其他平台、收费或效果信息暂未提供。