learning_ai_invt_trdg/scripts/tests/reports
Saravana Achu Mac c268567bb6 fix(test): fix JSON generation and disable auto webServer
- Fixed run-e2e.sh to use numeric 0 instead of 'unknown' for test counts
- This resolves JSON parsing error when tests don't run
- Disabled webServer in playwright.config.ts due to Vite -p flag issue
- Tests now require manually starting dev server: cd web && pnpm dev -- --port 3050
- Updated comments in config with instructions for running tests
2026-05-09 13:36:22 -07:00
..
results-20260509_133516.json fix(test): fix JSON generation and disable auto webServer 2026-05-09 13:36:22 -07:00
latest-summary.json fix(test): fix JSON generation and disable auto webServer 2026-05-09 13:36:22 -07:00
latest.json fix(test): fix JSON generation and disable auto webServer 2026-05-09 13:36:22 -07:00
latest.md fix(test): fix JSON generation and disable auto webServer 2026-05-09 13:36:22 -07:00
README.md test(ui): enhance E2E test runner with AI-friendly detailed reports 2026-05-09 13:32:55 -07:00
summary-20260509_133516.json fix(test): fix JSON generation and disable auto webServer 2026-05-09 13:36:22 -07:00
test-report-20260509_133516.json fix(test): fix JSON generation and disable auto webServer 2026-05-09 13:36:22 -07:00
test-report-20260509_133516.md fix(test): fix JSON generation and disable auto webServer 2026-05-09 13:36:22 -07:00

E2E Test Reports

This directory contains detailed E2E test reports generated by the test runner script.

Report Files

Each test run generates the following files:

Timestamped Reports

  • test-report-{timestamp}.json - Full JSON report with test results, metadata, and actionable items
  • test-report-{timestamp}.md - Markdown report for human readability
  • summary-{timestamp}.json - AI-friendly summary with quick actions
  • results-{timestamp}.json - Raw Playwright JSON output
  • test-output-{timestamp}.log - Complete test output log
  • latest.json - Symlink to most recent JSON report
  • latest.md - Symlink to most recent markdown report
  • latest-summary.json - Symlink to most recent AI summary

For AI Agents

The JSON reports are designed to be easily parsed by coding agents for automated action:

Quick Summary

cat scripts/tests/reports/latest-summary.json

Key fields for AI agents:

  • for_ai_agents.quick_summary - One-line status summary
  • for_ai_agents.if_failed_check - Path to detailed log for failure analysis
  • for_ai_agents.html_report - Path to HTML report for visual inspection
  • for_ai_agents.next_action - Recommended next action

Example JSON Structure

{
  "timestamp": "20260509_133000",
  "test_status": "passed",
  "tests_total": 50,
  "tests_passed": 48,
  "tests_failed": 2,
  "duration_seconds": 120,
  "health_check": {
    "status": "healthy",
    "app_running": true,
    "app_url": "http://localhost:3050"
  },
  "for_ai_agents": {
    "quick_summary": "failed - 48/50 tests passed in 120s",
    "if_failed_check": "scripts/tests/reports/test-output-20260509_133000.log",
    "html_report": "web/playwright-report/index.html",
    "next_action": "Review failures in log and fix broken selectors or API issues"
  }
}

Running Tests

Execute the test runner script:

./scripts/tests/run-e2e.sh

This will:

  1. Install dependencies if needed
  2. Install Playwright browsers if needed
  3. Run all E2E tests
  4. Generate reports in this directory
  5. Check application health
  6. Create symlinks to latest reports

Report Locations

  • Reports Directory: scripts/tests/reports/
  • HTML Report: web/playwright-report/index.html
  • Playwright Results: web/test-results/

Using Reports for Debugging

For Humans

# View latest markdown report
cat scripts/tests/reports/latest.md

# Open HTML report
open web/playwright-report/index.html

# View test output log
cat scripts/tests/reports/latest-summary.json | jq .for_ai_agents.if_failed_check | xargs cat

For AI Agents

# Get quick status
cat scripts/tests/reports/latest-summary.json | jq .for_ai_agents.quick_summary

# Get next action
cat scripts/tests/reports/latest-summary.json | jq .for_ai_agents.next_action

# Get failure log path
cat scripts/tests/reports/latest-summary.json | jq -r .for_ai_agents.if_failed_check

Report Retention

Reports are timestamped and retained indefinitely. To clean up old reports:

# Remove reports older than 30 days
find scripts/tests/reports -name "*.json" -mtime +30 -delete
find scripts/tests/reports -name "*.md" -mtime +30 -delete
find scripts/tests/reports -name "*.log" -mtime +30 -delete

Integration with CI

The test runner can be integrated into CI pipelines:

- name: Run E2E Tests
  run: ./scripts/tests/run-e2e.sh

- name: Upload Reports
  uses: actions/upload-artifact@v3
  with:
    name: e2e-test-reports
    path: scripts/tests/reports/

AI agents can then parse the latest-summary.json to determine next actions automatically.