-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-extension-test.sh
More file actions
61 lines (53 loc) · 1.79 KB
/
run-extension-test.sh
File metadata and controls
61 lines (53 loc) · 1.79 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
#!/bin/bash
echo "===== YouTube Smart Chapters AI Extension Tester ====="
echo "This script will test your Chrome extension using Puppeteer"
echo ""
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "Error: Node.js is not installed"
echo "Please install Node.js from https://nodejs.org/"
exit 1
fi
# Check if puppeteer is specifically installed
echo "Checking if puppeteer is installed..."
if ! node -e "try { require.resolve('puppeteer'); console.log('Puppeteer is installed'); } catch(e) { console.log('Puppeteer is NOT installed'); process.exit(1); }" &> /dev/null; then
echo "Installing puppeteer and other dependencies..."
echo "This may take a minute or two..."
npm install puppeteer path fs
if [ $? -ne 0 ]; then
echo "Error: Failed to install dependencies."
exit 1
fi
echo "Dependencies installed successfully."
else
echo "Puppeteer is already installed."
fi
echo ""
echo "Starting extension test..."
echo "A Chrome browser window will open with your extension loaded."
echo "The test will navigate to a YouTube video to check extension functionality."
echo "When finished, close the browser window or press Ctrl+C in this terminal."
echo ""
# Create test-results directory if using advanced test
if [[ "$1" == "advanced" ]]; then
mkdir -p test-results
fi
# Run the test script
if [[ "$1" == "advanced" ]]; then
node advanced-test-extension.js
else
node test-extension.js
fi
# Check if test succeeded
if [ $? -ne 0 ]; then
echo ""
echo "Test failed. Please see error message above."
exit 1
fi
echo ""
echo "Test completed successfully!"
echo "A screenshot was saved as youtube-with-extension.png"
if [[ "$1" == "advanced" ]]; then
echo "Additional screenshots saved in the test-results directory."
fi
echo ""