forked from input-output-hk/mithril
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
139 changed files
with
31,138 additions
and
15,513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.github/workflows/scripts/parse-wasm-headless-tests-results.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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" | ||
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." | ||
exit 1 | ||
fi |
44 changes: 44 additions & 0 deletions
44
.github/workflows/scripts/run-wasm-tests-browser-headless.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import logging | ||
import argparse | ||
import sys | ||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.support.ui import WebDriverWait | ||
from selenium.webdriver.support import expected_conditions as EC | ||
|
||
def run_headless_test(): | ||
parser = argparse.ArgumentParser(description='Run headless browser test.') | ||
parser.add_argument('browser_type', choices=['chrome', 'firefox'], help='Browser type (chrome or firefox)') | ||
args = parser.parse_args() | ||
|
||
if args.browser_type.lower() == 'chrome': | ||
options = webdriver.ChromeOptions() | ||
options.add_argument("--headless=new") | ||
driver = webdriver.Chrome(options=options) | ||
elif args.browser_type.lower() == 'firefox': | ||
options = webdriver.FirefoxOptions() | ||
options.add_argument("--headless") | ||
driver = webdriver.Firefox(options=options) | ||
else: | ||
logging.error("Invalid browser type. Supported types are 'chrome' and 'firefox'.") | ||
return | ||
|
||
try: | ||
driver.get('http://localhost:8080/') | ||
|
||
# Adjust the timeout to 3 minutes | ||
wait = WebDriverWait(driver, 180) | ||
|
||
# Wait until the div with id "tests_finished" is displayed | ||
tests_finished_element = wait.until(EC.presence_of_element_located((By.ID, "tests_finished"))) | ||
|
||
html = driver.page_source | ||
result_file = f"{args.browser_type.lower()}-results.html" | ||
with open(result_file, "w", encoding="utf-8") as file: | ||
file.write(html) | ||
|
||
finally: | ||
driver.quit() | ||
|
||
if __name__ == "__main__": | ||
run_headless_test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.