Download the PHP package drupaltest/behat-traits without Composer
On this page you can find all versions of the php package drupaltest/behat-traits. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drupaltest/behat-traits
More information about drupaltest/behat-traits
Files in drupaltest/behat-traits
Package behat-traits
Short Description A collection of traits that help to quickly develop custom Context classes for testing Drupal sites using Behat.
License EUPL-1.2
Informations about the package behat-traits
Behat traits
A collection of traits that help to quickly develop custom Context classes for testing Drupal sites using Behat.
The following traits are included:
BrowserCapabilityDetectionTrait
: allows to detect whether a scenario is using a browser that supports JavaScript. This can be used to write step definitions that can interact both with JavaScript behaviors and non-JS fallbacks.EntityTrait
: provides methods that allow to interact with entities using human readable names in step definitions, and translate them to machine names.PageCacheTrait
: allows to write step definitions that are aware of whether the page that is currently loaded is cached or cacheable.
Each of these traits come with an example context that include some step definitions to demonstrate how to use the traits.
Requirements
This depends on the following software:
Installation
Install the package and its dependencies. Since this is intended to be used for
testing, use the --dev
option to install it as a development dependency:
Usage
The project offers a number of traits that help to quickly create custom Behat Context classes by performing common tasks that are typically needed in step definitions for Drupal projects.
For some examples on how this can be used, see the test contexts in the
./src/Context/
folder.
Setting up a development environment
If you want to contribute to Behat Traits you can install a local development environment for it by executing the following steps:
Step 0: Clone the repository
Using a local LAMP stack
Step 1: Install dependencies
Step 2: Configure the environment
Copy runner.yml.dist
to runner.yml
and change the configuration to match
your local environment. Typically you will need to specify localhost
as your
database host, and change your base URL and database credentials.
Step 3: Build
This will symlink the module in the proper directory within the test environment and perform token substitution in test configuration files.
Step 4: Install
Your test site will be available at ./build
.
Using Docker Compose
Step 0: Download images
Step 1: Install dependencies
Step 2: Configure the environment
Copy runner.yml.dist
to runner.yml
and change the configuration to match
your local environment if needed. Usually this can be skipped since the module
ships with default configuration that matches the Docker environment.
Step 3: Build
This will symlink the module in the proper directory within the test environment and perform token substitution in test configuration files.
Step 4: Install
Your test site will be available at http://localhost:8080/build.
Running tests
Using a local LAMP stack
Coding standards
Behat tests
Using Docker Compose
Coding standards
Behat tests