# ============================
# Unit and Integration Tests
# ============================

# Run unit tests
test-unit:
    cargo test --lib --all-features

# Run integration tests
test-integration:
    cargo test --test '*' --features test-utils -- --nocapture

# ============================
# E2E Test Commands (New Unified System)
# ============================

# Quick E2E test with defaults (native + debug server)
test-e2e:
    ./run-e2e-tests.sh

# Test specific implementation against debug server
test-e2e-native:
    ./run-e2e-tests.sh native debug

test-e2e-wasm-core:
    ./run-e2e-tests.sh wasm-core debug

# Test against QEMU server
test-e2e-qemu:
    ./run-e2e-tests.sh native qemu

# Run full test matrix (all implementations × all servers)
test-e2e-all:
    ./run-e2e-tests.sh all all

# Run essential tests only
test-e2e-essential:
    ./run-e2e-tests.sh native all

# Clean up all test containers
test-e2e-clean:
    cd docker && docker compose -f docker-compose.yml down -v --remove-orphans

# ============================
# Development Commands
# ============================

# Start WASM development environment with hot-reload
wasm-dev:
    cd docker && docker compose -f docker-compose.yml --profile dev up --build

# Build WASM only (no server)
wasm-build:
    cargo build --target wasm32-unknown-unknown --features wasm

# ============================
# Utility Commands
# ============================

# Test SPICE connection with native client (manual testing)
test-spice host="localhost" port="5900":
    cargo run --bin spice-test-client -- --host {{host}} --port {{port}} --duration 10 -vv

# Show available test combinations
test-help:
    ./run-e2e-tests.sh --help

# Run all tests (unit + integration + e2e)
test-all: test-unit test-integration test-e2e-essential

# Clean everything
clean:
    cargo clean
    cd docker && docker compose -f docker-compose.yml down -v --remove-orphans
    docker system prune -f