I need help from someone who knows about testing web pages with Javascript in Docker containers. I have browser-based testing working and now I have scenarios which don't work without Javascript, so I'm trying to follow the Drupal documentation for running PHPUnit Javascript tests. The problem is that I'm getting
An unexpected error occurred while starting Mink: unknown error: net::ERR_CONNECTION_REFUSED
I can see that the chrome
container is listening on port 9515:
# ss -a | grep 9515
tcp LISTEN 0 5 *:9515 *:*
And I have confirmed that the web
container can in fact connect to it on that port:
# curl --head http://chrome:9515
HTTP/1.1 404 Not Found
Content-Length:545
Content-Type:application/json; charset=utf-8
cache-control:no-cache
The MINK_DRIVER_ARGS_WEBDRIVER
variable is set in phpunit.xml
as instructed by the documentation linked above:
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://chrome:9515"]'/>
I can't run chromedriver
directly in the web container, because it's running Ubuntu, which says you have to install the chromium snap
, and Docker containers don't support snap
. So I used the Other ways to install and run chromedriver: Docker compose based chromedriver instructions from the documentation linked above to put it in a separate container.
I'm out of my depth here. Help, please!