#!/bin/bash # Comprehensive test script # Runs all tests: unit, E2E, hydration, emails, etc. set -e # Exit on error echo "๐Ÿงช Running comprehensive test suite..." echo "" # Colors for output GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Track failures FAILED=0 # 1. TypeScript check echo "๐Ÿ“ Checking TypeScript..." if npx tsc --noEmit; then echo -e "${GREEN}โœ… TypeScript check passed${NC}" else echo -e "${RED}โŒ TypeScript check failed${NC}" FAILED=1 fi echo "" # 2. Lint check echo "๐Ÿ” Running ESLint..." if npm run lint; then echo -e "${GREEN}โœ… Lint check passed${NC}" else echo -e "${RED}โŒ Lint check failed${NC}" FAILED=1 fi echo "" # 3. Build check echo "๐Ÿ—๏ธ Building application..." if npm run build; then echo -e "${GREEN}โœ… Build check passed${NC}" else echo -e "${RED}โŒ Build check failed${NC}" FAILED=1 fi echo "" # 4. Unit tests echo "๐Ÿงช Running unit tests..." if npm run test; then echo -e "${GREEN}โœ… Unit tests passed${NC}" else echo -e "${RED}โŒ Unit tests failed${NC}" FAILED=1 fi echo "" # 5. E2E tests (critical paths) echo "๐ŸŒ Running E2E tests (critical paths)..." if npm run test:critical; then echo -e "${GREEN}โœ… Critical paths tests passed${NC}" else echo -e "${RED}โŒ Critical paths tests failed${NC}" FAILED=1 fi echo "" # 6. Hydration tests echo "๐Ÿ’ง Running hydration tests..." if npm run test:hydration; then echo -e "${GREEN}โœ… Hydration tests passed${NC}" else echo -e "${RED}โŒ Hydration tests failed${NC}" FAILED=1 fi echo "" # 7. Email tests echo "๐Ÿ“ง Running email tests..." if npm run test:email; then echo -e "${GREEN}โœ… Email tests passed${NC}" else echo -e "${RED}โŒ Email tests failed${NC}" FAILED=1 fi echo "" # 8. Performance tests echo "โšก Running performance tests..." if npm run test:performance; then echo -e "${GREEN}โœ… Performance tests passed${NC}" else echo -e "${YELLOW}โš ๏ธ Performance tests had issues (non-critical)${NC}" fi echo "" # 9. Accessibility tests echo "โ™ฟ Running accessibility tests..." if npm run test:accessibility; then echo -e "${GREEN}โœ… Accessibility tests passed${NC}" else echo -e "${YELLOW}โš ๏ธ Accessibility tests had issues (non-critical)${NC}" fi echo "" # Summary echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" if [ $FAILED -eq 0 ]; then echo -e "${GREEN}๐ŸŽ‰ All critical tests passed!${NC}" exit 0 else echo -e "${RED}โŒ Some tests failed. Please review the output above.${NC}" exit 1 fi