Skip to content

Commit

Permalink
refactor: update chrome step
Browse files Browse the repository at this point in the history
- enhance 'analyze-headless-tests-results' script
- call 'analyze-headless-tests-results' script in chrome step
- move scripts files
  • Loading branch information
dlachaume committed Jan 30, 2024
1 parent 2961558 commit cb44d0a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FILENAME=$1

if [ ! -e "$FILENAME" ]; then
echo "Error: File '$FILENAME' not found."
exit 1
fi

echo "Parse headless test results from file: '$FILENAME'"
if grep -q 'title="FAILED"' "$FILENAME"; then
failed_info=$(grep -oE '<div id="[^"]+" title="FAILED">([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}')
echo $failed_info
FAILED_INFO=$(grep -oE '<div id="[^"]+" title="FAILED">([^<]+)' "$FILENAME" | awk 'NR==1 {print substr($0, index($0,$4))}')
echo "$FAILED_INFO"
exit 1
elif grep -q 'title="OK"' "$FILENAME"; then
grep -oE '<div id="[^"]+" title="OK">([^<]+)' "$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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
driver = webdriver.Firefox(options=options)
driver.get("http://localhost:8080/")

# Adjust the timeout to 1 minute
# Adjust the timeout to 3 minutes
wait = WebDriverWait(driver, 180)

# Wait until the div with id "tests_finished" is displayed
Expand Down
24 changes: 4 additions & 20 deletions .github/workflows/test-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ jobs:
CURRENT_ATTEMPT=$(( ${CURRENT_ATTEMPT} + 1 ))
if nc -z localhost 8080; then
echo "Server is ready."
sleep 5
break
fi
if [ "$CURRENT_ATTEMPT" -ge "$MAX_ATTEMPTS" ]; then
Expand All @@ -220,29 +219,14 @@ jobs:
done
- name: Run Chrome headless
working-directory: mithril-client-wasm
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 '<div id="[^"]+" title="FAILED">([^<]+)' 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 '<div id="[^"]+" title="OK">([^<]+)' 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
/usr/bin/google-chrome --headless --virtual-time-budget=300000 --dump-dom http://localhost:8080 > chrome-results.html
./.github/workflows/scripts/parse-wasm-headless-tests-results.sh chrome-results.html
- name: Run Firefox headless
working-directory: mithril-client-wasm
shell: bash
run: |
pip install selenium
python3 run-firefox-headless.py
./analyze-headless-tests-results.sh firefox-results.html
python3 ./.github/workflows/scripts/run-wasm-tests-firefox-headless.py
./.github/workflows/scripts/parse-wasm-headless-tests-results.sh firefox-results.html

0 comments on commit cb44d0a

Please sign in to comment.