selenium.sh 547 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. # Check the command before running in background so
  4. # that it can actually fail and have a descriptive error
  5. hash chromedriver
  6. chromedriver --url-base=wd/hub --port=4444 &
  7. CHROME_DRIVER_PID=$!
  8. echo chromedriver running with PID $CHROME_DRIVER_PID
  9. # Make sure it is killed to prevent file descriptors leak
  10. function kill_chromedriver() {
  11. # Use kill instead of killall to increase chances of this working on Windows
  12. kill $CHROME_DRIVER_PID > /dev/null
  13. }
  14. trap kill_chromedriver EXIT
  15. npm run selenium-test