param( [switch]$ApiOnly, [switch]$UiOnly, [switch]$All ) Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $selectedModes = @(@($ApiOnly, $UiOnly, $All) | Where-Object { $_ }) if ($selectedModes.Count -gt 1) { throw 'Cannot combine -ApiOnly, -UiOnly, and -All.' } if (-not $ApiOnly -and -not $UiOnly -and -not $All) { $ApiOnly = $true } $repoRoot = Split-Path -Parent $PSScriptRoot $artifactRoot = Join-Path $repoRoot 'test-artifacts/user-migration-e2e' $runsDir = Join-Path $artifactRoot 'runs' if ($ApiOnly -or $All) { if (Test-Path $runsDir) { Remove-Item -Recurse -Force $runsDir } } Push-Location $repoRoot try { if ($ApiOnly -or $All) { Write-Host '[user-migration-e2e] running API E2E...' go test -v ./test/e2e -count=1 } if ($All) { Write-Host '[user-migration-e2e] running full Go test suite...' go test ./... Write-Host '[user-migration-e2e] building frontend...' Push-Location (Join-Path $repoRoot 'web') try { bun run build } finally { Pop-Location } } if ($UiOnly -or $All) { Write-Host '[user-migration-e2e] running Playwright UI E2E...' Push-Location (Join-Path $repoRoot 'web') try { bunx playwright test } finally { Pop-Location } } } finally { Pop-Location }