trip-planner/tests/run-clean.sh

65 lines
No EOL
1.5 KiB
Bash
Executable file

#!/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}"
# Default to running only clean tests
TEST_FILE="specs/auth/auth-clean.test.js"
# 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}"
;;
--all)
TEST_FILE=""
echo -e "${YELLOW}🌟 Running all tests...${NC}"
;;
*)
echo -e "${YELLOW}🧹 Running clean authentication tests...${NC}"
;;
esac
# Create screenshots directory
mkdir -p screenshots
# Run tests with timing logs visible
if [ -n "$TEST_FILE" ]; then
HEADLESS=false npm test -- "$TEST_FILE" --verbose=false
else
HEADLESS=false npm test --verbose=false
fi
echo -e "${GREEN}✅ Tests completed!${NC}"