diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db9dc28b..a80273f3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -297,6 +297,11 @@ jobs: python ${{ env.BUILD_PREFIX }}/bin/emrun.py --browser="firefox" --kill_exit --timeout 60 --browser-args="--headless" test_xeus_cpp.html echo "Running test_xeus_cpp in Google Chrome" python ${{ env.BUILD_PREFIX }}/bin/emrun.py --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.html + sudo safaridriver --enable + python -m pip install selenium + echo "Running test_xeus_cpp in Safari" + python ${{ env.BUILD_PREFIX }}/bin/emrun.py --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.html & + python ../../scripts/browser_tests_safari.py test_xeus_cpp.html else # Install Google Chrome wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b799e0a7..169e87e7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -101,7 +101,7 @@ cd test node test_xeus_cpp.js ``` -It is possible to run the Emscripten tests in a headless browser. 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 +It is possible to run the Emscripten tests in a headless browser. 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 @@ -124,6 +124,16 @@ echo "Running test_xeus_cpp in Google Chrome" python $BUILD_PREFIX/bin/emrun.py --browser="Google Chrome" --kill_exit --browser-args="--headless --no-sandbox" test_xeus_cpp.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 test_xeus_cpp in Safari" +python $BUILD_PREFIX/bin/emrun.py --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.html & +python ../../scripts/browser_tests_safari.py test_xeus_cpp.html +``` + To do this on Ubuntu x86 execute the following ```bash @@ -157,4 +167,4 @@ jupyter lite serve --XeusAddon.prefix=$PREFIX \ --contents notebooks/smallpt.ipynb \ --contents notebooks/images/marie.png \ --contents notebooks/audio/audio.wav -``` \ No newline at end of file +``` diff --git a/README.md b/README.md index 0f6888d4..b50c08a2 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ cd test node test_xeus_cpp.js ``` -It is possible to run the Emscripten tests in a headless browser. 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 +It is possible to run the Emscripten tests in a headless browser. 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 @@ -136,6 +136,16 @@ echo "Running test_xeus_cpp in Google Chrome" python python $BUILD_PREFIX/bin/emrun.py --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.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 test_xeus_cpp in Safari" +python $BUILD_PREFIX/bin/emrun.py --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.html & +python ../../scripts/browser_tests_safari.py test_xeus_cpp.html +``` + To do this on Ubuntu x86 execute the following ```bash diff --git a/docs/source/InstallationAndUsage.rst b/docs/source/InstallationAndUsage.rst index 594fdbbe..366870a9 100644 --- a/docs/source/InstallationAndUsage.rst +++ b/docs/source/InstallationAndUsage.rst @@ -82,7 +82,7 @@ To test the lite build you can execute the following to run the C++ tests built cd test node test_xeus_cpp.js -It is possible to run the Emscripten tests in a headless browser. 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 +It is possible to run the Emscripten tests in a headless browser. 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-block:: bash @@ -105,6 +105,16 @@ It is possible to run the Emscripten tests in a headless browser. We will run ou echo "Running test_xeus_cpp in Google Chrome" python $BUILD_PREFIX/bin/emrun.py --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.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-block:: bash + + echo "Running test_xeus_cpp in Safari" + python $BUILD_PREFIX/bin/emrun.py --no_browser --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.html & + python ../../scripts/browser_tests_safari.py test_xeus_cpp.html + To do this on Ubuntu x86 execute the following .. code-block:: bash diff --git a/scripts/browser_tests_safari.py b/scripts/browser_tests_safari.py new file mode 100644 index 00000000..a11a3fd0 --- /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() \ No newline at end of file