Docksal: Several browsers for Behat

Created on 17 Aug 2017  路  2Comments  路  Source: docksal/docksal

if I add image selenium/standalone-firefox instead of selenium/standalone-chrome it works.
How should I configure browser service for multiple browsers?

I tried:

  # Browser
  browser:
    hostname: browser
    image: selenium/standalone-chrome

  browser_firefox:
    hostname: browser-firefox
    image: selenium/standalone-firefox

but it does not work:

Could not open connection: Curl error thrown for http POST to http://browser-firefox:4444/wd/hub/session with params: {"desiredCapabilities":{"tags":["cli","PHP 5.6.30-0+deb8u1"],"version":"","browser":"firefox","ignoreZoomSetting":false,"name":"Behat feature suite","browserName":"firefox"}}

Failed to connect to browser-firefox port 4444: Connection refused
馃彿question

Most helpful comment

This is because these containers are running Selenium on the default port 4444. You're attempting to run 2 selenium servers both on port 4444.

Try this.

  browser:
    hostname: browser
    image: selenium/standalone-chrome
    ports:
      - "4444:4444"

  browser_firefox:
    hostname: browser-firefox
    image: selenium/standalone-firefox
    ports:
      - "4443:4444"

And your behat.yml should be updated accordingly

docker:
  extensions:
    Behat\MinkExtension:
      # URL of the site when accessed inside Docksal.
      base_url: http://web
      browser_name: chrome
      selenium2:
        wd_host: http://browser:4444/wd/hub

I would advise against this. Behat really isn't meant for cross browser compatibility testing. The browsers in these containers are running on top of Selenium, which will not yield the same results as the browser end users will experience. http://mink.behat.org/en/latest/guides/drivers.html#driver-feature-support
It's usually best to pick the browser (and driver) that best support you project's features, and runs the fastest.

All 2 comments

This is because these containers are running Selenium on the default port 4444. You're attempting to run 2 selenium servers both on port 4444.

Try this.

  browser:
    hostname: browser
    image: selenium/standalone-chrome
    ports:
      - "4444:4444"

  browser_firefox:
    hostname: browser-firefox
    image: selenium/standalone-firefox
    ports:
      - "4443:4444"

And your behat.yml should be updated accordingly

docker:
  extensions:
    Behat\MinkExtension:
      # URL of the site when accessed inside Docksal.
      base_url: http://web
      browser_name: chrome
      selenium2:
        wd_host: http://browser:4444/wd/hub

I would advise against this. Behat really isn't meant for cross browser compatibility testing. The browsers in these containers are running on top of Selenium, which will not yield the same results as the browser end users will experience. http://mink.behat.org/en/latest/guides/drivers.html#driver-feature-support
It's usually best to pick the browser (and driver) that best support you project's features, and runs the fastest.

@ArtuGit please use the suggestion above from @aczietlow. Going to close this ticket.

Was this page helpful?
0 / 5 - 0 ratings