Skip to content

Commit

Permalink
Move to a config file. (#7)
Browse files Browse the repository at this point in the history
* Move to a config file.

* Add #ddev-generated

* Use install.yaml to copy

* Escape quotes

* Elaborate install instructions
  • Loading branch information
weitzman authored Dec 4, 2022
1 parent 20b8429 commit a7c8e2d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 25 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

## Introduction

In ddev v1.19+, run `ddev get drud/ddev-selenium-standalone-chrome` to fetch this service into your local DDEV installation. You may then check it into your source control if desired.

This service can be used with any project type. The examples below are Drupal-specific. Contributions for docs and tests that show this service working with other project types are appreciated.

## Install/Update

1. `ddev get drud/ddev-selenium-standalone-chrome`
2. Optional. Update the provided .ddev/config.selenium-standalone-chrome.yaml as you see fit(and remove the #ddev-generated line). You can also just override lines in your .ddev/config.yaml
3. Optional. Check config.selenium-standalone-chrome.yaml and docker-compose.selenium-chrome.yaml into your source control.
4. Update by re-running `ddev get drud/ddev-selenium-standalone-chrome`.

## Use

- Your project is now ready to run FunctionalJavascript and [Nightwatch](https://www.drupal.org/docs/automated-testing/javascript-testing-using-nightwatch) tests from Drupal core, or [Drupal Test Traits](https://gitlab.com/weitzman/drupal-test-traits) (DTT). All these types are tested in this repo. Some examples to try:
Expand Down
27 changes: 27 additions & 0 deletions config.selenium-standalone-chrome.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ddev-generated
# Remove the line above if you don't want this file to be overwritten when you run
# ddev get drud/ddev-selenium-standalone-chrome
#
# This file comes from https://github.com/drud/ddev-selenium-standalone-chrome
#
web_environment:
- BROWSERTEST_OUTPUT_DIRECTORY=/tmp
- BROWSERTEST_OUTPUT_BASE_URL=${DDEV_PRIMARY_URL}
- SIMPLETEST_BASE_URL=http://web
- SIMPLETEST_DB=mysql://db:db@db/db
# 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\":[\"--disable-gpu\",\"--headless\", \"--no-sandbox\", \"--disable-dev-shm-usage\"]}}, \"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_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_BASE_URL=http://web
- DTT_MINK_DRIVER_ARGS=[\"chrome\", {\"browserName\":\"chrome\",\"chromeOptions\":{\"w3c\":false,\"args\":[\"--disable-gpu\",\"--headless\", \"--no-sandbox\", \"--disable-dev-shm-usage\"]}}, \"http://selenium-chrome:4444/wd/hub\"]
29 changes: 6 additions & 23 deletions docker-compose.selenium-chrome.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# This file comes from https://github.com/drud/ddev-selenium-standalone-chrome.
#ddev-generated
# Remove the line above if you don't want this file to be overwritten when you run
# ddev get drud/ddev-selenium-standalone-chrome
#
# This file comes from https://github.com/drud/ddev-selenium-standalone-chrome
#
version: '3.6'
services:
Expand Down Expand Up @@ -26,25 +30,4 @@ services:

web:
links:
- selenium-chrome
environment:
- BROWSERTEST_OUTPUT_DIRECTORY=/tmp
- BROWSERTEST_OUTPUT_BASE_URL=${DDEV_PRIMARY_URL}
- SIMPLETEST_BASE_URL=http://web
- SIMPLETEST_DB=mysql://db:db@db/db
# 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":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "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_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_BASE_URL=http://web
- 'DTT_MINK_DRIVER_ARGS=["chrome", {"browserName":"chrome","chromeOptions":{"w3c":false,"args":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://selenium-chrome:4444/wd/hub"]'
- selenium-chrome
1 change: 1 addition & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: addon-template
pre_install_actions:
project_files:
- docker-compose.selenium-chrome.yaml
- config.selenium-standalone-chrome.yaml
global_files:
post_install_actions:
yaml_read_files:

0 comments on commit a7c8e2d

Please sign in to comment.