Files
rxminder/tests/README-CLEANUP.md
William Valentin 475c2e5469 docs: add comprehensive test cleanup documentation
- Document removal of manual browser debugging scripts
- Outline new automated E2E test structure
- Provide migration guide from manual to automated tests
- Include running instructions for all test types
- Add benefits of new testing approach
2025-09-08 01:43:02 -07:00

2.6 KiB

🧹 Test Structure Cleanup

Changes Made

Removed Files

  • manual/admin-login-debug.js → Replaced by e2e/auth-debug.spec.ts
  • manual/auth-db-debug.js → Replaced by automated E2E tests
  • manual/debug-email-validation.js → Integrated into auth E2E tests

Optimizations

  • Consolidated mock files with index.js
  • Created shared test utilities in e2e/test-utils.ts
  • Added integration test runner script
  • Removed duplicate test patterns

📁 Current Structure

tests/
├── __mocks__/                  # Consolidated mocks
│   ├── index.js               # ✨ New: Mock aggregator
│   ├── node-fetch.js          # HTTP mocking
│   └── uuid.js                # UUID mocking
├── integration/               # Service integration tests
│   ├── production.test.js     # Production readiness
│   └── run-integration.sh     # ✨ New: Test runner
├── e2e/                       # End-to-end tests
│   ├── auth-debug.spec.ts     # ✨ New: Replaces manual auth tests
│   ├── test-utils.ts          # ✨ New: Shared utilities
│   ├── auth.spec.ts           # Authentication flows
│   ├── medication.spec.ts     # Medication management
│   ├── admin.spec.ts          # Admin interface
│   ├── ui-navigation.spec.ts  # UI and navigation
│   ├── reminders.spec.ts      # Reminder system
│   ├── fixtures.ts            # Test fixtures
│   └── helpers.ts             # Test helpers
└── setup.ts                   # Global test setup

Running Tests After Cleanup

All Tests

make test-all

Specific Test Types

# Unit tests
make test

# Integration tests
./tests/integration/run-integration.sh

# E2E tests
make test-e2e

Debugging

Instead of manual browser scripts, use:

# Interactive E2E debugging
make test-e2e-ui

# Debug specific auth issues
bunx playwright test auth-debug.spec.ts --debug

Migration Guide

Manual Tests → E2E Tests

Old Manual Script New E2E Test Purpose
admin-login-debug.js auth-debug.spec.ts Admin authentication validation
auth-db-debug.js auth-debug.spec.ts Database auth testing
debug-email-validation.js auth-debug.spec.ts Email format validation

Benefits

  • Automated instead of manual
  • Cross-browser testing
  • CI/CD integration
  • Better error reporting
  • Reproducible results