Running selenium tests using drupalextension inside ddev docker containers

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Running selenium tests using drupalextension inside ddev docker containers



Just received help from rfay on Drupal slack, and wanted to post both problem and solution here for the reference of others.



Problem: Get DrupalExtension based testing working inside of ddev containers. This includes adding a separate selenium container to the existing configuration, and having it be able to reference the web host container.


web




1 Answer
1



Prerequisites: have a working ddev instance hosting Drupal. There are examples already to set that up, so I won't repeat that here.



The above task required the following additions:



File: docker-compose.selenium.yml


version: '3'

services:
selenium:
container_name: ddev-${DDEV_SITENAME}-selenium
image: selenium/standalone-chrome-debug:3.13.0-argon
networks:
default:
aliases:
- web



The last bit is critical; the selenium container needs to know about the web container running the drupal instance to connect to it, but as it is a dependency of the web container, you can't use 'links'. You have to use the aliases approach, using the default network.



File: docker-compose.override.yml


version: '3'

services:
web:
depends_on:
- db
- selenium
links:
- db:db
- selenium:selenium


MinkExtension



(modify file behat.yml)


default:
extensions:
"Behat\MinkExtension":
goutte: null
base_url: 'http://web'
javascript_session: selenium2
selenium2:
browser: "chrome"
wd_host: http://selenium:4444/wd/hub
capabilities:
extra_capabilities:
idle-timeout: 50



base_url and wd_host entries were critical in getting this to work.


base_url


wd_host



For more information on the last, see step 5 in the drupalextension docs






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

CRM reporting Extension - SSRS instance is blank

Keycloak server returning user_not_found error when user is already imported with LDAP