Repository navigation
Adds phpunit and nightwatch testing capability #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1b54b54
9fe01a5
100a88f
d96ca35
5858483
91a48b2
d845f39
f4a4162
d18797e
1e3ea61
74e0f60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Run Nightwatch | ||
| ## Usage: nightwatch [flags] [args] | ||
| ## Example: "ddev nightwatch" or "ddev nightwatch --tag core" | ||
|
|
||
| # Installs dependencies if not already run. | ||
| if [ ! -d /var/www/html/web/core/node_modules ]; then | ||
| yarn --cwd /var/www/html/web/core install | ||
| fi | ||
|
|
||
| yarn --cwd /var/www/html/web/core test:nightwatch $@ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Run PHPUnit | ||
| ## Usage: phpunit [flags] [args] | ||
| ## Example: "ddev phpunit --group big_pipe" or "ddev phpunit core/modules/action" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a good place in a ddev command to add troubleshooting steps when running
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. docs at https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/, Description, Usage, and Example are what you get. For example,
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess troubleshooting steps would have to go in Description?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the description be multi-line? |
||
|
|
||
| mkdir -p /var/www/html/web/sites/simpletest/browser_output | ||
|
mradcliffe marked this conversation as resolved.
Resolved
|
||
|
|
||
| cd web | ||
|
|
||
| BROWSERTEST_OUTPUT_DIRECTORY=/var/www/html/web/sites/simpletest/browser_output \ | ||
| BROWSERTEST_OUTPUT_BASE_URL=http://localhost:8080 \ | ||
| SIMPLETEST_DB="mysql://db:db@db/db" \ | ||
| SIMPLETEST_BASE_URL="http://localhost" \ | ||
| php ../vendor/bin/phpunit -c core/phpunit.xml.dist $@ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| --- | ||
| # 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://localhost | ||
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # Drupal | ||
| web/ | ||
| vendor/ | ||
| /web/ | ||
| /vendor/ | ||
| composer.json | ||
| composer.lock | ||
| .editorconfig | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mradcliffe I think it would be better if
yarn installruns during 'Prebuild', no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I thought maybe it would be too much to add yarn install during the prebuild, and only do it as needed, but I thik you're right, and it would help setup a front-end contributor to run es6 transformation and linting tasks. +1