-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-plugin-tests.sh
More file actions
executable file
·123 lines (99 loc) · 2.62 KB
/
run-plugin-tests.sh
File metadata and controls
executable file
·123 lines (99 loc) · 2.62 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# Plugin Lifecycle Test Runner
# Runs the plugin installation/deletion tests for both free and pro versions
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if plugin files exist
check_plugin_files() {
print_status "Checking plugin files..."
local files_found=0
if [ -f "plugin/new_release_free.zip" ]; then
print_success "Found new_release_free.zip"
files_found=$((files_found + 1))
else
print_warning "Missing new_release_free.zip"
fi
if [ -f "plugin/new_release_pro.zip" ]; then
print_success "Found new_release_pro.zip"
files_found=$((files_found + 1))
else
print_warning "Missing new_release_pro.zip"
fi
if [ $files_found -eq 0 ]; then
print_error "No plugin files found. Please add BackWPUp plugin files to ./plugin directory"
exit 1
fi
print_success "Found $files_found plugin file(s)"
}
# Run Playwright tests
run_playwright_tests() {
print_status "Running Playwright plugin lifecycle tests..."
if npx playwright test src/specs/plugin-lifecycle.spec.ts; then
print_success "Playwright tests completed successfully"
return 0
else
print_error "Playwright tests failed"
return 1
fi
}
# Run Cucumber tests
run_cucumber_tests() {
print_status "Running Cucumber plugin lifecycle tests..."
if npx cucumber-js src/features/plugin-lifecycle.feature; then
print_success "Cucumber tests completed successfully"
return 0
else
print_error "Cucumber tests failed"
return 1
fi
}
# Main execution
main() {
echo ""
print_status "BackWPUp Plugin Lifecycle Test Runner"
echo ""
check_plugin_files
echo ""
print_status "Choose test type:"
echo "1) Playwright tests"
echo "2) Cucumber tests"
echo "3) Both"
echo ""
read -p "Enter choice (1-3): " choice
case $choice in
1)
run_playwright_tests
;;
2)
run_cucumber_tests
;;
3)
run_playwright_tests
run_cucumber_tests
;;
*)
print_error "Invalid choice"
exit 1
;;
esac
print_success "Plugin lifecycle tests completed!"
}
# Run main function
main "$@"