Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .ddev/addon-metadata/addon-template/manifest.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions .ddev/addon-metadata/ddev-selenium-standalone-chrome/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: ddev-selenium-standalone-chrome
repository: ddev/ddev-selenium-standalone-chrome
version: 2.0.0-rc2
install_date: "2025-08-14T11:26:49+03:00"
project_files:
- docker-compose.selenium-chrome.yaml
- config.selenium-standalone-chrome.yaml
global_files: []
removal_actions:
- |
#ddev-nodisplay
#ddev-description:Remove docker-compose.selenium-chrome_extras.yaml file
if [ -f docker-compose.selenium-chrome_extras.yaml ]; then
if grep -q '#ddev-generated' docker-compose.selenium-chrome_extras.yaml; then
rm -f docker-compose.selenium-chrome_extras.yaml
else
echo "Unwilling to remove '$DDEV_APPROOT/.ddev/docker-compose.selenium-chrome_extras.yaml' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete."
fi
fi
12 changes: 10 additions & 2 deletions .ddev/config.selenium-standalone-chrome.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ddev-generated
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed, so new version can override the file

# Remove the line above if you don't want this file to be overwritten when you run
# ddev get ddev/ddev-selenium-standalone-chrome
#
# This file comes from https://github.com/ddev/ddev-selenium-standalone-chrome
#
web_environment:
Expand All @@ -8,16 +12,20 @@ web_environment:
# Use disable-dev-shm-usage instead of setting shm_usage
# https://developers.google.com/web/tools/puppeteer/troubleshooting#tips
# The format of chromeOptions is defined at https://chromedriver.chromium.org/capabilities
- MINK_DRIVER_ARGS_WEBDRIVER=[\"chrome\", {\"browserName\":\"chrome\",\"chromeOptions\":{\"w3c\":false,\"args\":[\"--window-size=1920,1080\", \"--disable-gpu\", \"--no-sandbox\", \"--disable-dev-shm-usage\"]}}, \"http://selenium-chrome:4444/wd/hub\"]
- MINK_DRIVER_ARGS_WEBDRIVER=[\"chrome\", {\"browserName\":\"chrome\",\"goog:chromeOptions\":{\"w3c\":true,\"args\":[\"--disable-dev-shm-usage\",\"--disable-gpu\",\"--headless\",\"--dns-prefetch-disable\"]}}, \"http://selenium-chrome:4444/wd/hub\"]
# Nightwatch
- DRUPAL_TEST_BASE_URL=http://web
- DRUPAL_TEST_DB_URL=mysql://db:db@db/db
- DRUPAL_TEST_WEBDRIVER_HOSTNAME=selenium-chrome
- DRUPAL_TEST_WEBDRIVER_PORT=4444
- DRUPAL_TEST_WEBDRIVER_PATH_PREFIX=/wd/hub
- DRUPAL_TEST_WEBDRIVER_W3C=true
# --window-size=1920,1080 is needed to fix random timeouts in tests. See: https://community.latenode.com/t/selenium-webdriver-timeout-issue-when-running-in-headless-mode-with-c/21952/4
- DRUPAL_TEST_WEBDRIVER_CHROME_ARGS=--disable-dev-shm-usage --disable-gpu --headless --dns-prefetch-disable --window-size=1920,1080
- DRUPAL_TEST_CHROMEDRIVER_AUTOSTART=false
- DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY=../
- DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES=node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest
- DRUPAL_NIGHTWATCH_OUTPUT=reports/nightwatch
# DTT
- DTT_BASE_URL=http://web
- DTT_MINK_DRIVER_ARGS=[\"chrome\", {\"browserName\":\"chrome\",\"chromeOptions\":{\"w3c\":false,\"args\":[\"--window-size=1920,1080\", \"--disable-gpu\", \"--no-sandbox\", \"--disable-dev-shm-usage\"]}}, \"http://selenium-chrome:4444/wd/hub\"]
- DTT_MINK_DRIVER_ARGS=[\"chrome\", {\"browserName\":\"chrome\",\"goog:chromeOptions\":{\"w3c\":true,\"args\":[\"--disable-dev-shm-usage\",\"--disable-gpu\",\"--headless\",\"--dns-prefetch-disable\"]}}, \"http://selenium-chrome:4444/wd/hub\"]
21 changes: 12 additions & 9 deletions .ddev/docker-compose.selenium-chrome.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#ddev-generated
# Remove the line above if you don't want this file to be overwritten when you run
# ddev get ddev/ddev-selenium-standalone-chrome
#
# This file comes from https://github.com/ddev/ddev-selenium-standalone-chrome
#
version: '3.6'
services:
selenium-chrome:
image: seleniarm/standalone-chromium:4.1.4-20220429
image: selenium/standalone-chromium:138.0
container_name: ddev-${DDEV_SITENAME}-selenium-chrome
expose:
# The internal noVNC port, which operates over HTTP so it can be exposed
Expand All @@ -13,17 +16,17 @@ services:
- VIRTUAL_HOST=$DDEV_HOSTNAME
- HTTPS_EXPOSE=7900:7900
- HTTP_EXPOSE=7910:7900
- SCREEN_WIDTH=1920
- SCREEN_HEIGHT=1080
external_links:
- ddev-router:${DDEV_SITENAME}.${DDEV_TLD}
#ports:
# VNC access for a traditional VNC client like macOS "Screen Sharing".
# - "5900:5900"
- VNC_NO_PASSWORD=1
# To enable VNC access for traditional VNC clients like macOS "Screen Sharing",
# uncomment the following two lines.
#ports:
# - "5900:5900"
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
volumes:
# To enable file uploads in E2E tests.
- ${DDEV_APPROOT}:/var/www/html:r
- ".:/mnt/ddev_config"

web:
Expand Down
5 changes: 5 additions & 0 deletions .ddev/docker-compose.selenium-chrome_extras.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ddev-generated
services:
selenium-chrome:
external_links:
- "ddev-router:${DDEV_PROJECT}.${DDEV_TLD}"
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,16 @@ See the [example](https://github.com/Gizra/drupal-starter/blob/main/web/modules/
# Run a single method from a test file.
ddev phpunit --filter testHomepageCache web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralHomepageTest.php

We also have capability to write tests which run on a headless chrome browser with
Javascript capabilities. See [`Drupal\Tests\server_general\ExistingSite\ServerGeneralSelenium2TestBase`](https://github.com/Gizra/drupal-starter/blob/aa3c204dc7ac279964a694c675c35062c7fbcd9f/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralSelenium2TestBase.php)
for the test base, and [`Drupal\Tests\server_general\ExistingSite\ServerGeneralHomepageTest`](https://github.com/Gizra/drupal-starter/blob/aa3c204dc7ac279964a694c675c35062c7fbcd9f/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralHomepageTest.php) for the
example implementation.
We also have capability to write tests which run on a headless Chrome browser with
Javascript capabilities. See [`ServerGeneralHomepageTest`](https://github.com/Gizra/drupal-starter/blob/aa3c204dc7ac279964a694c675c35062c7fbcd9f/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralHomepageTest.php) for an example.

### Debugging

When it is hard to understand a test failure, a peek into the browser might help.
For Selenium-based ones, you can take screenshots using the `takeScreenshot()` method. This captures and saves
the screenshot in `/web/sites/simpletest/screenshots`.
You can also watch what the tests are doing in the browser using noVNC. To do so, simply open a browser and open
https://drupal-starter.ddev.site:7900 and click Connect. The password is `secret`. Now simply run the tests
https://drupal-starter.ddev.site:7900 and click Connect. Now run the tests
and you can see the test running in the browser.

For faster, virtual browser-based tests, you can use `createHtmlSnapshot` and it will dump the HTML content
Expand Down