0
votes

I am trying to run the tests written in codeception using docker-compose. I have written docker-compose.yml. The file looks like below:

The same folder that has docker-compose has tests (folder), codecept.phar and codeception.yml . I am trying to run the following command:

docker-compose run --rm codecept run acceptance

It tries to execute the acceptance tests but I am getting the following error: "[ConnectionException] Can't connect to Webdriver at http://127.0.0.1:4444/wd/hub. Please make sure that Selenium Server or PhantomJS is running."

Any ideas?

Expecting the command to start executing the codeception acceptance tests.

docker-compose.yml looks like below:

version: '3'
services:
  codecept:
    image: codeception/codeception
    depends_on:
      - chrome
      - web
    volumes:
      - .:/project
  web:
    image: php:7-apache
    #depends_on:
     # - db
    volumes:
      - .:/var/www/html
  db:
    image: percona:5.6
  chrome:
    image: selenium/standalone-chrome

Command run to execute the tests:

docker-compose run --rm codecept run acceptance

1

1 Answers

2
votes

I see 2 problems in your setup.

First you need to configure links like this:

version: '3'
  services:
    codecept:
      image: codeception/codeception
      depends_on:
        - chrome
        - web
      links:
        - chrome
        - web
      volumes:
        - .:/project
    web:
      image: php:7-apache
      #depends_on:
      # - db
      volumes:
        - .:/var/www/html
    db:
      image: percona:5.6
    chrome:
      image: selenium/standalone-chrome

Then you need to change the configuration that points to 127.0.0.1:4444 to chrome:4444 as docker-compose will create this dns entry using the name of the linked service in the network.

127.0.0.1 will not work because it isn't running inside the codeception container.