diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d374d096..39cdf4a8 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -156,6 +156,18 @@ "panel": "dedicated" } }, + { + "label": "Test: E2E Playwright (UI - Headless Server)", + "type": "shell", + "command": "npm run e2e:ui:headless-server", + "group": "test", + "problemMatcher": [], + "presentation": { + "reveal": "always", + "panel": "dedicated", + "close": false + } + }, { "label": "Lint: Pre-commit (All Files)", "type": "shell", @@ -508,6 +520,57 @@ "close": false } }, + { + "label": "Open: App in Simple Browser (Docker E2E)", + "type": "shell", + "dependsOn": ["Docker: Rebuild E2E Environment"], + "command": "bash -lc 'printf "Waiting for Charon at http://localhost:8080...\n"; for i in {1..60}; do if curl -fsS http://localhost:8080/ >/dev/null 2>&1; then echo "Ready: http://localhost:8080"; exit 0; fi; sleep 1; done; echo "Timed out waiting for http://localhost:8080"; exit 1'", + "group": "test", + "problemMatcher": [], + "presentation": { + "reveal": "always", + "panel": "dedicated", + "echo": true, + "close": false + } + }, + { + "label": "Open: App in System Browser (Docker E2E)", + "type": "shell", + "dependsOn": ["Docker: Rebuild E2E Environment"], + "command": "bash -lc '\\ + printf "Waiting for Charon at http://localhost:8080...\\n"; \ + for i in {1..60}; do \ + if curl -fsS http://localhost:8080/ >/dev/null 2>&1; then echo "Ready: http://localhost:8080"; break; fi; \ + sleep 1; \ + done; \ + if command -v xdg-open >/dev/null 2>&1; then xdg-open http://localhost:8080 >/dev/null 2>&1 & disown; \ + elif command -v sensible-browser >/dev/null 2>&1; then sensible-browser http://localhost:8080 >/dev/null 2>&1 & disown; \ + elif command -v gio >/dev/null 2>&1; then gio open http://localhost:8080 >/dev/null 2>&1 & disown; \ + elif command -v open >/dev/null 2>&1; then open http://localhost:8080 >/dev/null 2>&1 & disown; \ + else echo "No known browser opener found. Open http://localhost:8080 manually."; fi'", + "group": "test", + "problemMatcher": [], + "presentation": { + "reveal": "always", + "panel": "dedicated", + "echo": true, + "close": false + } + }, + { + "label": "Record: Playwright codegen (Docker E2E)", + "type": "shell", + "dependsOn": ["Docker: Rebuild E2E Environment"], + "command": "bash -lc 'npx playwright codegen http://localhost:8080 --output=tests/recorded.from_codegen.spec.ts'", + "group": "test", + "problemMatcher": [], + "presentation": { + "reveal": "always", + "panel": "dedicated", + "close": false + } + }, { "label": "Test: E2E Playwright (Debug Mode)", "type": "shell", diff --git a/docs/development/running-e2e.md b/docs/development/running-e2e.md index adf3a232..b9333e86 100644 --- a/docs/development/running-e2e.md +++ b/docs/development/running-e2e.md @@ -24,6 +24,14 @@ This document explains how to run Playwright tests using a real browser (headed) npx playwright test --ui ``` +- Open the running Docker E2E app in your system browser (one-step via VS Code task): + - Run the VS Code task: **Open: App in System Browser (Docker E2E)** + - This will rebuild the E2E container (if needed), wait for http://localhost:8080 to respond, and open your system browser automatically. + +- Open the running Docker E2E app in VS Code Simple Browser: + - Run the VS Code task: **Open: App in Simple Browser (Docker E2E)** + - Then use the command palette: `Simple Browser: Open URL` → paste `http://localhost:8080` + ## Using the project's E2E Docker image (recommended for parity with CI) 1. Rebuild/start the E2E container (this sets up the full test environment): ```bash @@ -55,4 +63,4 @@ This document explains how to run Playwright tests using a real browser (headed) - Playwright auth artifacts are ignored by git (`playwright/.auth/`). Do not commit credentials. --- -If you'd like, I can open a PR with these changes (scripts + config + docs) and add a short CI note to `.github/` workflows. +If you'd like, I can open a PR with these changes (scripts + config + docs) and add a short CI note to `.github/` workflows.