Objectives
By the end of this lab, you will have:
- Connected Claude Code to Playwright via MCP
- Used browser automation to test the AI Trust Check app you built
- Generated E2E tests for your core user flows
- Experienced AI-driven QA on your own code
Why This Matters
You just built AI Trust Check in Lab 4 using the Compound Engineering workflow. Now you'll use another AI capability — browser automation via Playwright MCP — to test what you built. This closes the loop: AI builds, AI tests, human validates.
This is also a Compound AI System in action (see docs/03-frameworks.md) — an LLM + browser automation tool + test runner working as coordinated components. The same pattern applies to any multi-tool workflow.
Step 1: Install Playwright MCP 5 min
Add the MCP server
claude mcp add playwright
Verify installation
/mcp
You should see "playwright" listed.
First run setup
Playwright will automatically install browsers on first use.
Step 2: Smoke Test Your App 10 min
Make sure your AI Trust Check dev server is running:
npm run dev
Let Claude explore the app
Review the screenshots
- Does the homepage look right?
- Does search return results?
- Does the tier toggle actually change the safety rating and data clearance grid?
- Any broken layouts or missing data?
This is AI doing QA on AI-generated code — a compound AI system in action.
Step 3: Test the Core User Flow 15 min
Generate E2E tests for AI Trust Check
Run the tests
npx playwright test
Fix any failures
If tests fail, let Claude fix them:
Step 4: Visual Regression 10 min
Screenshot-based testing
Review the screenshots
Look at each one:
- Is the layout clean and consistent?
- Do the safety rating colors match the brief (green/yellow/orange/red)?
- Does the mobile view look reasonable?
- Are there any visual bugs?
Fix anything you spot
Step 5: Generate a Test Report 5 min
Checkpoint
- Playwright MCP is connected and working
- You've used browser automation to explore your AI Trust Check app
- You've generated E2E tests for homepage search, tool detail, and tier toggle
- You've taken screenshots for visual QA
- Tests are passing (or you've identified what needs fixing)
Commit your tests
git add tests/ && git commit -m "test: add Playwright E2E tests for AI Trust Check"
The Compound Loop
Notice what just happened:
| Step | Who | What |
|---|---|---|
| Product brief | PM (human) | Defined what to build |
| Architecture | Developer + AI (Lab 2) | Defined how to build it |
| Build (unstructured) | AI (Lab 2) | First attempt — unreliable |
| Build (compound) | AI (Lab 4) | Second attempt — structured, reliable |
| Test | AI (Lab 5) | Automated QA on the build |
| Review | Human | Validates everything |
Each step builds on the previous. The tests you just created can run on every future change — making subsequent work easier. That's compound engineering.
Reflection Questions
- How useful was Playwright for catching issues in the AI-generated code?
- Would you trust AI-generated E2E tests for your real projects? What would you change?
- How does this change your testing workflow?