Files
APAW/.kilo/commands/web-test.md
NW c258d16ef5 feat: add Gitea integration, E2E booking flow, Docker DNS fix, browser-launcher module
- Add tests/scripts/lib/gitea-client.js: Gitea API client with auth, comments,
  attachments, and Markdown report formatters for visual and console reports
- Add tests/scripts/lib/browser-launcher.js: shared Playwright launch config with
  --dns-resolution-order=hostname-first, realistic UA, and navigateTo() helper
  using waitUntil:'commit' + waitForLoadState('domcontentloaded')
- Add tests/scripts/e2e-booking-flow-v2.js: full E2E scenario for irina-vik.ru
  (register → book service → login → personal cabinet) with Gitea reporting
- Update visual-test-pipeline.js: GITEA_ISSUE env var, Gitea comment+attachment
  posting, browser-launcher integration, waitUntil:'commit' navigation
- Update console-error-monitor-standalone.js: same Gitea + DNS fixes
- Update capture-screenshots.js: browser-launcher integration, DNS fix
- Update docker-compose.web-testing.yml: NETWORK_MODE env var (bridge),
  DNS_RESOLUTION_ORDER, GITEA_USER/PASSWORD env passthrough, e2e-booking service
- Update tests/package.json: pin playwright to exact 1.52.0 (matches Docker image)
- Update .gitignore: add tests/visual/e2e/ for E2E screenshots
- Update .kilo/agents/visual-tester.md: Docker networking note, Gitea scripts,
  e2e-booking service, updated script table
- Update .kilo/commands/web-test.md: Docker Networking section, --issue flag,
  Gitea Integration section, e2e-booking service
- Update .kilo/commands/e2e-test.md: complete rewrite — Docker-based Playwright,
  no more MCP dependency, proper service table, Gitea integration docs
- Update .kilo/capability-index.yaml: add gitea_integration, e2e_booking_flow,
  docker_networking capabilities to visual-tester; add routing entries
2026-04-17 09:27:27 +01:00

5.0 KiB
Raw Permalink Blame History

/web-test Command

Run visual regression testing pipeline in Docker. Captures screenshots, extracts UI elements with bounding boxes, compares against baselines, and detects console/network errors.

Usage

/web-test <url> [--pages /,/about] [--threshold 0.05]

Arguments

Argument Required Description
url Yes Target URL to test

Options

Option Default Description
--pages / Comma-separated page paths
--threshold 0.05 Visual diff threshold (5%)
--visual true Run visual regression
--console true Run console error detection
--auto-fix false Auto-create Gitea Issues for errors
--issue Gitea Issue number to post results

Examples

Basic

/web-test https:// bbox.wtf

Multiple pages

/web-test https://my-app.com --pages /,/login,/about

Strict threshold

/web-test https://my-app.com --threshold 0.01

Post results to Gitea Issue

/web-test https://my-app.com --issue 42

Pipeline Steps

/web-test <url>
      ↓
1. Docker container starts (mcr.microsoft.com/playwright:v1.52.0-noble)
2. npm install pixelmatch, pngjs inside container
3. For each page × viewport (mobile, tablet, desktop):
   - Navigate to URL
   - Wait for networkidle
   - Capture fullPage screenshot
   - Extract all visible DOM elements with bounding boxes
   - Collect console errors and network failures
4. Compare current screenshots against baselines (pixelmatch)
   - Auto-create baselines on first run
   - Generate diff images (red pixels = differences)
5. Generate JSON report at tests/reports/visual-test-report.json
6. If GITEA_ISSUE is set, post formatted report + diff screenshots to Gitea Issue
7. Exit 0 if all passed, 1 if failures

Output

File Description
tests/visual/baseline/ Reference screenshots (gitignored)
tests/visual/current/ Latest screenshots (gitignored)
tests/visual/diff/ Diff images (gitignored)
tests/reports/visual-test-report.json Full report: elements, errors, diff %

Docker Compose Services

Service Command
visual-tester Full pipeline (default)
screenshot-baseline Capture baselines only
screenshot-current Capture current only
visual-compare pixelmatch comparison only
console-monitor Console/network errors only
e2e-booking E2E booking flow (irina-vik.ru)

Docker Networking

Playwright containers need proper DNS resolution. Two modes:

Local app testing (bridge network)

Default — uses host.docker.internal to reach services on the host:

docker compose -f docker/docker-compose.web-testing.yml up visual-tester

External site testing (host network)

Required for testing external URLs (irina-vik.ru, etc.) where Docker DNS fails:

NETWORK_MODE=host docker compose -f docker/docker-compose.web-testing.yml up e2e-booking

Or per-run:

docker run --rm --network host --shm-size=2g --ipc=host \
  -v ./tests:/app/tests \
  -e GITEA_ISSUE=42 \
  mcr.microsoft.com/playwright:v1.52.0-noble \
  sh -c "cd /app/tests && npm install --ignore-scripts 2>/dev/null && node scripts/e2e-booking-flow-v2.js"

The NETWORK_MODE env var controls network_mode in docker-compose. Default is bridge (for local apps), set to host for external sites.

All Playwright scripts include --dns-resolution-order=hostname-first via the shared browser-launcher.js module when DNS_RESOLUTION_ORDER=hostname-first is set.

Gitea Integration

When GITEA_ISSUE is set (via --issue flag or env var), the pipeline posts results to the specified Gitea Issue:

  • Comment body: Markdown summary table with metrics, comparison details, errors
  • Attachments: Diff screenshots uploaded as issue assets (if any differences found)
  • Auth: Uses GITEA_TOKEN env var or Basic Auth fallback (NW/eshkink0t)

Docker usage

GITEA_ISSUE=42 docker compose -f docker/docker-compose.web-testing.yml up visual-tester

Env vars

Variable Required Description
GITEA_ISSUE No Issue number to post results
GITEA_TOKEN No Pre-existing API token (else Basic Auth)
GITEA_API_URL No API base URL (default: https://git.softuniq.eu/api/v1)
GITEA_REPO No Repository path (default: UniqueSoft/APAW)

Agent Flow

/web-test <url>
      ↓
@visual-tester — runs pipeline in Docker
      ↓
[issues found?]
      ↓ yes
@the-fixer — fixes UI bugs
      ↓
@visual-tester — re-runs to verify

Exit Codes

Code Meaning
0 All tests passed
1 Visual diff > threshold or errors found

See Also

  • docker/docker-compose.web-testing.yml — Docker Compose config
  • tests/scripts/visual-test-pipeline.js — Pipeline implementation
  • .kilo/agents/visual-tester.md — Agent definition