expect README

项目的 README,来自 github.com/millionco/expect。合并为一个 markdown 文件:README.md。

Expect

version downloads

Expect is a skill for testing your agent's code in a real browser.

Demo →

Getting Started

  1. Ask your agent to Fetch https://www.expect.dev/ and run init script
  2. Run /expect inside Claude Code, Codex, and more
  3. Expect spawns subagents simulating real logged-in users to find issues and regressions
  4. Your agent will fix any issues Expect finds, then re-run to verify

FAQ

1. What is Expect?

A skill that reads your git changes, generates a test plan, and runs it in a real browser with Playwright. It hooks into your existing agent (Claude Code, Codex, Cursor) and runs entirely on your machine. It checks for performance (long animation frames, INP, LCP), security (npm deps, CSRF attacks, vulns), design tweaks (broken hover states, links, buttons), and app completeness (missing metadata, dead links).

2. Why not just use Puppeteer, Playwright, or Cypress?

Instead of writing scripts, maintaining selectors, and wiring up assertions, Expect reads your code changes and tests them in a real browser automatically. It's like giving your agent QA superpowers.

3. How is this different from computer-use agents?

General-purpose browser tools rely on screenshots and mouse coordinates. Expect is purpose-built for testing: it uses Playwright for fast DOM automation, reads your code changes, generates a test plan, and runs it with your real cookies, then reports back what's broken so the agent can fix it.

4. Does it work in CI?

Yes. Use --ci or the add github-action command to set up a workflow that tests every PR. In CI mode it runs headless, skips cookie extraction, auto-approves the plan, and enforces a 30-minute timeout.

5. Does it support mobile testing?

Coming soon.

6. Is there a hosted or enterprise version?

Coming soon. Email [email protected] if you have questions or ideas.

Options

Flag Description Default
-m, --message <instruction> Natural language instruction for what to test -
-f, --flow <slug> Reuse a saved flow by its slug -
-y, --yes Run immediately without confirmation -
-a, --agent <provider> Agent provider (claude, codex, copilot, gemini, cursor, opencode, droid) auto-detect
-t, --target <target> What to test: unstaged, branch, or changes changes
-u, --url <urls...> Base URL(s) for the dev server (skips port picker) -
--browser-mode <mode> Browser mode: headed or headless headed
--cdp <url> Connect to an existing Chrome via CDP WebSocket URL -
--profile <name> Reuse a Chrome profile by name (e.g. Default) -
--no-cookies Skip system browser cookie extraction -
--ci Force CI mode: headless, no cookies, auto-yes, 30-min timeout -
--timeout <ms> Execution timeout in milliseconds -
--output <format> Output format: text or json text
--verbose Enable verbose logging -
-v, --version Print version -
-h, --help Display help -

Supported Agents

Expect works with the following coding agents. It auto-detects which agents are installed on your PATH. If multiple are available, it defaults to the first one found. Use -a <provider> to pick a specific agent.

Agent Flag Install
Claude Code -a claude npm install -g @anthropic-ai/claude-code
Codex -a codex npm install -g @openai/codex
GitHub Copilot -a copilot npm install -g @github/copilot
Gemini CLI -a gemini npm install -g @google/gemini-cli
Cursor -a cursor cursor.com
OpenCode -a opencode npm install -g opencode-ai
Factory Droid -a droid npm install -g droid

Resources & Contributing Back

Want to try it out? Check out our demo.

Find a bug? Head over to our issue tracker and we'll do our best to help. We love pull requests, too!

We expect all contributors to abide by the terms of our Code of Conduct.

→ Start contributing on GitHub

Acknowledgements

Expect wouldn't exist without the ideas and work of others:

License

FSL-1.1-MIT © Million Software, Inc.

expect (millionco/expect)

正在搜索数据库…

这是什么?Expect 是一个测试工具,它让 AI 代理的代码在真实浏览器中运行,这样你就能验证代理在真实浏览器环境中的行为是否正确,而不必依赖模拟(mock)。
这是 CLI 工具,还是导入代码里的库?它以 CLI 形式发布,位于仓库 Turborepo monorepo 的 apps/cli 包中,而不是可直接导入的库。
Expect 测试的范围不止基于浏览器的代理行为吗?根据项目描述,Expect 的重点专门是在真实浏览器中验证代理代码,因此非浏览器的代理场景似乎不是它的目标用途。
这是为谁打造的?它面向构建在网页浏览器中行动的 AI 代理、并需要对这类行为做自动化真实浏览器端到端检查的开发者。
为什么要用真实浏览器测试,而不是简单模拟?DOM 交互、渲染和时序这类代理行为,只有针对真实的浏览器实例才能可靠验证,简化的模拟对象做不到。
「Expect」这个名字暗示了什么?这个名字暗示了断言式的 expect 检查,类似于常见的测试库,用来验证代理在浏览器中的操作。
这个项目是单一包还是 monorepo 结构?它是一个基于 Turborepo 的 monorepo,包含一个专门的 CLI 应用,并通过 pnpm 和 Turbo 脚本管理共享的构建、lint 和测试流水线。
项目有 CI 吗?有,仓库通过 GitHub Actions 运行代码质量、端到端和发布工作流,其中包括专门的 e2e.yml 流水线。
作者
millionco
大小
61.1 MB
星标
3.6K
时长
8个月
提交 · 90 天