-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathrun_tests
More file actions
executable file
·88 lines (71 loc) · 2.51 KB
/
run_tests
File metadata and controls
executable file
·88 lines (71 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# ModernAgile Test Runner
# Runs modern Playwright integration tests
set -e # Exit on any error
# Color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$SCRIPT_DIR"
INTEGRATION_TESTS_DIR="$PROJECT_ROOT/integration-tests"
echo -e "${BLUE}ModernAgile Test Runner${NC}"
echo "=================================="
# Check if we're in the right directory
if [[ ! -f "$PROJECT_ROOT/index.html" ]] || [[ ! -d "$INTEGRATION_TESTS_DIR" ]]; then
echo -e "${RED}Error: This script must be run from the ModernAgile project root directory${NC}"
echo "Expected to find index.html and integration-tests/ directory"
exit 1
fi
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo -e "${RED}Error: Node.js is not installed${NC}"
echo "Please install Node.js from https://nodejs.org/"
exit 1
fi
# Check if npm is installed
if ! command -v npm &> /dev/null; then
echo -e "${RED}Error: npm is not installed${NC}"
echo "Please install npm (usually comes with Node.js)"
exit 1
fi
echo -e "${YELLOW}Checking dependencies...${NC}"
# Navigate to integration tests directory
cd "$INTEGRATION_TESTS_DIR"
# Check if package.json exists
if [[ ! -f "package.json" ]]; then
echo -e "${RED}Error: No package.json found in integration-tests directory${NC}"
echo "Run setup first to initialize the integration tests"
exit 1
fi
# Check if node_modules exists and install if needed
if [[ ! -d "node_modules" ]]; then
echo -e "${YELLOW}Installing integration test dependencies...${NC}"
npm install
fi
echo -e "${YELLOW}Running modern integration tests...${NC}"
echo
# Run the Playwright tests
if npm test; then
echo
echo -e "${GREEN}✓ Integration tests completed successfully${NC}"
else
EXIT_CODE=$?
echo
echo -e "${RED}✗ Integration tests failed${NC}"
echo -e "${YELLOW}Check the output above for detailed test results${NC}"
cd "$PROJECT_ROOT"
exit $EXIT_CODE
fi
# Navigate back to project root
cd "$PROJECT_ROOT"
echo
echo -e "${BLUE}Test Summary:${NC}"
echo "- Tests are located in: $INTEGRATION_TESTS_DIR"
echo "- Test runner: Playwright with Node.js"
echo "- Cross-browser testing: Chrome, Firefox, Safari, Mobile Chrome"
echo "- Tests cover: Component rendering, pagination, analytics, responsive design"
echo "- All integration tests are passing and modernized"