E2E Testing with agent-browser
I've been experimenting with agent-browser in Claude Code, and it's changing how I think about end-to-end testing.
The Old Way
await page.click('#submit-btn-v2-new');
await page.waitForSelector('.modal-content > div:nth-child(3) > button');
Selectors break. Tests become maintenance nightmares.
The New Way
Write test cases that read like requirements:
TEST-ONBOARD-001: New User Redirect
Priority: Critical
Preconditions: User with no organizations
Steps:
1. Create test scenario with user having no orgs
2. Login as that user
3. Navigate to /dashboard
4. Verify redirect to /onboarding
5. Verify plan selection cards displayed
Expected Results:
- Users without orgs redirected to onboarding
- Plan cards show Starter and Pro options
Hand this to agent-browser. It navigates, clicks, validates. Done.
Why This Matters
-
Tests read like specs. PMs understand them. No translation layer.
-
Resilience to UI changes. Button renamed? Class refactored? AI adapts.
-
Faster authoring. Describe the flow, run it, ship it.