Web application acceptance tests in gitlab-ci using codeception and selenium installed as docker container

Let’s assume we are running acceptance tests of our application during the testing stage in gitlab-ci. The runner starts the container with our web app, and then executes codeception acceptance tests using the selenium server using the google chrome browser. We are using a local gitlab server with a registered runner to execute our tests.

What could possibly go wrong? Actually, everything could go wrong. The problem is that selenium is a service in gitlab-ci.yml and it does not know the runner’s executor container IP address and cannot reach it by host name.

Indeed, if you check the executor’s host file you will see something like this: