wiki.techinc.nl/tests/selenium/selenium.sh
AronDemian 47cc31de95 tests: Enable 'npm run selenium' on Windows
Run the script explictly via sh, the default is cmd.exe on Windows.
Also ported from bash to sh per Jforrester's request.

Change-Id: I96b66c6ae01a1761619955be2e8a3dbc64edff18
2020-03-15 21:46:50 +00:00

21 lines
619 B
Bash

# Called via "npm run selenium", see /package.json.
set -euo pipefail
# Manually check if chromedriver is installed and let it fail early with a descriptive
# error if not. Without this, it would fail silently because we run the next command
# in the background.
hash chromedriver
chromedriver --url-base=wd/hub --port=4444 &
CHROME_DRIVER_PID=$!
# Stop it automatically no matter how the script ended
# Uses 'kill' instead of 'killall' to increase chances of this working on Windows
function stop_chromedriver() {
kill $CHROME_DRIVER_PID > /dev/null
}
trap stop_chromedriver EXIT
npm run selenium-test -- "$@"