millionco/expect: The End of the Playwright Script

How a bleeding-edge terminal application uses native cookie syncing and AI agents to replace brittle UI tests with declarative intent.

7 min read · millionco/expect

An illustration of a mechanical loom weaving a digital webpage, controlled by a robotic bird reading from punched paper tape.
Instead of a human writing imperative scripts, an AI agent interprets code changes to orchestrate browser testing.
Key Takeaways

The Brittle Test Problem

Modern development has a bottleneck. AI coding agents can write complex features in seconds, but verifying those changes visually requires a human. You have to spin up a local server, log in, navigate to the right page, and click around. The traditional solution is to write automated UI tests.

But traditional Playwright or Cypress scripts are notoriously brittle. They rely on hardcoded CSS selectors or DOM structures. The moment a developer refactors a component or changes a class name, the test breaks, even if the functionality is perfectly fine.

Let agents test your code in a real browser

millionco/expect README, Project Documentation · millionco/expect

Git-Driven QA

Expect completely inverts this model. Instead of requiring developers to write tests beforehand, the CLI reads the unstaged changes (the git diff) in the repository. It feeds this diff to an LLM, which acts as an autonomous QA engineer.

The AI analyzes what just changed and generates a specific test plan for that exact modification. If you updated the checkout button, the agent generates a plan to verify the checkout flow. It then executes this plan in a live Playwright instance.

Expect orchestrates testing by translating code changes into actionable browser automation plans.

The Authentication Hack

The most significant friction point in automated testing isn't clicking buttons; it's authentication. Setting up mock accounts, managing test databases, and writing login scripts is tedious and prone to failure.

Expect bypasses this entirely with local cookie syncing. When you run the CLI, it prompts you to extract session cookies directly from your local Chrome instance. The AI agent then tests your application as a fully authenticated user.

A close-up illustration of a heavy bank vault door being unlocked by a mechanical hand pressing a wax seal into a round indentation.
Local cookie syncing acts as a direct passkey, bypassing the need for complex authentication scripts.

Cookie extraction from local browsers means tests run with real auth state — no fixture setup, no mock accounts, no manual login flows

Ry Walker Research, Researcher · Expect by Million Software

A Distributed System in the Terminal

You might expect a Node script that runs Playwright to be a simple, procedural file. Expect is anything but. The CLI is a full Terminal User Interface (TUI) built with React (via Ink) and TanStack Query.

More importantly, the underlying logic is orchestrated using Effect-TS. Effect is a powerful functional programming framework that provides dependency injection, robust error handling, and sophisticated concurrency models. Expect treats its terminal interface like a highly resilient distributed backend.

// apps/cli/src/layers.ts
import { Layer } from "effect";
import { Git } from "@expect/supervisor/git";
import { Executor } from "@expect/supervisor/executor";
import { Agent } from "@expect/agent";

// Effect Layers allow swapping dependencies without changing core logic
export const SupervisorLive = Layer.mergeAll(
  Git.Live,
  Executor.Live,
  Agent.Live(ClaudeProvider)
);

The SDLC Niche

There is a booming ecosystem of AI browser automation tools right now, but Expect is highly specialized. It is not a general-purpose web scraper or an autonomous web researcher.

It is strictly focused on the software development lifecycle (SDLC). While tools like browser-use attempt to solve general web navigation for AI agents, Expect is built to tighten the feedback loop for developers writing code.

A split illustration comparing a robotic arm wildly grabbing scattered documents on the left, with a robotic arm carefully inspecting a single blueprint on the right.
General web automation vs. targeted, diff-driven testing.
Featuremillionco/expectbrowser-usevercel/agent-browser
Primary FocusSDLC Testing (git diff)General AutomationGeneral Automation
ArchitectureTypeScript / EffectPythonRust CDP
AI IntegrationInternal SDKLiteLLM (Agnostic)Tool Connection
Key AdvantageDiff reading & local authDOM distillationExtreme token efficiency

By combining the context of local code changes with the power of LLMs and the reliability of Playwright, Expect provides a glimpse into a future where UI testing is entirely declarative.