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
210 lines
6.8 KiB
Bash
210 lines
6.8 KiB
Bash
#!/usr/bin/env bash
|
||
|
||
# Comprehensive Playwright Testing Script with Console Error Monitoring
|
||
# Runs both mock-based e2e tests and real API integration tests
|
||
# Includes SSH tunnel management and service orchestration
|
||
|
||
set -e # Exit on any error
|
||
|
||
# Colors for output
|
||
RED='\033[0;31m'
|
||
GREEN='\033[0;32m'
|
||
YELLOW='\033[1;33m'
|
||
BLUE='\033[0;34m'
|
||
PURPLE='\033[0;35m'
|
||
CYAN='\033[0;36m'
|
||
NC='\033[0m' # No Color
|
||
|
||
# Configuration
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
|
||
ROA2WEB_DIR="$PROJECT_ROOT/roa2web"
|
||
FRONTEND_DIR="$SCRIPT_DIR"
|
||
BACKEND_DIR="$SCRIPT_DIR/../backend"
|
||
|
||
# Test configuration
|
||
RUN_MOCK_TESTS=true
|
||
RUN_INTEGRATION_TESTS=true
|
||
CLEANUP_ON_EXIT=true
|
||
GENERATE_REPORTS=true
|
||
CHECK_SERVICES=true
|
||
|
||
# Service PIDs for cleanup
|
||
BACKEND_PID=""
|
||
FRONTEND_PID=""
|
||
TUNNEL_ACTIVE=false
|
||
|
||
# Logging functions
|
||
log_info() {
|
||
echo -e "${BLUE}ℹ️ $1${NC}"
|
||
}
|
||
|
||
log_success() {
|
||
echo -e "${GREEN}✅ $1${NC}"
|
||
}
|
||
|
||
log_warning() {
|
||
echo -e "${YELLOW}⚠️ $1${NC}"
|
||
}
|
||
|
||
log_error() {
|
||
echo -e "${RED}❌ $1${NC}"
|
||
}
|
||
|
||
log_step() {
|
||
echo -e "${PURPLE}🔧 $1${NC}"
|
||
}
|
||
|
||
log_test() {
|
||
echo -e "${CYAN}🧪 $1${NC}"
|
||
}
|
||
|
||
# Simple version - just run the tests
|
||
main() {
|
||
echo -e "${PURPLE}"
|
||
echo "╔══════════════════════════════════════════════════════════════╗"
|
||
echo "║ ROA2WEB Comprehensive Playwright Testing Suite ║"
|
||
echo "║ ║"
|
||
echo "║ • Console Error Monitoring ║"
|
||
echo "║ • Real Oracle Data Integration ║"
|
||
echo "║ • Performance Regression Testing ║"
|
||
echo "║ • Mock-based E2E Testing ║"
|
||
echo "╚══════════════════════════════════════════════════════════════╝"
|
||
echo -e "${NC}"
|
||
echo ""
|
||
|
||
local start_time=$(date +%s)
|
||
|
||
log_info "Starting ROA2WEB test execution..."
|
||
echo ""
|
||
|
||
# Check if services are running
|
||
log_step "Checking service availability..."
|
||
|
||
# Check backend
|
||
if curl -s http://localhost:8000/health > /dev/null 2>&1; then
|
||
log_success "Backend service is available"
|
||
else
|
||
log_warning "Backend service not available - some tests may fail"
|
||
fi
|
||
|
||
# Check frontend
|
||
if curl -s http://localhost:3001 > /dev/null 2>&1; then
|
||
log_success "Frontend service is available"
|
||
else
|
||
log_warning "Frontend service not available - tests may fail"
|
||
fi
|
||
|
||
# Check SSH tunnel (check if Oracle port is accessible)
|
||
if nc -z localhost 1521 2>/dev/null; then
|
||
log_success "SSH tunnel appears to be active (port 1521 accessible)"
|
||
else
|
||
log_warning "SSH tunnel may not be active - integration tests may fail"
|
||
log_info "Run: cd ../../../.. && ./ssh_tunnel.sh start"
|
||
fi
|
||
|
||
echo ""
|
||
|
||
# Ensure test results directory exists
|
||
mkdir -p test-results
|
||
|
||
# Track test results
|
||
MOCK_TESTS_RESULT=0
|
||
INTEGRATION_TESTS_RESULT=0
|
||
|
||
# Run mock-based tests if requested
|
||
if [ "$1" != "--no-mock" ]; then
|
||
log_test "Running mock-based E2E tests..."
|
||
|
||
if npx playwright test --config=playwright.config.js --reporter=html,json,junit; then
|
||
log_success "Mock-based E2E tests completed successfully"
|
||
else
|
||
log_error "Mock-based E2E tests failed"
|
||
MOCK_TESTS_RESULT=1
|
||
fi
|
||
echo ""
|
||
fi
|
||
|
||
# Run integration tests if requested
|
||
if [ "$1" != "--no-integration" ]; then
|
||
log_test "Running real API integration tests..."
|
||
|
||
if npx playwright test --config=playwright.real-api.config.js --reporter=html,json,junit; then
|
||
log_success "Real API integration tests completed successfully"
|
||
else
|
||
log_error "Real API integration tests failed"
|
||
INTEGRATION_TESTS_RESULT=1
|
||
fi
|
||
echo ""
|
||
fi
|
||
|
||
# Calculate execution time
|
||
local end_time=$(date +%s)
|
||
local execution_time=$((end_time - start_time))
|
||
local minutes=$((execution_time / 60))
|
||
local seconds=$((execution_time % 60))
|
||
|
||
echo ""
|
||
echo -e "${PURPLE}╔══════════════════════════════════════════════════════════════╗${NC}"
|
||
echo -e "${PURPLE}║ Test Execution Summary ║${NC}"
|
||
echo -e "${PURPLE}╚══════════════════════════════════════════════════════════════╝${NC}"
|
||
echo ""
|
||
|
||
if [ $MOCK_TESTS_RESULT -eq 0 ]; then
|
||
log_success "Mock-based E2E Tests: PASSED"
|
||
else
|
||
log_error "Mock-based E2E Tests: FAILED"
|
||
fi
|
||
|
||
if [ $INTEGRATION_TESTS_RESULT -eq 0 ]; then
|
||
log_success "Real API Integration Tests: PASSED"
|
||
else
|
||
log_error "Real API Integration Tests: FAILED"
|
||
fi
|
||
|
||
echo ""
|
||
log_info "Total Execution Time: ${minutes}m ${seconds}s"
|
||
echo ""
|
||
log_info "Test reports available at:"
|
||
log_info " - HTML Reports: playwright-report/ and playwright-report-integration/"
|
||
log_info " - JSON Results: test-results/*.json"
|
||
log_info " - JUnit Results: test-results/*.xml"
|
||
echo ""
|
||
|
||
# Final result
|
||
if [ $MOCK_TESTS_RESULT -eq 0 ] && [ $INTEGRATION_TESTS_RESULT -eq 0 ]; then
|
||
log_success "🎉 All tests completed successfully!"
|
||
echo ""
|
||
log_info "✨ Console error monitoring detected no critical issues"
|
||
log_info "🚀 Performance baselines met for all operations"
|
||
log_info "🔒 Real Oracle data integration working correctly"
|
||
echo ""
|
||
exit 0
|
||
else
|
||
log_error "❌ Some tests failed - check reports for details"
|
||
echo ""
|
||
exit 1
|
||
fi
|
||
}
|
||
|
||
# Show usage if help requested
|
||
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
||
echo "ROA2WEB Comprehensive Playwright Testing Script"
|
||
echo ""
|
||
echo "Usage: $0 [options]"
|
||
echo ""
|
||
echo "Options:"
|
||
echo " --no-mock Skip mock-based E2E tests"
|
||
echo " --no-integration Skip real API integration tests"
|
||
echo " --help, -h Show this help message"
|
||
echo ""
|
||
echo "Prerequisites:"
|
||
echo " - SSH tunnel active: ./ssh_tunnel.sh start"
|
||
echo " - Backend running: uvicorn app.main:app --reload --host 0.0.0.0 --port 8000"
|
||
echo " - Frontend running: npm run dev"
|
||
echo ""
|
||
exit 0
|
||
fi
|
||
|
||
# Execute main function with all arguments
|
||
main "$@" |