What Expect does

Expect helps an AI coding agent read a change, form a test plan, and exercise the application in a real browser. It is useful for checking not only a happy path but also empty submissions, invalid input, repeated clicks, back navigation, console errors, and responsive behavior.

It complements deterministic end-to-end tests rather than making them unnecessary.

Requirements

  • A current Node.js and npm installation
  • A Chromium-based browser
  • A supported coding agent such as Codex or Claude Code
  • A local, preview, or dedicated staging environment
  • Test credentials that contain no real customer or payment data

Initialize Expect

Run the official initializer from the project directory:

npx -y expect-cli@latest init

Review which files and agent skills the initializer wants to add. To install only the skill through the documented skills installer workflow:

npx -y skills add https://github.com/millionco/expect --skill expect -y

Restart the coding agent after installation so the new skill or command can be discovered.

Run a first test

Start the application, then give the agent a bounded request:

/expect
Complete the sign-up form with valid input.
Also test an empty submission, an invalid email, and repeated clicks.
Check the browser console and a narrow mobile viewport.
Do not submit a real payment or delete data.

A direct CLI run can specify the target URL and goal:

expect-cli -u http://localhost:5173 -m "Test successful and failed sign-in, including empty fields" -y

Good targets for exploratory browser tests

  • Form validation and error recovery
  • Multi-step onboarding
  • Navigation after authentication
  • Mobile menus and dialogs
  • Loading, empty, and error states
  • Duplicate submissions
  • Browser console and network failures visible to the user

Safety boundaries

Run tests against disposable data. Block or mock payment, email, deletion, and external messaging actions. Do not provide a personal browser profile when a clean test profile works. Read the generated plan before allowing actions that can change external state.

Keep stable regression tests

When Expect finds a real bug, add a deterministic regression test to the repository. Exploratory AI testing is good at discovering unexpected paths; a committed test is better at proving the same failure never returns.