I run my selenium tests from shell, everything works as it should!
$ selenium-side-runner --server http://chromedriver:4444/wd/hub --capabilities "browserName=chrome" /app/tests/proxy.lucky_app.side
info: Running /app/tests/proxy.lucky_app.side
PASS ./DefaultSuite.test.js
Default Suite
✓ test frontend (1282ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 3.329s
Ran all test suites.
However, if I execute the same command from a shell script test.sh
, I get the below error. What causes it and how can I fix it ?
tests.sh
#!/bin/bash
selenium-side-runner --server http://chromedriver:4444/wd/hub --capabilities "browserName=chrome" /app/tests/proxy.lucky_app.side
Error
$ /app/scripts/test.sh
info: Running /app/tests/proxy.lucky_app.side
● Validation Error:
Test environment jest-environment-selenium cannot be found. Make sure the testEnvironment configuration option points to an existing node module.
Configuration Documentation:
https://jestjs.io/docs/configuration.html
Context
The reason for my error and this flaky behavior was explicit reference to the latest release of
selenium-webdriver
- at the moment of writing this answer, it's[email protected]
package.json - error
Solution
Fix, was to remove
selenium-webdriver
frompackage.json
.package.json - no errors