Drupal support for Behat/Mink.
/behat.yml
default:
suites:
default:
contexts:
- FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
extensions:
Drupal\MinkExtension:
goutte: ~
selenium2: ~
base_url: http://seven.l
Drupal\DrupalExtension:
blackbox: ~
Defining Regions
Map regions in behat.yml.
https://behat-drupal-extension.readthedocs.io/en/v4.0.1/blackbox.html#region-steps
default:
extensions:
Drupal\DrupalExtension:
region_map:
start: "#start"
Message Selectors
Test status messages.
https://behat-drupal-extension.readthedocs.io/en/v4.0.1/blackbox.html#message-selectors
Text Strings
Configure text values.
https://behat-drupal-extension.readthedocs.io/en/v4.0.1/blackbox.html#override-text-strings
Blackbox Driver
blackbox: ~
Blackbox driver connects the Drupal backend with Behat.
https://github.com/jhedstrom/drupalextension/blob/main/doc/blackbox.rst
Drush API Driver
Can run on remote servers using drush aliases.
Drupal\DrupalExtension.api_driver: drush
in behat.yml
.
Requires: https://github.com/drush-ops/behat-drush-endpoint
https://behat-drupal-extension.readthedocs.io/en/v4.0.1/drush.html
Drupal API Driver
Direct database connection, works on same site.
api_driver: drupal
.
https://behat-drupal-extension.readthedocs.io/en/v4.0.1/drupalapi.html
Chrome Driver
Best support for websites.
https://mink.behat.org/en/latest/drivers/chrome.html
Contexts
Available test targets and actions in test steps.
https://behat-drupal-extension.readthedocs.io/en/v4.0.1/contexts.html
Hooks
Call functions before/after tests for setup/teardown.
https://behat-drupal-extension.readthedocs.io/en/v4.0.1/contexts.html#drupal-extension-hooks
https://docs.behat.org/en/v2.5/guides/3.hooks.html
Running tests
TODO
Run chrome inside ddev with vnc.