Show HN:E2E——面向 Web、iOS 和 Android 的开源 Agent 测试框架
英文标题:🔶 Show HN: E2E – Open-source agentic testing framework for web, iOS and Android
TesterArmy 发布了开源端到端测试框架 e2e,支持 Web、iOS 和 Android 应用,并允许开发者以自然语言描述测试目标,由 Agent 操作应用完成任务。Agent 已验证步骤会记录操作,并在后续运行中回放,无需重复调用模型,直到应用发生变化;不含 Agent 步骤的测试则完全不需要模型。该项目支持自带订阅、API Key 或本地模型,并提供基于 Playwright 的 Web 引擎及面向 iOS/Android 模拟器的移动端引擎。e2e 目前仍在迈向 1.0 的积极开发阶段,API 和配置可能在小版本之间变化。
5.6 KB
136.4 KB
556.4 KB
中文
e2e 是一套用于 Web 和移动应用的端到端测试框架。使用自然语言描述目标,Agent 就会驱动应用达成该目标。你可以在同一个测试中,使用定位器和断言检查结果。
// tests/checkout.e2e.ts
import { test, expect } from 'e2e';
test('a member upgrades to Pro', async ({ app, agent, screen }) => {
await app.open('/settings/billing');
await agent.act('upgrade the workspace to the Pro plan');
await agent.assert('the invoice preview shows a prorated amount');
await expect(screen.getByRole('status')).toContainText('Pro');
});
某个 Agent 步骤若由后续断言验证,其操作便会被记录;下次运行时,在应用发生变化之前,测试会回放这些操作而不调用模型。不包含 Agent 步骤的测试无需使用模型。你可以使用自己的订阅、API Key 或本地模型。
init 会询问你要使用的引擎(Web 或移动端)以及模型提供商,随后写入配置和示例测试。快速上手文档涵盖其余步骤。
如需查看已在你的技术栈中完成的配置,请打开 examples/:Vite、Next.js、Astro、Expo、SwiftUI、Jetpack Compose、Kotlin Multiplatform 和 Flutter;每个示例都是带有可通过测试套件的独立项目。
| 软件包 | 功能 |
|---|---|
e2e |
SDK、运行器和 CLI。 |
@e2e-dev/web |
浏览器引擎:通过 Playwright 支持 Chromium、Firefox 和 WebKit。 |
@e2e-dev/mobile |
iOS 和 Android 引擎:通过 agent-device 使用模拟器和仿真器。 |
@e2e-dev/github |
将测试结果作为 Pull Request 评论发布的报告器。 |
@e2e-dev/kernel |
为 Web 引擎提供 Kernel 托管浏览器。 |
@e2e-dev/limrun |
为移动测试提供 Limrun 托管的 iOS 模拟器和 Android 仿真器。 |
@e2e-dev/eas |
为移动引擎提供 EAS Simulators 托管的 iOS 模拟器和 Android 仿真器。 |
@e2e-dev/smol |
面向 Web 引擎的 smol machines 浏览器:默认情况下,每次尝试都会分叉一个预热的 Chromium microVM。 |
@e2e-dev/decision |
用于受限语义操作和断言的决策模型执行器。 |
e2e.tester.army/docs。e2e 软件包内置所有文档页面,因此编程 Agent 可以在 node_modules/e2e/docs 中离线读取这些文档。
参见 CONTRIBUTING.md。如有问题,请前往 Discord。
请勿通过公开 issue 报告安全漏洞。请遵循 SECURITY.md,并将漏洞报告发送至 security@tester.army。
CLI 会发送匿名使用数据,例如运行了哪些命令和引擎、以及运行在哪些环节失败;但不会发送测试内容、应用内容或凭据。可通过 npx e2e telemetry disable 或 E2E_TELEMETRY_DISABLED=1 退出。Telemetry 列出了每一个收集字段。
注意
e2e 正在积极开发中,正向 1.0 版本迈进。API 和配置仍可能在小版本之间发生变化。
e2e 由 TesterArmy 构建;TesterArmy 是一个 Agent 测试平台,可在每次 Pull Request 或按计划执行时,对 Web 和移动应用运行自然语言测试。
Apache-2.0。
English / 原文
e2e is an end-to-end testing framework for web and mobile apps. Describe a goal in natural language and an agent drives the app to reach it. Check the result with locators and assertions in the same test.
// tests/checkout.e2e.ts
import { test, expect } from 'e2e';
test('a member upgrades to Pro', async ({ app, agent, screen }) => {
await app.open('/settings/billing');
await agent.act('upgrade the workspace to the Pro plan');
await agent.assert('the invoice preview shows a prorated amount');
await expect(screen.getByRole('status')).toContainText('Pro');
});
An agent step that a later assertion verifies records its actions, and the next run replays them with no model calls until the app changes. Tests without agent steps need no model. Bring your own subscription, API key, or local model.
init asks for an engine, web or mobile, and a model provider, then writes a config and an example test. The quickstart covers the rest.
To see a finished setup in your stack, open examples/: Vite, Next.js, Astro, Expo, SwiftUI, Jetpack Compose, Kotlin Multiplatform, and Flutter, each a standalone project with a passing suite.
| Package | What it does |
|---|---|
e2e |
The SDK, runner, and CLI. |
@e2e-dev/web |
Browser engine: Chromium, Firefox, and WebKit through Playwright. |
@e2e-dev/mobile |
iOS and Android engine: simulators and emulators through agent-device. |
@e2e-dev/github |
Reporter that posts results as a pull request comment. |
@e2e-dev/kernel |
Kernel hosted browsers for the web engine. |
@e2e-dev/limrun |
Limrun hosted iOS simulators and Android emulators for mobile tests. |
@e2e-dev/eas |
EAS Simulators hosted iOS simulators and Android emulators for the mobile engine. |
@e2e-dev/smol |
smol machines browsers for the web engine: by default, each attempt branches a warm Chromium microVM. |
@e2e-dev/decision |
Decision-model executors for bounded semantic actions and assertions. |
e2e.tester.army/docs. The e2e package ships every page, so coding agents can read them offline in node_modules/e2e/docs.
See CONTRIBUTING.md. Questions go to Discord.
Please don't open public issues for security vulnerabilities. Follow SECURITY.md and report them to security@tester.army.
The CLI sends anonymous usage data, such as which commands and engines run and where runs fail, but no test content, app content, or credentials. Opt out with npx e2e telemetry disable or E2E_TELEMETRY_DISABLED=1. Telemetry lists every field.
Note
e2e is in active development on the way to 1.0. APIs and config can still change between minor releases.
e2e is built by TesterArmy, the agentic testing platform that runs natural language tests on web and mobile apps, on every pull request or on a schedule.
Apache-2.0.
