Test the current PR or specified tests on an Autodock staging environment
Runs automated tests on a staging environment with CLI, browser, and E2E capabilities.
/plugin marketplace add mikesol/autodock-plugins/plugin install autodock@autodock-plugins[test target or PR URL]Run tests on an Autodock staging environment. If no environment is running, sets one up first. Syncs the current state once (no progressive sync) and then runs tests.
Arguments:
#123 or https://github.com/owner/repo/pull/123)tests/unit/ or **/integration/**)--browser or --visual: Focus on browser-based testing with Chrome DevTools MCP--e2e: Run end-to-end tests (CLI runner + browser verification)Testing capabilities:
IMPORTANT: Do not search for tools or grep for MCP availability. Directly call the tool.
Call the mcp__autodock__account_info tool now. This is the only way to check authentication status.
If the tool returns user info (email, name):
If the tool call fails, errors, or the tool doesn't exist:
/mcp, select the autodock server, and press Enter to log in. Then try /autodock:test again."Check if an Autodock environment is already running:
cat .autodock-state 2>/dev/null || echo "NO_STATE"
If .autodock-state exists with an environmentId:
mcp__autodock__env_status with that environmentIdready: Skip to Step 3 (environment already running)stopped: Call mcp__autodock__env_restart, wait for ready, then proceed to Step 3.autodock-state, proceed to Step 2bIf no .autodock-state exists (Step 2b):
staging agent with run_in_background: false (we need to wait for it)IMPORTANT: Only sync once. Do NOT set up progressive sync or watch mode.
cat package.json 2>/dev/null || echo "{}"
ls -la next.config.* vite.config.* supabase/ k8s/ kubernetes/ argocd/ 2>/dev/null || true
Build detection array from:
next, @next/* in package.json → nextjsvite, @vitejs/* in package.json → vite@supabase/* or supabase/ directory → supabasek8s/ or kubernetes/ → k3sargocd/ → argocdCall mcp__autodock__env_sync with:
projectName: basename of current directorydetectedTechnologies: array from aboveExecute the rsync command, excluding .env* files and handling them separately per the sync tool's guidance.
If services were already running, restart them to pick up new code:
# Get the environment info from state
SLUG=$(cat .autodock-state | jq -r '.slug')
PROJECT=$(basename "$PWD")
# Kill existing processes and restart
ssh -i ~/.autodock/ssh/${SLUG}.pem ubuntu@${SLUG}.autodock.io << 'EOF'
pkill -f "npm run dev" || true
pkill -f "node" || true
sleep 2
cd /workspace/${PROJECT}
export __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=.autodock.io
nohup bash -li -c 'npm run dev' > /workspace/logs/${PROJECT}.log 2>&1 </dev/null &
EOF
Wait a few seconds for services to start.
Parse $ARGUMENTS to determine what to test and how:
Check for mode flags in arguments:
--browser or --visual → Browser-only testing with Chrome DevTools MCP (skip CLI tests)--e2e → Full E2E: CLI tests + browser verificationIf no arguments provided (or only mode flags):
git branch --show-current
gh pr view --json number,title,url,files 2>/dev/null || echo "NO_PR"
files to understand what changed (UI components? API? Config?)If arguments look like a PR reference:
#123 or a GitHub PR URL → Fetch PR info with gh pr view <ref> --json number,title,headRefName,baseRefName,filesIf arguments look like a test path/pattern:
tests/unit/, **/*.test.ts)When testing a PR, analyze the changed files to prioritize testing:
gh pr view --json files | jq -r '.files[].path'
File patterns → Test focus:
src/components/*, *.tsx, *.css → Prioritize browser/visual testingsrc/api/*, src/services/*, *.test.ts → Prioritize CLI unit testssrc/pages/*, src/app/* → Both: CLI tests + browser navigationpackage.json, config files → Full test suite + dependency check*.md, docs/* → Skip tests, just verify buildDetermine the appropriate testing strategy based on the project and test target.
Check package.json for test configuration:
cat package.json | jq '.scripts.test // empty'
cat package.json | jq '.scripts' | grep -i 'test\|e2e\|cypress\|playwright'
Test types to identify:
Call mcp__autodock__env_run to get SSH templates, then execute tests:
SLUG=$(cat .autodock-state | jq -r '.slug')
PROJECT=$(basename "$PWD")
ssh -i ~/.autodock/ssh/${SLUG}.pem ubuntu@${SLUG}.autodock.io << 'EOF'
cd /workspace/${PROJECT}
bash -li -c 'npm test' # Or the appropriate test command
EOF
For specific test patterns, pass them to the test runner:
bash -li -c 'npm test -- ${TEST_PATTERN}'
IMPORTANT: Use Chrome DevTools MCP for visual verification, interaction testing, and debugging.
The Chrome DevTools MCP tools (mcp__chrome-devtools__*) allow you to interact with the deployed application in a real browser. This is essential for:
First, get the exposed URL from state and navigate:
SLUG=$(cat .autodock-state | jq -r '.slug')
# Frontend is typically on port 3000
URL="https://3000--${SLUG}.autodock.io"
Then use Chrome DevTools:
mcp__chrome-devtools__new_page with the URL to open the appmcp__chrome-devtools__navigate_page if a page is already openCall mcp__chrome-devtools__take_snapshot to get the accessibility tree. This returns:
uid identifiersUse this to plan interactions and verify content.
Call mcp__chrome-devtools__take_screenshot to capture:
fullPage: trueuid: "<element-uid>"Compare screenshots to verify:
Use Chrome DevTools to simulate user behavior:
mcp__chrome-devtools__click with uidmcp__chrome-devtools__fill with uid and valuemcp__chrome-devtools__fill_form with array of elementsmcp__chrome-devtools__hover with uidmcp__chrome-devtools__press_key with key combo (e.g., "Enter", "Control+A")mcp__chrome-devtools__drag with from_uid and to_uidExample flow - test a login form:
take_snapshot → Find login form elementsfill_form → Enter username and passwordclick → Click submit buttonwait_for → Wait for success message or redirecttake_screenshot → Verify logged-in stateCall mcp__chrome-devtools__list_console_messages to detect:
Filter by type: types: ["error", "warn"] to focus on problems.
For detailed error info, call mcp__chrome-devtools__get_console_message with the msgid.
Call mcp__chrome-devtools__list_network_requests to check:
Filter by type: resourceTypes: ["fetch", "xhr"] for API calls.
For detailed request/response, call mcp__chrome-devtools__get_network_request with the reqid.
Check for:
Call mcp__chrome-devtools__resize_page to test responsive design:
width: 375, height: 667width: 768, height: 1024width: 1920, height: 1080Take screenshots at each viewport to verify responsive behavior.
For performance analysis:
mcp__chrome-devtools__performance_start_trace with reload: true, autoStop: truemcp__chrome-devtools__performance_analyze_insight to examine specific metricsCheck Core Web Vitals:
If the app shows alerts, confirms, or prompts:
mcp__chrome-devtools__handle_dialog with action: "accept" or action: "dismiss"promptTextWhen testing a PR, combine both approaches:
Run CLI tests first (fast feedback):
ssh ... 'npm test'
Then browser verification (visual/interaction):
For UI PRs, focus on Chrome DevTools:
For API PRs, focus on CLI + network verification:
Create a persistent test report with full audit log and screenshots.
mkdir -p .autodock/reports
REPORT_DIR=".autodock/reports/$(date +%Y%m%d-%H%M%S)"
mkdir -p "$REPORT_DIR/screenshots"
Throughout Step 5, save all screenshots to the report directory:
# When taking screenshots with Chrome DevTools, save to file
mcp__chrome-devtools__take_screenshot with filePath: "$REPORT_DIR/screenshots/01-homepage.png"
mcp__chrome-devtools__take_screenshot with filePath: "$REPORT_DIR/screenshots/02-login-form.png"
# etc.
Name screenshots sequentially with descriptive names (e.g., 01-homepage.png, 02-after-login.png, 03-dashboard.png).
Create $REPORT_DIR/report.html with a full audit log:
<!DOCTYPE html>
<html>
<head>
<title>Autodock Test Report - [timestamp]</title>
<style>
body { font-family: system-ui, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; }
.status-passed { color: #22c55e; } .status-failed { color: #ef4444; }
.screenshot { max-width: 100%; border: 1px solid #e5e7eb; border-radius: 8px; margin: 10px 0; }
.step { border-left: 3px solid #3b82f6; padding-left: 16px; margin: 20px 0; }
.error { background: #fef2f2; border: 1px solid #fecaca; padding: 12px; border-radius: 6px; }
.success { background: #f0fdf4; border: 1px solid #bbf7d0; padding: 12px; border-radius: 6px; }
details { margin: 10px 0; } summary { cursor: pointer; font-weight: 600; }
</style>
</head>
<body>
<h1>Autodock Test Report</h1>
<p><strong>Target:</strong> [PR #123: "Fix onboarding flow" | onboarding | etc.]</p>
<p><strong>Environment:</strong> <a href="https://3000--[slug].autodock.io">https://3000--[slug].autodock.io</a></p>
<p><strong>Generated:</strong> [timestamp]</p>
<p><strong>Status:</strong> <span class="status-[passed|failed]">[PASSED | FAILED]</span></p>
<h2>Summary</h2>
<ul>
<li>Steps executed: X</li>
<li>Screenshots captured: Y</li>
<li>Console errors: Z</li>
<li>Network failures: W</li>
</ul>
<h2>Audit Log</h2>
<div class="step">
<h3>Step 1: Navigate to homepage</h3>
<p class="success">✅ Page loaded successfully</p>
<img src="screenshots/01-homepage.png" class="screenshot" alt="Homepage">
<details>
<summary>Page snapshot</summary>
<pre>[accessibility tree snapshot]</pre>
</details>
</div>
<div class="step">
<h3>Step 2: Click "Get Started" button</h3>
<p class="success">✅ Navigation to /signup</p>
<img src="screenshots/02-signup-page.png" class="screenshot" alt="Signup page">
</div>
<div class="step">
<h3>Step 3: Fill registration form</h3>
<p class="success">✅ Form filled with test data</p>
<details>
<summary>Form data</summary>
<pre>email: test@example.com
name: Test User
password: ********</pre>
</details>
</div>
<!-- More steps... -->
<h2>Console Messages</h2>
<div class="[error|success]">
[List of console errors/warnings, or "No errors detected"]
</div>
<h2>Network Requests</h2>
<table>
<tr><th>Method</th><th>URL</th><th>Status</th><th>Duration</th></tr>
<tr><td>POST</td><td>/api/auth/register</td><td>201</td><td>234ms</td></tr>
<!-- More requests... -->
</table>
<h2>Failed Requests</h2>
<div class="[error|success]">
[List of 4xx/5xx requests, or "All requests successful"]
</div>
</body>
</html>
Create a symlink for easy access to the most recent report:
ln -sfn "$REPORT_DIR" .autodock/reports/latest
This allows users to always open .autodock/reports/latest/report.html without knowing the timestamp.
Also create $REPORT_DIR/SUMMARY.md for quick reference:
# Test Report: [target]
**Status:** PASSED/FAILED
**Environment:** https://3000--[slug].autodock.io
**Generated:** [timestamp]
## Results
| Metric | Value |
|--------|-------|
| Steps executed | X |
| Screenshots | Y |
| Console errors | Z |
| Network failures | W |
## Screenshots


## Issues Found
- [List any failures or concerns]
## Full Report
Open [report.html](report.html) for the complete audit log.
Report comprehensive test results to the user:
Test Results
============
**Target:** <PR #123: "Fix login flow" | tests/unit/ | Full test suite>
**Environment:** <slug>.autodock.io
**Mode:** <CLI | Browser | E2E>
**Status:** <PASSED | FAILED | ERROR>
---
## CLI Test Results (if applicable)
**Summary:**
- Tests run: X
- Passed: Y
- Failed: Z
- Skipped: W
**Failed tests:**
- test_name_1: error message
- test_name_2: error message
---
## Browser Test Results (if applicable)
**Pages tested:** 3
**Screenshots captured:** 5
**Visual checks:**
- ✅ Homepage renders correctly
- ✅ Login form displays all fields
- ❌ Mobile layout has overflow issue
**Console errors:** 2 errors detected
- TypeError: Cannot read property 'map' of undefined (app.js:142)
- 404: /api/user/preferences
**Network issues:** 1 failed request
- GET /api/config → 500 Internal Server Error
**Accessibility:** Snapshot captured, X interactive elements found
---
**URLs:**
- App: https://3000--<slug>.autodock.io
- API: https://8080--<slug>.autodock.io (if applicable)
**Report:** .autodock/reports/latest/report.html
View the full audit log with screenshots by opening the report in your browser.
Tell the user how to open the report:
open .autodock/reports/latest/report.html
If CLI tests failed:
/autodock:test <specific_test> to re-run a single test"ssh ... 'cat /workspace/logs/<project>.log'"If browser tests found issues:
If everything passed:
/autodock:test --browser to do additional visual verification"Always remind:
/autodock:test again"/autodock:sync if you make local changes before re-testing"/autodock:sync manually if you make local changes/autodock:down to stop the environment when doneChrome DevTools MCP requirements:
/mcp)Quick reference - Common test flows:
/autodock:test → Auto-detect and run appropriate tests for current PR/autodock:test --browser → Browser-only: visual checks, console errors, network verification/autodock:test --e2e → Full E2E: CLI tests + browser verification/autodock:test tests/unit/ → Run specific test path via CLI/autodock:test #123 → Test a specific PR