I am trying to Run Behat BDD Tests using docksal/behat docker-compose ( ref: https://github.com/docksal/behat
Looking at the Zalenium documentation
Pull docker-selenium
docker pull elgalu/selenium
# Pull Zalenium
docker pull dosel/zalenium
# Run it!
docker run --rm -ti --name zalenium -p 4444:4444 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/videos:/home/seluser/videos \
--privileged dosel/zalenium start
# Point your tests to http://localhost:4444/wd/hub and run them
integrating docksal/behat and zelenium is not clear
using. the. following docker-compose.yml
# The purpose of this -test example is for the e2e tests of this project
#
# Usage:
# docker-compose -p grid up --force-recreate
# docker-compose -p grid scale mock=1 hub=1 chrome=3 firefox=3
version: '2.1'
services:
hub:
image: elgalu/selenium
ports:
- ${VNC_FROM_PORT-40650}-${VNC_TO_PORT-40700}:${VNC_FROM_PORT-40650}-${VNC_TO_PORT-40700}
zalenium:
image: "dosel/zalenium"
container_name: zalenium
hostname: zalenium
tty: true
volumes:
- /tmp/videos:/home/seluser/videos
- /var/run/docker.sock:/var/run/docker.sock
privileged: true
ports:
- 4444:4444
command: >
start --desiredContainers 2
--maxDockerSeleniumContainers 8
--screenWidth 800 --screenHeight 600
--timeZone "America/New_York"
--videoRecordingEnabled false
--sauceLabsEnabled false
--browserStackEnabled false
--testingBotEnabled false
--cbtEnabled false
--startTunnel false
behat:
hostname: behat
image: docksal/behat
volumes:
- .:/src
# Run a built-in web server for access to HTML reports
ports:
- 8000:8000
entrypoint: "php -S 0.0.0.0:8000"
# browser:
# hostname: browser
# Pick/uncomment one
# image: selenium/standalone-chrome
#image: selenium/standalone-firefox
I can bring up the following containers:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9a1620da4c71 elgalu/selenium:latest "entry.sh" 4 seconds ago Up 4 seconds 40001/tcp, 50001/tcp zalenium_52g9tn
82975a246be8 elgalu/selenium:latest "entry.sh" 5 seconds ago Up 4 seconds 40000/tcp, 50000/tcp zalenium_fdCCbk
862017957ba1 docksal/behat "php -S 0.0.0.0:8000" 2 days ago Up 8 seconds 0.0.0.0:8000->8000/tcp behat-selenium_behat_1
2da2c165a211 elgalu/selenium "entry.sh" 4 days ago Up 6 seconds 0.0.0.0:40650-40700->40650-40700/tcp behat-selenium_hub_1
10df443d8378 dosel/zalenium "entry.sh start --de…" 4 days ago Up 8 seconds 0.0.0.0:4444->4444/tcp, 4445/tcp zalenium
now looking at run-behat in examples directory:
basically executing
$docker exec $(docker-compose ps -q behat) behat --colors --format=pretty --out=std --format=html --out=html_report "$@"
I get an error:
Error response from daemon: Container 411c6b89d8f382a64ed567dbe4d02a2840f06d4778f1ce7bcf955e720d96ab02 is not running
whereas:
$ docker-compose ps -q behat
411c6b89d8f382a64ed567dbe4d02a2840f06d4778f1ce7bcf955e720d96ab02
Perhaps in behat.yml wd_host: http://localhost:4444/wd/hub
it should not point to localhost, but rather the hub? since wd_host should point to the selenium grid running in the container?
This
hub:
image: elgalu/selenium
ports:
- ${VNC_FROM_PORT-40650}-${VNC_TO_PORT-40700}:${VNC_FROM_PORT-40650}-${VNC_TO_PORT-40700}
is not needed at all.
Just point your tests to the zalenium service, since you are using docker-compose.
http://zalenium:4444/wd/hub