|
name: drupal-test |
|
recipe: drupal9 |
|
config: |
|
webroot: . |
|
php: 8.1 |
|
services: |
|
appserver: |
|
build_as_root: |
|
# Install nodejs and yarn in the main container. They have to live here |
|
# because PHP is required for the site installation and other ops in |
|
# nightwatch tests. |
|
# Following lines don't contain anything specific to Lando. Change them |
|
# only according to the official docs of nodejs and yarn. |
|
- curl -sL https://deb.nodesource.com/setup_16.x | bash - |
|
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - |
|
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list |
|
- apt-get update > /dev/null && apt-get install -y build-essential nodejs yarn |
|
build: |
|
- mkdir -p ${LANDO_WEBROOT}/sites/simpletest/browser_output |
|
- cd ${LANDO_WEBROOT}/core && yarn install |
|
overrides: |
|
environment: |
|
# These env vars can be placed in the web/core/.env file, which can be |
|
# lost on core updates. So they are here instead. Their docs are in |
|
# web/core/.env.example file. |
|
# Replace the project name in the base url. |
|
# The DB url needs to point to an existing DB, tests will create and |
|
# drop prefixed tables in it. |
|
# Change the nightwatch output dir if needed. |
|
# `lando rebuild` after changes. |
|
DRUPAL_TEST_BASE_URL: https://drupal-test.lndo.site |
|
DRUPAL_TEST_DB_URL: mysql://drupal9:drupal9@database/drupal9 |
|
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: ../sites/nightwatch |
|
DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES: node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest |
|
# PhpUnit vars. |
|
SIMPLETEST_BASE_URL: https://drupal-test.lndo.site |
|
SIMPLETEST_DB: mysql://drupal9:drupal9@database/drupal9 |
|
BROWSERTEST_OUTPUT_DIRECTORY: /app/sites/simpletest/browser_output |
|
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", { "chromeOptions": { "args": [ "disable-gpu", "headless", "no-sandbox" ] } }, "http://chromedriver:9515"]' |
|
chromedriver: |
|
type: compose |
|
services: |
|
image: drupalci/chromedriver:production |
|
# This is the ENTRYPOINT + CMD from the Dockerfile. Empty whitelisted-ips |
|
# param opens the chromedriver port for other hosts. |
|
command: chromedriver --log-path=/tmp/chromedriver.log --verbose --whitelisted-ips= |
|
tooling: |
|
drush: |
|
service: appserver |
|
env: |
|
DRUSH_OPTIONS_URI: "https://drupal-test.lndo.site" |
|
nightwatch: |
|
service: appserver |
|
cmd: cd ${LANDO_WEBROOT}/core && yarn test:nightwatch |
|
phpunit: |
|
service: appserver |
|
cmd: phpunit -c /app/core/phpunit.xml.dist --bootstrap /app/core/tests/bootstrap.php --printer "\Drupal\Tests\Listeners\HtmlOutputPrinter" |
A fresh working example (for a specific drupal contrib project) is here.