diff --git a/.github/workflows/test-client.yml b/.github/workflows/test-client.yml index 6566d047a5a..898a1f5734e 100644 --- a/.github/workflows/test-client.yml +++ b/.github/workflows/test-client.yml @@ -224,20 +224,7 @@ jobs: shell: bash run: | /usr/bin/google-chrome --headless --virtual-time-budget=120000 --dump-dom http://localhost:8080 > chrome-results.html - - # Handle tests results - if grep -q 'title="FAILED"' chrome-results.html; then - failed_info=$(grep -oE '
([^<]+)' chrome-results.html | awk 'NR==1 {print substr($0, index($0,$4))}') - echo $failed_info - exit 1 - elif grep -q 'title="OK"' chrome-results.html; then - grep -oE '
([^<]+)' chrome-results.html | awk '{print substr($0, index($0,$4))}' - echo "Success: all tests passed." - else - cat chrome-results.html - echo "No test results found. Check chrome-results.html output." - exit 1 - fi + ./analyze-headless-tests-results.sh chrome-results.html - name: Run Firefox headless working-directory: mithril-client-wasm diff --git a/mithril-client-wasm/analyze-headless-tests-results.sh b/mithril-client-wasm/analyze-headless-tests-results.sh index 88f710fa5e5..8a2671d86dd 100755 --- a/mithril-client-wasm/analyze-headless-tests-results.sh +++ b/mithril-client-wasm/analyze-headless-tests-results.sh @@ -1,13 +1,20 @@ FILENAME=$1 + +if [ ! -e "$FILENAME" ]; then + echo "Error: File '$FILENAME' not found." + exit 1 +fi + +echo "Analyzing headless test results from file: '$FILENAME'" if grep -q 'title="FAILED"' "$FILENAME"; then - failed_info=$(grep -oE '
([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}') - echo $failed_info + FAILED_INFO=$(grep -oE '
([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}') + echo "$FAILED_INFO" exit 1 elif grep -q 'title="OK"' "$FILENAME"; then grep -oE '
([^<]+)' "$FILENAME" | awk '{print substr($0, index($0,$4))}' echo "Success: all tests passed." else cat "$FILENAME" - echo "No test results found. Check $FILENAME output." + echo "No test results found. Check '$FILENAME' output." exit 1 fi