quicksprint icon indicating copy to clipboard operation
quicksprint copied to clipboard

Automatically configure chromedriver, PHPUnit, and Nightwatch

Open mglaman opened this issue 4 years ago • 1 comments

I'm not sure how to do it. But here's what is needed to get DDEV configured and running "all of the tests"

https://github.com/bluehorndigital/drupal-testing-workshop/blob/main/.ddev/docker-compose.testing.yaml

---
# Adds Chromedriver and Drupal PHPUnit test environment variables for running tests.
version: '3.6'
services:
  chromedriver:
    image: drupalci/chromedriver:production
    container_name: ddev-${DDEV_SITENAME}-chromedriver
    labels:
      com.ddev.site-name: ${DDEV_SITENAME}
      com.ddev.approot: $DDEV_APPROOT

  web:
    links:
      - chromedriver:$DDEV_HOSTNAME
    environment:
      # PHPUnit
      SYMFONY_DEPRECATIONS_HELPER: weak
      SIMPLETEST_DB: mysql://db:db@db:3306/db
      SIMPLETEST_BASE_URL: http://web
      BROWSERTEST_OUTPUT_DIRECTORY: /var/www/html/private/browsertest_output
      BROWSERTEST_OUTPUT_BASE_URL: $DDEV_PRIMARY_URL
      MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox"]}}, "http://chromedriver:9515"]'

      # Nightwatch
      DRUPAL_TEST_BASE_URL: http://web
      DRUPAL_TEST_DB_URL: mysql://db:db@db:3306/db
      DRUPAL_TEST_WEBDRIVER_HOSTNAME: chromedriver
      DRUPAL_TEST_WEBDRIVER_PORT: 9515
      DRUPAL_TEST_CHROMEDRIVER_AUTOSTART: 'false'
      DRUPAL_TEST_WEBDRIVER_CHROME_ARGS: "--disable-gpu --headless --no-sandbox"
      DRUPAL_NIGHTWATCH_OUTPUT: reports/nightwatch
      DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES: node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest

This was brought up in https://github.com/bluehorndigital/drupal-testing-workshop/issues/10

mglaman avatar Mar 24 '21 22:03 mglaman

  • [ ] confirm image is added or add it to bundled images with license info
  • [ ] adapt nightwatch/phpunit commands
  • [ ] add yaml config (works as-is) from example
  • [ ] add docs

mradcliffe avatar Mar 24 '21 22:03 mradcliffe