diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index affa1b136..c0656e7a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,5 +109,6 @@ jobs: - name: Run Docker Compose Tests run: | + chmod +x ./cucumber/test_webpages.sh chmod +x ./test.sh ./test.sh diff --git a/cucumber/test_webpages.sh b/cucumber/test_webpages.sh new file mode 100644 index 000000000..df97d08dc --- /dev/null +++ b/cucumber/test_webpages.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +# Function to check a single webpage +check_webpage() { + local url=$1 + local base_url=${2:-"http://localhost:8080"} + local full_url="${base_url}${url}" + local timeout=10 + + echo -n "Testing $full_url ... " + + # Use curl to fetch the page with timeout + response=$(curl -s -w "\n%{http_code}" --max-time $timeout "$full_url") + if [ $? -ne 0 ]; then + echo "FAILED - Connection error or timeout" + return 1 + fi + + # Split response into body and status code + HTTP_STATUS=$(echo "$response" | tail -n1) + BODY=$(echo "$response" | sed '$d') + + # Check HTTP status + if [ "$HTTP_STATUS" != "200" ]; then + echo "FAILED - HTTP Status: $HTTP_STATUS" + return 1 + fi + + # Check if response contains HTML + if ! echo "$BODY" | grep -q "\|