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.
- Expect shifts UI testing from imperative scripts (clicking specific selectors) to declarative intent driven by git diffs.
- The tool bypasses complex authentication setups by securely extracting session cookies directly from the user's local browser.
- Under the hood, Expect uses Effect-TS to treat its terminal interface like a robust, highly resilient distributed system.
- Unlike general-purpose web automation tools, Expect is strictly focused on verifying changes within the software development lifecycle.
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
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.
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.
Cookie extraction from local browsers means tests run with real auth state — no fixture setup, no mock accounts, no manual login flows
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.
| Feature | millionco/expect | browser-use | vercel/agent-browser |
|---|---|---|---|
| Primary Focus | SDLC Testing (git diff) | General Automation | General Automation |
| Architecture | TypeScript / Effect | Python | Rust CDP |
| AI Integration | Internal SDK | LiteLLM (Agnostic) | Tool Connection |
| Key Advantage | Diff reading & local auth | DOM distillation | Extreme 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.