Files
rename-mvp/feature_tests_tvdb_embed.sh
T
2026-03-09 16:19:50 +01:00

57 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
BASE_URL="${BASE_URL:-http://127.0.0.1:8085}"
ALT_BASE_URL="http://host.containers.internal:8085"
detect_base_url() {
if curl -fsS --max-time 2 "$BASE_URL/api/health" >/dev/null 2>&1; then
echo "$BASE_URL"
return
fi
if curl -fsS --max-time 2 "$ALT_BASE_URL/api/health" >/dev/null 2>&1; then
echo "$ALT_BASE_URL"
return
fi
echo "$BASE_URL"
}
BASE_URL="$(detect_base_url)"
echo "Using BASE_URL=$BASE_URL"
echo "== Feature test 1: tvdb embed test route is served =="
page="$(curl -fsS "$BASE_URL/tvdb-embed-test.html")"
echo "$page" | grep -q "TVDB Embed Test" || {
echo "Expected TVDB Embed Test title missing"
exit 1
}
echo "route availability validation passed"
echo
echo "== Feature test 2: iframe and fallback UI exist =="
echo "$page" | grep -q 'id="tvdbFrame"' || {
echo "Expected iframe with id tvdbFrame missing"
exit 1
}
echo "$page" | grep -q 'id="embedFallback"' || {
echo "Expected embed fallback container missing"
exit 1
}
echo "iframe/fallback validation passed"
echo
echo "== Feature test 3: open-in-tab action exists =="
echo "$page" | grep -q 'id="openInTabBtn"' || {
echo "Expected Open in tab button missing"
exit 1
}
echo "$page" | grep -q "window.open" || {
echo "Expected window.open integration missing"
exit 1
}
echo "open-in-tab validation passed"
echo
echo "All TVDB embed feature tests passed."