AI Agent E2E Testing Protocol
This document defines the standard protocol for AI agents to perform end-to-end testing of Mailpilot using headless browser automation.
Overview
AI agents use the Chrome MCP tools to perform interactive E2E testing during development. This is separate from automated Playwright tests - it's for manual verification of features during implementation.
Test Environment Setup
Step 1: Seed Test Data
Before testing, seed the database with test fixtures:
# Seed all data with defaults
pnpm seed:test
# Or seed specific data with custom counts
pnpm seed:test --audit 50 --dead-letter 10
# Show all options
pnpm seed:test --helpSee E2E Testing Reference for all seeding options.
Step 2: Start the Application
Start the development server:
pnpm devThis starts:
- Backend server on
http://localhost:8085 - WebSocket server for real-time updates
- Serves the dashboard from
dashboard/dist/
Wait for: Log message Dashboard server started on port 8085
Step 3: Initialize Browser Context
Get the current MCP tab context:
mcp__Claude_in_Chrome__tabs_context_mcpCreate a new tab for testing (each test session should use a fresh tab):
mcp__Claude_in_Chrome__tabs_create_mcpStep 4: Navigate to Dashboard
mcp__Claude_in_Chrome__navigate with url: "http://localhost:8085"Verify: Page loads without errors.
Test Session Protocol
Starting a Test Session
- Document the test objective - State what you're testing
- Take initial screenshot - Capture the starting state
- Plan test steps - List the actions you'll take
During Testing
For each test step:
- State the action - What you're about to do
- Execute using MCP tools - Perform the action
- Capture evidence - Take screenshot after significant actions
- Verify result - Check the outcome matches expectations
- Document findings - Note any issues or observations
Test Coverage Checklist
For any dashboard feature, ensure you test:
- Happy path - Feature works as expected
- Error handling - Invalid inputs show proper errors
- Loading states - Loading indicators appear during async ops
- Empty states - Proper UI when no data exists
- Responsive behavior - Works at different viewport sizes
- Keyboard navigation - Tab through form fields
- Real-time updates - WebSocket updates reflect in UI
Common Test Scenarios
Dashboard Load Test
- Navigate to
http://localhost:8085 - Verify page title contains "Mailpilot"
- Check navigation sidebar is visible
- Verify stats widgets load (check for loading spinners → data)
- Take screenshot of loaded dashboard
Settings Page Test
- Navigate to
/settings - Verify all setting sections are visible:
- Email Accounts
- LLM Configuration
- Webhooks (if enabled)
- Test expand/collapse of sections
- Verify form validation on inputs
Account Management Test
- Navigate to Settings → Email Accounts
- Click "Add Account"
- Fill in test IMAP details:
- Host:
imap.example.com - Port:
993 - Username:
test@example.com - Password:
testpassword
- Host:
- Click "Test Connection" (expect failure for fake credentials)
- Verify error message is displayed
- Cancel the modal
- Verify modal closes cleanly
Real-time Updates Test
- Open dashboard
- Open Network tab / monitor WebSocket
- Verify WebSocket connection established
- Trigger an action (if possible) or wait for periodic update
- Verify UI updates without page refresh
Error Handling
If a step fails:
- Take screenshot immediately
- Check console for errors:
read_console_messages - Check network for failed requests:
read_network_requests - Document the failure in the test report
- Attempt recovery or abort test session
Common Issues
| Issue | Diagnosis | Resolution |
|---|---|---|
| Page blank | Check console | Fix JS errors |
| Element not found | Check read_page output | Use correct selector |
| Click has no effect | Element might be covered | Scroll or wait for animation |
| Form not submitting | Check network requests | Verify API endpoint |
Integration with Development Workflow
When to Perform E2E Testing
- After implementing UI changes - Verify the change works
- Before creating PR - Full regression test of affected areas
- When fixing bugs - Verify the fix and check for regressions
- After merging dependencies - Smoke test the dashboard
Minimum E2E Verification
Before any PR that touches dashboard code:
- Dashboard loads without console errors
- Navigation works (all pages accessible)
- Changed feature works as expected
- No visual regressions in affected areas