Testing Codeception with Selenium service

I’m trying to setup selenium standalone chrome service to test my Codeception suit.

I run chrome standalone as a service:

services:
  - mysql:latest
  - selenium/standalone-chrome:latest

And then I setup the connections for my Codeception test uses WebDriver with extension for WordPress:

WPWebDriver:
   url: 'http://localhost'
   host: 'selenium__standalone-chrome'
   browser: chrome
   port: 4444
   restart: true
   wait: 2
   adminUsername: admin
   adminPassword: 1234
   adminUrl: /wp-admin

All other tests run well but when it comes to the suite where that uses Selenium it refuses to connect:

Time: 7.55 seconds, Memory: 16.00MB

There was 1 failure:

---------
1) SampleTestCept: Test if wp is working in selenium
 Test  tests/php/acceptance/SampleTestCept.php
 Step  See "Just another WordPress site"
 Fail  Failed asserting that  on page /
--> This site can’t be reached
localhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
Reload
DETAILS
--> contains "this site can't be reached".

Scenario Steps:

 2. $I->see("This site can't be reached") at tests/php/acceptance/SampleTestCept.php:6
 1. $I->amOnPage("/") at tests/php/acceptance/SampleTestCept.php:4

Any ideas of what am I doing wrong?

Selenium server imho does not have to connect to localhost, because service is “another host”. You have to use HOSTNAME environment variable to find runner hostname. In NodeJS I use next

http://' + (process.env.HOSTNAME || 'localhost') + ':' + (process.env.PORT || '9000')

Greg could you solve this issue? I’m also experiencing it. With dockerized Selenium grid and dockerized web app.

The amOnPage() method works but see() method doesn’t. Here’s my acceptance suite yml settings:

actor: AcceptanceTester
modules:
    enabled:
        - \Helper\Acceptance
        - WebDriver
    config:
        WebDriver:
            url: http://app.mywebapp.com
            browser: chrome

Also adding my docker-compose.yml

version: '2'
services:
  seleniumhub:
    container_name: seleniumhub
    image: selenium/hub
    ports:
     - "4444:4444"

  chromenode:
    container_name: chromenode
    image: selenium/node-chrome-debug
    ports:
      - 4578
    links:
      - seleniumhub
    environment:
      - HUB_PORT_4444_TCP_ADDR=seleniumhub
      - HUB_PORT_4444_TCP_PORT=4444
    extra_hosts:
      - "app.mywebapp.com:172.20.129.2"
    volumes:
      - /dev/shm:/dev/shm

networks:
  default:
    external:
      name: build_static-network

[Selenium browser Logs]
SEVERE - http://app.mywebapp.com/ - Failed to load resource: net::ERR_CONNECTION_REFUSED