Initial commit: ROA2WEB - FastAPI + Vue.js + Telegram Bot
Modern ERP Reports Application with microservices architecture Tech Stack: - Backend: FastAPI + python-oracledb (Oracle DB integration) - Frontend: Vue.js 3 + PrimeVue + Vite - Telegram Bot: python-telegram-bot + SQLite - Infrastructure: Shared database pool, JWT authentication, SSH tunnel Features: - FastAPI backend with async Oracle connection pool - Vue.js 3 responsive frontend with PrimeVue components - Telegram bot alternative interface - Microservices architecture with shared components - Complete deployment support (Linux Docker + Windows IIS) - Comprehensive testing (Playwright E2E + pytest) Repository Structure: - reports-app/ - Main application (backend, frontend, telegram-bot) - shared/ - Shared components (database pool, auth, utils) - deployment/ - Deployment scripts (Linux & Windows) - docs/ - Project documentation - security/ - Security scanning and git hooks
This commit is contained in:
364
reports-app/frontend/tests/integration/README.md
Normal file
364
reports-app/frontend/tests/integration/README.md
Normal file
@@ -0,0 +1,364 @@
|
||||
# ROA2WEB Integration Tests with Console Error Monitoring
|
||||
|
||||
This directory contains comprehensive integration tests for the ROA2WEB application, implementing the full Playwright testing plan with console error monitoring and real Oracle data validation.
|
||||
|
||||
## 🎯 Overview
|
||||
|
||||
The integration test suite provides:
|
||||
|
||||
- **Console Error Monitoring** - Comprehensive tracking and classification of frontend errors
|
||||
- **Real Oracle Data Testing** - Integration tests using actual CONTAFIN_ORACLE credentials
|
||||
- **Performance Regression Testing** - Automated baseline validation and monitoring
|
||||
- **Cross-Schema Validation** - Testing data flow between Oracle schemas
|
||||
- **Health Monitoring** - Backend service and database connectivity validation
|
||||
|
||||
## 🏗️ Test Architecture
|
||||
|
||||
```
|
||||
tests/integration/
|
||||
├── real-auth/ # Real authentication tests
|
||||
│ └── oracle-login.spec.js # CONTAFIN_ORACLE credential testing
|
||||
├── real-data/ # Real data integration tests
|
||||
│ └── romfast-reports.spec.js # ROMFAST company data validation
|
||||
├── api-endpoints/ # Backend API validation
|
||||
│ ├── health-check.spec.js # Service health monitoring
|
||||
│ └── data-consistency.spec.js # Cross-schema data validation
|
||||
├── console-monitoring/ # Console error analysis
|
||||
│ ├── error-tracking.spec.js # Error pattern detection
|
||||
│ └── performance-monitoring.spec.js # Performance regression testing
|
||||
├── global-setup.js # Test environment setup
|
||||
├── global-teardown.js # Test cleanup
|
||||
└── README.md # This file
|
||||
```
|
||||
|
||||
## 🔧 Setup and Configuration
|
||||
|
||||
### 1. Environment Configuration
|
||||
|
||||
Copy the example environment file:
|
||||
```bash
|
||||
cp .env.test.example .env.test
|
||||
```
|
||||
|
||||
Edit `.env.test` with your database configuration:
|
||||
```bash
|
||||
# Oracle Database (through SSH tunnel)
|
||||
ORACLE_USER=CONTAFIN_ORACLE
|
||||
ORACLE_PASSWORD=your_password_here
|
||||
ORACLE_HOST=localhost
|
||||
ORACLE_PORT=1521
|
||||
ORACLE_SID=ROA
|
||||
|
||||
# Test Credentials
|
||||
TEST_USERNAME=MARIUS M
|
||||
TEST_PASSWORD=PAROLA9911
|
||||
TEST_COMPANY=ROMFAST
|
||||
```
|
||||
|
||||
### 2. Prerequisites
|
||||
|
||||
- **SSH Tunnel Active**: Oracle database accessible via SSH tunnel
|
||||
- **Backend Running**: FastAPI backend on port 8000
|
||||
- **Frontend Running**: Vue.js frontend on port 3001
|
||||
- **Node.js**: v16+ with npm
|
||||
- **Python**: v3.8+ with backend dependencies
|
||||
|
||||
### 3. Service Dependencies
|
||||
|
||||
Ensure all services are running:
|
||||
```bash
|
||||
# SSH Tunnel
|
||||
cd /path/to/roa2web
|
||||
./ssh_tunnel.sh start
|
||||
|
||||
# Backend
|
||||
cd reports-app/backend
|
||||
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
|
||||
|
||||
# Frontend
|
||||
cd reports-app/frontend
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 🚀 Running Tests
|
||||
|
||||
### Quick Start - Comprehensive Test Suite
|
||||
|
||||
Run all tests with service management:
|
||||
```bash
|
||||
./run-comprehensive-tests.sh
|
||||
```
|
||||
|
||||
### Individual Test Categories
|
||||
|
||||
**Real Authentication Tests:**
|
||||
```bash
|
||||
npx playwright test tests/integration/real-auth/ --config=playwright.real-api.config.js
|
||||
```
|
||||
|
||||
**ROMFAST Data Integration:**
|
||||
```bash
|
||||
npx playwright test tests/integration/real-data/ --config=playwright.real-api.config.js
|
||||
```
|
||||
|
||||
**Console Error Monitoring:**
|
||||
```bash
|
||||
npx playwright test tests/integration/console-monitoring/ --config=playwright.real-api.config.js
|
||||
```
|
||||
|
||||
**Backend Health Monitoring:**
|
||||
```bash
|
||||
npx playwright test tests/integration/api-endpoints/ --config=playwright.real-api.config.js
|
||||
```
|
||||
|
||||
### Test Runner Options
|
||||
|
||||
```bash
|
||||
# Skip mock tests, run integration only
|
||||
./run-comprehensive-tests.sh --no-mock
|
||||
|
||||
# Skip integration tests, run mock only
|
||||
./run-comprehensive-tests.sh --no-integration
|
||||
|
||||
# Don't cleanup services (for debugging)
|
||||
./run-comprehensive-tests.sh --no-cleanup
|
||||
|
||||
# Skip report generation
|
||||
./run-comprehensive-tests.sh --no-reports
|
||||
```
|
||||
|
||||
## 📊 Console Error Monitoring
|
||||
|
||||
### Error Classification System
|
||||
|
||||
The test suite automatically classifies console messages:
|
||||
|
||||
- **CRITICAL**: Authentication failures, database errors, uncaught exceptions
|
||||
- **WARNING**: Network failures, 404 errors, component warnings
|
||||
- **INFO**: Development messages, HMR notifications, DevTools
|
||||
- **UNKNOWN**: Unclassified error patterns
|
||||
|
||||
### Performance Baselines
|
||||
|
||||
Automated validation against performance baselines:
|
||||
|
||||
```javascript
|
||||
PerformanceBaselines = {
|
||||
loginTime: 2000, // Max 2s for login
|
||||
dashboardLoad: 3000, // Max 3s for dashboard
|
||||
reportGeneration: 5000, // Max 5s for reports
|
||||
apiResponse: 1500, // Max 1.5s for API calls
|
||||
pageLoad: 4000 // Max 4s for page loads
|
||||
}
|
||||
```
|
||||
|
||||
### Error Pattern Detection
|
||||
|
||||
Automatic detection of recurring error patterns:
|
||||
- Failed fetch requests
|
||||
- 404 Not Found errors
|
||||
- JavaScript TypeErrors
|
||||
- Vue component warnings
|
||||
- Oracle connection issues
|
||||
|
||||
## 🔍 Test Categories
|
||||
|
||||
### Real Authentication Tests (`real-auth/`)
|
||||
|
||||
- **Oracle Login Testing**: Validates CONTAFIN_ORACLE authentication
|
||||
- **JWT Token Management**: Tests token storage and expiration
|
||||
- **Session Persistence**: Validates session across page reloads
|
||||
- **Invalid Credentials**: Tests error handling for bad credentials
|
||||
- **Performance Monitoring**: Measures auth response times
|
||||
|
||||
### Real Data Integration (`real-data/`)
|
||||
|
||||
- **ROMFAST Data Loading**: Tests real company data integration
|
||||
- **Invoice Schema Validation**: Validates Oracle invoice data fields
|
||||
- **Payment Data Testing**: Tests payment data structure and loading
|
||||
- **Data Filtering**: Tests search and filter functionality
|
||||
- **Dashboard Metrics**: Validates dashboard accuracy with real data
|
||||
- **Performance Under Load**: Tests data loading performance
|
||||
|
||||
### API Endpoint Validation (`api-endpoints/`)
|
||||
|
||||
- **Health Check Monitoring**: Validates backend and database health
|
||||
- **SSH Tunnel Dependency**: Tests tunnel connectivity requirements
|
||||
- **Error Rate Monitoring**: Tracks API error patterns
|
||||
- **Concurrent Load Testing**: Tests backend under concurrent requests
|
||||
- **Resource Usage Monitoring**: Detects memory leaks and resource issues
|
||||
- **Cross-Schema Data Validation**: Tests Oracle schema relationships
|
||||
|
||||
### Console Error Analysis (`console-monitoring/`)
|
||||
|
||||
- **Error Pattern Detection**: Identifies recurring error patterns
|
||||
- **Performance Warning Detection**: Monitors performance-related warnings
|
||||
- **Error Context Analysis**: Provides debugging context for errors
|
||||
- **Comprehensive Error Reporting**: Generates detailed error reports
|
||||
- **Memory Leak Detection**: Monitors JavaScript memory usage
|
||||
- **Performance Regression Testing**: Validates performance consistency
|
||||
|
||||
## 📈 Performance Monitoring
|
||||
|
||||
### Metrics Collected
|
||||
|
||||
- **Page Load Times**: DOM content loaded, first paint, interactive
|
||||
- **API Response Times**: Individual and average response times
|
||||
- **Network Resource Timing**: Resource loading performance
|
||||
- **Memory Usage**: JavaScript heap size monitoring
|
||||
- **Error Frequencies**: Console error occurrence rates
|
||||
|
||||
### Regression Detection
|
||||
|
||||
- **Baseline Validation**: Automatic comparison against performance baselines
|
||||
- **Consistency Analysis**: Validates performance across multiple runs
|
||||
- **Outlier Detection**: Identifies abnormal performance spikes
|
||||
- **Trend Analysis**: Monitors performance degradation over time
|
||||
|
||||
## 🏥 Health Monitoring
|
||||
|
||||
### Service Health Checks
|
||||
|
||||
- **Backend Health**: `/health` endpoint validation
|
||||
- **Database Connectivity**: Oracle connection through SSH tunnel
|
||||
- **Frontend Availability**: Vue.js application responsiveness
|
||||
- **SSH Tunnel Status**: Tunnel connectivity validation
|
||||
|
||||
### Error Handling Validation
|
||||
|
||||
- **Graceful Degradation**: Tests behavior during service failures
|
||||
- **Error Message Clarity**: Validates user-facing error messages
|
||||
- **Recovery Mechanisms**: Tests automatic recovery from failures
|
||||
- **Fallback Behavior**: Validates fallback when services unavailable
|
||||
|
||||
## 📋 Test Reports
|
||||
|
||||
### Report Types Generated
|
||||
|
||||
- **HTML Reports**: Interactive test results with screenshots
|
||||
- **JSON Reports**: Machine-readable test data
|
||||
- **JUnit Reports**: CI/CD integration format
|
||||
- **Console Error Reports**: Detailed error analysis
|
||||
- **Performance Reports**: Performance metrics and trends
|
||||
|
||||
### Report Locations
|
||||
|
||||
```
|
||||
test-results/
|
||||
├── playwright-report-integration/ # HTML reports
|
||||
├── integration-results.json # JSON results
|
||||
├── integration-junit.xml # JUnit format
|
||||
├── integration-summary.json # Combined summary
|
||||
└── reports/ # Additional reports
|
||||
└── comprehensive-test-report-*.json
|
||||
```
|
||||
|
||||
## 🔧 Debugging and Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
**SSH Tunnel Not Running:**
|
||||
```bash
|
||||
cd /path/to/roa2web
|
||||
./ssh_tunnel.sh status
|
||||
./ssh_tunnel.sh start
|
||||
```
|
||||
|
||||
**Backend Not Accessible:**
|
||||
```bash
|
||||
curl http://localhost:8000/health
|
||||
# Should return: {"database":"connected","api":"healthy"}
|
||||
```
|
||||
|
||||
**Frontend Not Running:**
|
||||
```bash
|
||||
curl http://localhost:3001
|
||||
# Should return HTML content
|
||||
```
|
||||
|
||||
**Oracle Connection Issues:**
|
||||
- Verify SSH tunnel is active
|
||||
- Check Oracle credentials in environment
|
||||
- Validate database accessibility through tunnel
|
||||
|
||||
### Debug Mode
|
||||
|
||||
Run tests with detailed logging:
|
||||
```bash
|
||||
DEBUG=1 npx playwright test --config=playwright.real-api.config.js
|
||||
```
|
||||
|
||||
View console messages during test execution:
|
||||
```bash
|
||||
npx playwright test --headed --config=playwright.real-api.config.js
|
||||
```
|
||||
|
||||
### Log Files
|
||||
|
||||
Test execution logs are available in:
|
||||
- `frontend.log` - Frontend service logs
|
||||
- `backend.log` - Backend service logs
|
||||
- `test-results/*.log` - Individual test logs
|
||||
|
||||
## 🎯 Success Criteria
|
||||
|
||||
### Passing Integration Tests
|
||||
|
||||
- ✅ Zero critical console errors with real data
|
||||
- ✅ Response times under baseline thresholds
|
||||
- ✅ 100% coverage for ROMFAST company flows
|
||||
- ✅ Automatic error pattern detection working
|
||||
- ✅ Performance baselines consistently met
|
||||
- ✅ Cross-schema data validation passing
|
||||
- ✅ Health monitoring detecting issues correctly
|
||||
|
||||
### Performance Requirements
|
||||
|
||||
- Login: < 2 seconds
|
||||
- Dashboard load: < 3 seconds
|
||||
- Report generation: < 5 seconds
|
||||
- API responses: < 1.5 seconds
|
||||
- Page loads: < 4 seconds
|
||||
|
||||
### Error Tolerance
|
||||
|
||||
- Critical errors: 0 allowed
|
||||
- Warning errors: < 10 per test run
|
||||
- Performance degradation: < 50% variance
|
||||
- Memory leaks: < 100% memory growth
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
### Adding New Integration Tests
|
||||
|
||||
1. Create test file in appropriate category directory
|
||||
2. Import required utilities from `../../utils/`
|
||||
3. Use `setupConsoleCapture(page)` in `beforeEach`
|
||||
4. Use `assertNoCriticalErrors(page, expect)` for validation
|
||||
5. Generate error reports in `afterEach`
|
||||
|
||||
### Test Utilities Available
|
||||
|
||||
- `setupConsoleCapture()` - Console monitoring setup
|
||||
- `authenticateWithRealCredentials()` - Real Oracle authentication
|
||||
- `selectCompany()` - Company selection helper
|
||||
- `assertNoCriticalErrors()` - Error validation
|
||||
- `generateErrorReport()` - Comprehensive error reporting
|
||||
- `PerformanceMonitor` - Performance measurement utilities
|
||||
|
||||
### Best Practices
|
||||
|
||||
- Always use real credentials for integration tests
|
||||
- Monitor console errors in all tests
|
||||
- Validate performance against baselines
|
||||
- Generate comprehensive error reports
|
||||
- Test with actual Oracle data when possible
|
||||
- Clean up test state between runs
|
||||
|
||||
---
|
||||
|
||||
**Integration Test Status**: ✅ Fully Implemented
|
||||
**Console Monitoring**: ✅ Active
|
||||
**Real Data Testing**: ✅ ROMFAST Validated
|
||||
**Performance Monitoring**: ✅ Baseline Tracking
|
||||
**Error Analysis**: ✅ Pattern Detection Active
|
||||
Reference in New Issue
Block a user