diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index e6f352d29..b5981f7da 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -168,6 +168,14 @@ jobs: emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html echo "Running DynamicLibraryManagerTests in Google Chrome" emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html + sudo safaridriver --enable + python -m pip install selenium + echo "Running CppInterOpTests in Safari" + emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html & + python ../../../scripts/browser_tests_safari.py CppInterOpTests.html + echo "Running DynamicLibraryManagerTests in Safari" + emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html & + python ../../../scripts/browser_tests_safari.py DynamicLibraryManagerTests.html cd ../../ emmake make -j ${{ env.ncpus }} install diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 139aac715..96dd3a375 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -571,6 +571,14 @@ jobs: emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html echo "Running DynamicLibraryManagerTests in Google Chrome" emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html + sudo safaridriver --enable + python -m pip install selenium + echo "Running CppInterOpTests in Safari" + emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html & + python ../../../scripts/browser_tests_safari.py CppInterOpTests.html + echo "Running DynamicLibraryManagerTests in Safari" + emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html & + python ../../../scripts/browser_tests_safari.py DynamicLibraryManagerTests.html else export ARCHITECHURE=$(uname -m) if [[ "$ARCHITECHURE" != "aarch64" ]]; then @@ -706,6 +714,12 @@ jobs: emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html echo "Running DynamicLibraryManagerTests in Google Chrome" emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html + echo "Running CppInterOpTests in Safari" + emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html & + python ../../../scripts/browser_tests_safari.py CppInterOpTests.html + echo "Running DynamicLibraryManagerTests in Safari" + emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html & + python ../../../scripts/browser_tests_safari.py DynamicLibraryManagerTests.html else export ARCHITECHURE=$(uname -m) if [[ "$ARCHITECHURE" != "aarch64" ]]; then diff --git a/Emscripten-build-instructions.md b/Emscripten-build-instructions.md index 3d93edd4c..673859374 100644 --- a/Emscripten-build-instructions.md +++ b/Emscripten-build-instructions.md @@ -222,7 +222,7 @@ It is possible to run the Emscripten tests in a headless browser. To do this we cd ./unittests/CppInterOp/ ``` -We will run our tests in a fresh installed browser. Installing the browsers, and running the tests within the installed browsers will be platform dependent. To do this on MacOS execute the following +We will run our tests in a fresh installed browser. Installing the browsers, and running the tests within the installed browsers will be platform dependent. To do this for Chrome and Firefox on MacOS execute the following ```bash wget "https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US" -O Firefox-latest.dmg @@ -249,6 +249,19 @@ echo "Running DynamicLibraryManagerTests in Google Chrome" emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html ``` +To run tests in Safari you can make use of safaridriver. How to enable this will depend on +your MacOS operating system, and is best to consult [safaridriver](https://developer.apple.com/documentation/webkit/testing-with-webdriver-in-safari). You will also need to install the Selenium +python package. This only needs to be enable once, and then you can execute the following to run the tests in Safari + +```bash +echo "Running CppInterOpTests in Safari" +emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html & +python ../../../scripts/browser_tests_safari.py CppInterOpTests.html +echo "Running DynamicLibraryManagerTests in Safari" +emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html & +python ../../../scripts/browser_tests_safari.py DynamicLibraryManagerTests.html +``` + To do this on Ubuntu x86 execute the following ```bash diff --git a/docs/Emscripten-build-instructions.rst b/docs/Emscripten-build-instructions.rst index 5ed5032e9..e336a6399 100644 --- a/docs/Emscripten-build-instructions.rst +++ b/docs/Emscripten-build-instructions.rst @@ -245,7 +245,7 @@ It is possible to run the Emscripten tests in a headless browser. To do this we cd ./unittests/CppInterOp/ -We will run our tests in a fresh installed browser. Installing the browsers, and running the tests within the installed browsers will be platform dependent. To do this on MacOS execute the following +We will run our tests in a fresh installed browser. Installing the browsers, and running the tests within the installed browsers will be platform dependent. To do this for Chrome and Firefox on MacOS execute the following .. code:: bash @@ -272,6 +272,19 @@ We will run our tests in a fresh installed browser. Installing the browsers, and echo "Running DynamicLibraryManagerTests in Google Chrome" emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html +To run tests in Safari you can make use of safaridriver. How to enable this will depend on +your MacOS operating system, and is best to consult `safaridriver `_. You will also need to install the Selenium +python package. This only needs to be enable once, and then you can execute the following to run the tests in Safari + +.. code:: bash + + echo "Running CppInterOpTests in Safari" + emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html & + python ../../../scripts/browser_tests_safari.py CppInterOpTests.html + echo "Running DynamicLibraryManagerTests in Safari" + emrun --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html & + python ../../../scripts/browser_tests_safari.py DynamicLibraryManagerTests.html + To do this on Ubuntu x86 execute the following .. code:: bash diff --git a/scripts/browser_tests_safari.py b/scripts/browser_tests_safari.py new file mode 100644 index 000000000..4210c22a5 --- /dev/null +++ b/scripts/browser_tests_safari.py @@ -0,0 +1,9 @@ +import sys +import time +from selenium import webdriver + +driver = webdriver.Safari() +driver.get("http://localhost:6931/" + sys.argv[1]) + +time.sleep(60) +driver.quit()