From a7c8e2de98aa3d038b43eb885ae6ba6138b13075 Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Sun, 4 Dec 2022 11:06:03 -0500 Subject: [PATCH] Move to a config file. (#7) * Move to a config file. * Add #ddev-generated * Use install.yaml to copy * Escape quotes * Elaborate install instructions --- README.md | 9 ++++++-- config.selenium-standalone-chrome.yaml | 27 ++++++++++++++++++++++++ docker-compose.selenium-chrome.yaml | 29 ++++++-------------------- install.yaml | 1 + 4 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 config.selenium-standalone-chrome.yaml diff --git a/README.md b/README.md index 7822008..0f1ceaa 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/config.selenium-standalone-chrome.yaml b/config.selenium-standalone-chrome.yaml new file mode 100644 index 0000000..f8c0a60 --- /dev/null +++ b/config.selenium-standalone-chrome.yaml @@ -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\"] diff --git a/docker-compose.selenium-chrome.yaml b/docker-compose.selenium-chrome.yaml index 3991fb4..a13a167 100644 --- a/docker-compose.selenium-chrome.yaml +++ b/docker-compose.selenium-chrome.yaml @@ -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: @@ -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 \ No newline at end of file diff --git a/install.yaml b/install.yaml index ba30164..61b5e37 100644 --- a/install.yaml +++ b/install.yaml @@ -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: