← back to Handbag Auth Nextjs

run-all-tests.sh

112 lines

#!/bin/bash
# Master Test Runner - Runs all tests for LUXVAULT Auction System

set -e  # Exit on any error

echo "=========================================="
echo "LUXVAULT AUCTION SYSTEM - MASTER TEST SUITE"
echo "=========================================="
echo ""

# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

TOTAL_FAILURES=0

# Function to run tests and track results
run_test_suite() {
    local name=$1
    local command=$2
    local directory=$3

    echo ""
    echo "${YELLOW}=========================================="
    echo "Running: $name"
    echo "==========================================${NC}"
    echo ""

    if [ -n "$directory" ]; then
        cd "$directory"
    fi

    if eval "$command"; then
        echo ""
        echo "${GREEN}✓ $name PASSED${NC}"
    else
        echo ""
        echo "${RED}✗ $name FAILED${NC}"
        TOTAL_FAILURES=$((TOTAL_FAILURES + 1))
    fi

    cd - > /dev/null
}

# Store starting directory
START_DIR=$(pwd)

# 1. JavaScript Unit Tests
run_test_suite \
    "JavaScript Unit Tests" \
    "npm run test:unit" \
    "/root/Projects/handbag-auth-nextjs/auction-viewer"

# 2. JavaScript Integration Tests
run_test_suite \
    "JavaScript Integration Tests" \
    "npm run test:integration" \
    "/root/Projects/handbag-auth-nextjs/auction-viewer"

# 3. JavaScript E2E Tests
run_test_suite \
    "JavaScript End-to-End Tests" \
    "npm run test:e2e" \
    "/root/Projects/handbag-auth-nextjs/auction-viewer"

# 4. JavaScript Performance Tests
run_test_suite \
    "JavaScript Performance Tests" \
    "npm run test:performance" \
    "/root/Projects/handbag-auth-nextjs/auction-viewer"

# 5. Python Tests
run_test_suite \
    "Python Scraper Tests" \
    "pytest -v --cov=. --cov-report=term-missing" \
    "/root/Projects/handbag-auth-nextjs/scripts"

# Return to starting directory
cd "$START_DIR"

# Generate summary report
echo ""
echo "=========================================="
echo "TEST SUITE SUMMARY"
echo "=========================================="
echo ""

if [ $TOTAL_FAILURES -eq 0 ]; then
    echo "${GREEN}✓ ALL TEST SUITES PASSED!${NC}"
    echo ""
    echo "Test Results:"
    echo "  - JavaScript Unit Tests: PASSED"
    echo "  - JavaScript Integration Tests: PASSED"
    echo "  - JavaScript E2E Tests: PASSED"
    echo "  - JavaScript Performance Tests: PASSED"
    echo "  - Python Scraper Tests: PASSED"
    echo ""
    echo "Coverage Reports:"
    echo "  - JavaScript: auction-viewer/coverage/lcov-report/index.html"
    echo "  - Python: scripts/htmlcov/index.html"
    echo ""
    exit 0
else
    echo "${RED}✗ $TOTAL_FAILURES TEST SUITE(S) FAILED${NC}"
    echo ""
    echo "Please review the output above for details."
    echo ""
    exit 1
fi