Selenium Standalone and CodeCeptJS WebDriverIO on 0.8

Hi, hoping that some light can be shed on using a selenium standalone server within drone 0.8 alongside CodeceptJS.

I’ve seen the examples at drone demos and drone documentation, but am either missing something or CodeceptJS works differently.

CodeceptJS layers on top of WebDriverIO (or others), and I successfully have it running in an example project here. However, in my work project I am unable to get things connected in drone.

I have a drone.yml that looks similar to this:

pipeline:
  install-and-build:
    <<: *node_lts_carbon_build
    commands:
      - npm install
      - npm run build

  e2e-firefox:
    <<: *node_lts_carbon_build
    group: checks
    commands:
      - npm run server &
      - npm run test:e2e:firefox

services:
  selenium:
    image: selenium/standalone-firefox:3.12.0-americium

and a CodeceptJS config file that looks like this:

const firefoxConfig = Object.assign({}, defaultConfig,
  {
    helpers: {
      WebDriverIO: {
        url: 'http://localhost:5000',
        // host: 'selenium-firefox', -> this was the name of the container in docker-compose, obv doesn't exist here
        // host: 'selenium', -> this is the name of the drone service
        // seleniumAddress: 'http://selenium:4444/wd/hub', -> when running on browserstack this property is set as the browserstack address, but not for local or docker, tried pointing to selenium
        browser: 'firefox',
        smartWait: 5000,
        restart: false,
        waitForTimeout: 60000,
        desiredCapabilities: {
          moz: {
            headless: true,
          },
        },
      },
    },
  },
);

exports.config = firefoxConfig;

As you can see, I can’t get the configuration right so that the selenium service can be used, not sure what I am missing?

When trying host: 'selenium' the result is:

Error: connect ECONNREFUSED 127.0.0.1:4444

We have some sample projects that you might find helpful.

This is a sample project that demonstrates how to use Drone with Selenium, Firefox and Chrome: https://github.com/drone-demos/drone-go-selenium/tree/chrome-and-firefox

You can see this sample project is passing on Drone 0.8
https://beta.drone.io/drone-demos/drone-go-selenium/20

I’d been following the example here (wouldn’t let me link more than two things before) but unfortunately this is what is giving me the error as above :confused:

To update, this now looks like using the service name selenium as the host in the CodeceptJS config file may work, but is giving the error in the selenium server:

[Parent 72, Gecko_IOThread] WARNING: pipe error: Broken pipe: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 709

This looks like it could be related to:
this or
this

And require:

services:
  selenium:
    image: selenium/standalone-firefox:3.12.0-americium
    volumes:
        - /dev/shm:/dev/shm

but unfortunately I do have Insufficient privileges to use volumes

Keeping this thread updated for others to be able to find.

I figured this out, and it was my mistake completely. The changes I was making were more complex that the code snippets given, and there was a knock on effect that I had not realised, that I was conflating with this error.

The example given does show this, but to be clear for anyone reading, when using selenium/standalone-firefox (or chrome):

localhost cannot be used in the address of the tests, as selenium will not understand where it is. The name of the container must be used where the app server is running. In the code snippet shown above this would be http://e2e-firefox:5000.

When looking for the host from WebDriverIO (or similar), it must point to selenium/standalone-firefox. In the code snippet given above this means: host: selenium.