trip-planner/tests/run-clean.sh

65 lines
1.5 KiB
Bash
Raw Permalink Normal View History

2025-09-27 01:26:58 +02:00
#!/bin/bash
# Simple Test Runner - Clean Output
set -e
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${YELLOW}🧪 Running Trip Planner E2E Tests${NC}"
# Check if npm packages are installed
if [ ! -d "node_modules" ]; then
echo -e "${YELLOW}📦 Installing dependencies...${NC}"
npm install > /dev/null 2>&1
fi
# Check if frontend is accessible
if ! curl -s -o /dev/null http://localhost:5173; then
echo -e "${RED}❌ Frontend not accessible at http://localhost:5173${NC}"
exit 1
fi
echo -e "${GREEN}✅ Environment ready${NC}"
2025-09-30 08:29:17 +02:00
# Default to running all tests
TEST_FILE=""
2025-09-27 01:26:58 +02:00
# Parse simple arguments
case "${1:-}" in
--full)
TEST_FILE="specs/integration/full-auth-flow.test.js"
echo -e "${YELLOW}🔄 Running full authentication flow test...${NC}"
;;
--integration)
TEST_FILE="specs/integration"
echo -e "${YELLOW}🔗 Running integration tests...${NC}"
;;
--auth)
TEST_FILE="specs/auth"
echo -e "${YELLOW}🔑 Running authentication tests...${NC}"
;;
2025-09-30 08:29:17 +02:00
--clean)
TEST_FILE="specs/auth/auth-clean.test.js"
echo -e "${YELLOW}🧹 Running clean authentication tests...${NC}"
2025-09-27 01:26:58 +02:00
;;
*)
2025-09-30 08:29:17 +02:00
echo -e "${YELLOW}🌟 Running all tests...${NC}"
2025-09-27 01:26:58 +02:00
;;
esac
# Create screenshots directory
mkdir -p screenshots
# Run tests with timing logs visible
if [ -n "$TEST_FILE" ]; then
2025-09-30 08:29:17 +02:00
HEADLESS=false npm test -- "$TEST_FILE"
2025-09-27 01:26:58 +02:00
else
2025-09-30 08:29:17 +02:00
HEADLESS=false npm test
2025-09-27 01:26:58 +02:00
fi
echo -e "${GREEN}✅ Tests completed!${NC}"