costco-grocery-list/backend/public/TEST_SUITE_README.md

1.5 KiB

API Test Suite

The test suite has been reorganized into separate files for better maintainability:

New Modular Structure ( Complete)

  • api-tests.html - Main HTML file
  • test-config.js - Global state management
  • test-definitions.js - All 62 test cases across 8 categories
  • test-runner.js - Test execution logic
  • test-ui.js - UI manipulation functions
  • test-styles.css - All CSS styles

How to Use

  1. Start the dev server: docker-compose -f docker-compose.dev.yml up
  2. Navigate to: http://localhost:5000/test/api-tests.html
  3. Configure credentials (default: admin/admin123)
  4. Click "▶ Run All Tests"

Features

  • 62 comprehensive tests
  • Collapsible test cards (collapsed by default)
  • Expected field validation with visual indicators
  • Color-coded HTTP status badges
  • Auto-expansion on test run
  • Expand/Collapse all buttons
  • Real-time pass/fail/error states
  • Summary dashboard

File Structure

backend/public/
├── api-tests.html          # Main entry point (use this)
├── test-config.js          # State management (19 lines)
├── test-definitions.js     # Test cases (450+ lines)
├── test-runner.js          # Test execution (160+ lines)
├── test-ui.js              # UI functions (90+ lines)
└── test-styles.css         # All styles (310+ lines)

Old File

  • api-test.html - Original monolithic version (kept for reference)

Total: ~1030 lines split into 6 clean, modular files