From cc354e158ed7e6e4637e8aa88efe929f7b05de84 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Tue, 14 Jan 2025 13:14:38 +0000 Subject: [PATCH] commit --- cucumber/test_webpages.sh | 97 +++++++++++++++++++ cucumber/webpage_urls.txt | 54 +++++++++++ .../SPDF/config/EndpointConfiguration.java | 1 - test.sh | 9 ++ 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 cucumber/test_webpages.sh create mode 100644 cucumber/webpage_urls.txt diff --git a/cucumber/test_webpages.sh b/cucumber/test_webpages.sh new file mode 100644 index 00000000..df97d08d --- /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 "\|