- Update tests/README-CLEANUP.md to reflect removal of auth-debug files - Update docs/development/SECURITY_CHANGES.md to remove Gitea references - Ensures documentation accurately reflects current codebase state - Maintains consistency between docs and actual file structure
94 lines
2.7 KiB
Markdown
94 lines
2.7 KiB
Markdown
# 🧹 Test Structure Cleanup
|
|
|
|
## Changes Made
|
|
|
|
### ❌ Removed Files
|
|
|
|
- `manual/admin-login-debug.js` → Replaced by `e2e/auth.spec.ts`
|
|
- `manual/auth-db-debug.js` → Replaced by automated E2E tests
|
|
- `manual/debug-email-validation.js` → Integrated into auth E2E tests
|
|
- `e2e/auth-debug.spec.ts` → Functionality merged into `e2e/auth.spec.ts`
|
|
- `e2e/auth-debug-setup.ts` → Replaced by standard test setup
|
|
- `e2e/auth-debug-teardown.ts` → No longer needed
|
|
|
|
### ✅ 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
|
|
│ ├── test-utils.ts # ✨ New: Shared utilities
|
|
│ ├── auth.spec.ts # Authentication flows (includes admin tests)
|
|
│ ├── 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
|
|
|
|
```bash
|
|
make test-all
|
|
```
|
|
|
|
### Specific Test Types
|
|
|
|
```bash
|
|
# Unit tests
|
|
make test
|
|
|
|
# Integration tests
|
|
./tests/integration/run-integration.sh
|
|
|
|
# E2E tests
|
|
make test-e2e
|
|
```
|
|
|
|
### Debugging
|
|
|
|
Instead of manual browser scripts, use:
|
|
|
|
```bash
|
|
# Interactive E2E debugging
|
|
make test-e2e-ui
|
|
|
|
# Debug specific auth issues
|
|
bunx playwright test auth.spec.ts --debug
|
|
```
|
|
|
|
## Migration Guide
|
|
|
|
### Manual Tests → E2E Tests
|
|
|
|
| Old Manual Script | New E2E Test | Purpose |
|
|
| --------------------------- | -------------- | ------------------------------- |
|
|
| `admin-login-debug.js` | `auth.spec.ts` | Admin authentication validation |
|
|
| `auth-db-debug.js` | `auth.spec.ts` | Database auth testing |
|
|
| `debug-email-validation.js` | `auth.spec.ts` | Email format validation |
|
|
|
|
### Benefits
|
|
|
|
- ✅ Automated instead of manual
|
|
- ✅ Cross-browser testing
|
|
- ✅ CI/CD integration
|
|
- ✅ Better error reporting
|
|
- ✅ Reproducible results
|