rentgen/scripts/verify_extension_working.sh
Jacek Wielemborek b39c66e696 i18n: translate remaining bash scripts to English
- verify_extension_working.sh: Polish → English
- verify_extension_code.sh: Polish → English
- functional_test.sh: Polish → English
- All 5 bash scripts now fully in English
- No functional changes, comments and echo messages only
2025-10-25 20:14:48 +02:00

65 lines
1.9 KiB
Bash

#!/bin/bash
#
# verify_extension_working.sh - Verifies that extension actually intercepts requests
#
# Test performs HTTP request inside Firefox and checks if extension intercepted it
# via Badge API (domain counter on extension icon)
#
set -e
echo "Starting Firefox with extension..."
Xvfb :99 -screen 0 1024x768x24 &
XVFB_PID=$!
export DISPLAY=:99
sleep 2
# Start Firefox with extension and remote debugging
npx web-ext run --verbose 2>&1 | tee /tmp/web-ext.log &
WEBEXT_PID=$!
# Wait for extension installation
echo "Waiting for extension installation..."
for i in {1..30}; do
if grep -q "Installed /app as a temporary add-on" /tmp/web-ext.log 2>/dev/null; then
echo "✓ Extension installed"
break
fi
sleep 1
done
# Wait a bit more for extension code to execute
sleep 3
# Try to trigger a request that extension should intercept
# We'll use Firefox to load a simple webpage
echo ""
echo "Testing if extension intercepts requests..."
echo "Attempting to load example.com in Firefox..."
# Use Firefox's remote debugging protocol to open a URL
# This should trigger webRequest listeners if extension is working
timeout 10s bash -c '
# Wait for devtools server port from logs
PORT=$(grep -oP "start-debugger-server \K[0-9]+" /tmp/web-ext.log | head -1)
if [ -n "$PORT" ]; then
echo "Debugger port: $PORT"
# Extension should intercept this request
firefox -P /tmp/firefox-profile* "http://example.com" 2>/dev/null &
sleep 5
fi
' || true
# Check logs for evidence of request interception
echo ""
echo "Checking logs..."
if grep -i "example.com" /tmp/web-ext.log 2>/dev/null; then
echo "✓✓✓ SUCCESS: Request to example.com was detected!"
echo "✓✓✓ Extension IS ACTUALLY intercepting requests!"
exit 0
else
echo "✗✗✗ NO EVIDENCE that extension intercepts requests"
echo "Extension may be installed but CODE may not be executing"
exit 1
fi