integratedexperts / behat-steps
Collection of steps for Behat
Installs: 143 026
Dependents: 1
Suggesters: 0
Security: 0
Stars: 18
Watchers: 4
Forks: 12
Open Issues: 5
Requires
- php: >=8.1
- behat/behat: ^3
- behat/mink: >=1.11
- behat/mink-selenium2-driver: >=1.7
- drupal/drupal-extension: ^5
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1
- drevops/behat-screenshot: ^1.5
- drupal/coder: ^8.3
- dvdoug/behat-code-coverage: ^5.3
- mglaman/phpstan-drupal: ^1.2
- palantirnet/drupal-rector: ^0.20
- php-parallel-lint/php-parallel-lint: ^1.3
- phpcompatibility/php-compatibility: ^9.3
- phpmd/phpmd: ^2.13
- phpspec/prophecy-phpunit: ^2.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9.5
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.1
- 2.0.0
- 1.x-dev
- dev-main / 1.x-dev
- 1.6.0
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
- 0.3.1
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-renovate/all-dependencies
- dev-feaure/update-selenium-standalone-chromium
- dev-revert-248-feature/increase-test-coverage-part-2
This package is auto-updated.
Last update: 2024-09-18 01:14:02 UTC
README
A collection of Behat steps for Drupal
Installation
composer require --dev drevops/behat-steps:^2
Usage
Add required traits to your FeatureContext.php
(example):
<?php use Drupal\DrupalExtension\Context\DrupalContext; use DrevOps\BehatSteps\ContentTrait; /** * Defines application features from the specific context. */ class FeatureContext extends DrupalContext { use ContentTrait; }
Modification of behat.yml
configuration is not required.
Exceptions
\Exception
is thrown for all assertions.\RuntimeException
is thrown for any unfulfilled requirements within a step.
Available steps
Skipping before scenario hooks
Some traits provide beforeScenario
hook implementations. These can be disabled
by adding behat-steps-skip:METHOD_NAME
tag to your test.
For example, to skip beforeScenario
hook from JsTrait
, add
@behat-steps-skip:jsBeforeScenarioInit
tag to the feature.
Development
Local environment setup
- Install Docker, Pygmy, Ahoy and shut down local web services (Apache/Nginx, MAMP etc)
- Checkout project repository in one of the supported Docker directories.
pygmy up
ahoy build
- Access built site at http://behat-steps.docker.amazee.io/
Use ahoy --help
to see the list of available commands.
Apple Silicon adjustments
cp docker-compose.override.default.yml docker-compose.override.yml
Running tests
The source code of traits is tested by running Behat tests in the same way they would be run in your project: traits are included into FeatureContext.php and then ran on the pre-configured fixture Drupal site using test features.
Run ahoy build
to setup a fixture Drupal site in the build
directory.
ahoy test-bdd # Run all tests ahoy test-bdd path/to/file # Run all scenarios in specific feature file ahoy test-bdd -- --tags=wip # Run all scenarios tagged with `@wip` tag
Debugging tests
ahoy debug
- Set breakpoint
- Run tests with
ahoy test-bdd
- your IDE will pickup an incoming debug connection
Updating fixture site
- Build the fixture site and make the required changes
ahoy drush cex -y
ahoy update-fixtures
to copy configuration changes from build directory to the fixtures directory
Repository created using https://getscaffold.dev/ project scaffold template