|
| 1 | +# Production-readiness test for chrome-devtools-mcp + overtime-ag-plugin |
| 2 | +# Run from repo root: .\scripts\test-production-readiness.ps1 |
| 3 | +# Use -SkipE2E to skip headed browser / live-site tests |
| 4 | + |
| 5 | +param( |
| 6 | + [switch]$SkipE2E = $false |
| 7 | +) |
| 8 | + |
| 9 | +$ErrorActionPreference = "Stop" |
| 10 | +$RepoRoot = Split-Path -Parent $PSScriptRoot |
| 11 | + |
| 12 | +function Write-Step { param($n, $msg) Write-Host "`n=== [$n] $msg ===" -ForegroundColor Cyan } |
| 13 | +function Write-Pass { param($msg) Write-Host "PASS: $msg" -ForegroundColor Green } |
| 14 | +function Write-Fail { param($msg) Write-Host "FAIL: $msg" -ForegroundColor Red; exit 1 } |
| 15 | +function Write-Skip { param($msg) Write-Host "SKIP: $msg" -ForegroundColor Yellow } |
| 16 | + |
| 17 | +Push-Location $RepoRoot |
| 18 | + |
| 19 | +# --- 1. Chrome DevTools MCP --- |
| 20 | +Write-Step 1 "Chrome DevTools MCP: build + lint + tests" |
| 21 | +if (-not (Get-Command node -ErrorAction SilentlyContinue)) { |
| 22 | + Write-Fail "Node.js not found. Install Node 20+ and ensure it's in PATH." |
| 23 | +} |
| 24 | +if (-not (Test-Path "package.json")) { |
| 25 | + Write-Fail "Not in chrome-devtools-mcp repo root. Expected package.json." |
| 26 | +} |
| 27 | +if (-not (Test-Path "node_modules")) { npm install } else { npm ci 2>$null; if ($LASTEXITCODE -ne 0) { npm install } } |
| 28 | +npm run bundle 2>&1 | Out-Null |
| 29 | +if ($LASTEXITCODE -ne 0) { |
| 30 | + Write-Fail "Chrome DevTools MCP bundle failed" |
| 31 | +} |
| 32 | +$env:CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS = "true" |
| 33 | +npm run test:no-build 2>&1 |
| 34 | +if ($LASTEXITCODE -ne 0) { |
| 35 | + Write-Fail "Chrome DevTools MCP tests failed" |
| 36 | +} |
| 37 | +Write-Pass "Chrome DevTools MCP tests passed" |
| 38 | + |
| 39 | +# --- 2. Overtime-ag-plugin: unit tests --- |
| 40 | +Write-Step 2 "Overtime-ag-plugin: pytest" |
| 41 | +$PluginProject = Join-Path $RepoRoot ".claude\plugins\overtime-ag-plugin\project" |
| 42 | +if (-not (Test-Path (Join-Path $PluginProject "pyproject.toml"))) { |
| 43 | + Write-Fail "Overtime-ag-plugin project not found at $PluginProject" |
| 44 | +} |
| 45 | +Push-Location $PluginProject |
| 46 | +uv sync --extra dev 2>&1 | Out-Null |
| 47 | +if ($LASTEXITCODE -ne 0) { Write-Fail "uv sync failed" } |
| 48 | +uv run pytest tests/ -v 2>&1 |
| 49 | +if ($LASTEXITCODE -ne 0) { |
| 50 | + Pop-Location |
| 51 | + Write-Fail "Overtime-ag-plugin pytest failed" |
| 52 | +} |
| 53 | +Write-Pass "Overtime-ag-plugin pytest passed" |
| 54 | +Pop-Location |
| 55 | + |
| 56 | +# --- 3. Overtime-ag-plugin: replay smoke (from existing recording) --- |
| 57 | +Write-Step 3 "Overtime-ag-plugin: replay-only smoke" |
| 58 | +$RecordingPath = Join-Path $PluginProject "data\cbb_recording.json" |
| 59 | +if (Test-Path $RecordingPath) { |
| 60 | + Push-Location $PluginProject |
| 61 | + uv run overtime-ag-scrape --advanced-mode --replay-only --recording data/cbb_recording.json --out data/cbb_test.json --log-level INFO 2>&1 |
| 62 | + if ($LASTEXITCODE -ne 0) { |
| 63 | + Pop-Location |
| 64 | + Write-Fail "Overtime-ag replay-only smoke failed" |
| 65 | + } |
| 66 | + $OutPath = Join-Path $PluginProject "data\cbb_test.json" |
| 67 | + if (Test-Path $OutPath) { |
| 68 | + $size = (Get-Item $OutPath).Length |
| 69 | + Write-Pass "Replay produced data/cbb_test.json ($size bytes)" |
| 70 | + } else { |
| 71 | + Pop-Location |
| 72 | + Write-Fail "Replay did not create data/cbb_test.json" |
| 73 | + } |
| 74 | + Pop-Location |
| 75 | +} else { |
| 76 | + Write-Skip "data/cbb_recording.json not found. Run record-cbb skill first." |
| 77 | +} |
| 78 | + |
| 79 | +# --- 4. E2E: headed record (optional, requires browser) --- |
| 80 | +if (-not $SkipE2E) { |
| 81 | + Write-Step 4 "E2E: Full record+replay (headed) - manual verification" |
| 82 | + Write-Skip "E2E requires headed browser and live site. Run manually:" |
| 83 | + Write-Host " cd .claude\plugins\overtime-ag-plugin\project" |
| 84 | + Write-Host " uv run overtime-ag-scrape --advanced-mode --no-headless --log-level DEBUG --recording data/cbb_recording.json --out data/cbb.json" |
| 85 | + Write-Host " # Then verify data/cbb.json and data/cbb_recording.json contain Offering.asmx calls" |
| 86 | +} else { |
| 87 | + Write-Step 4 "E2E: skipped (use without -SkipE2E to see manual instructions)" |
| 88 | +} |
| 89 | + |
| 90 | +# --- Summary --- |
| 91 | +Write-Host "`n=== Production-readiness checks complete ===" -ForegroundColor Green |
| 92 | +Pop-Location |
0 commit comments