Releases: drevops/behat-steps
3.1.0
What's new since 3.0.0
New steps
@Then the element :selector1 should appear after the element :selector2
@Then the text :text1 should appear after the text :text2
@Then current url should have the :param parameter
@Then current url should have the :param parameter with the :value value
@Then current url should not have the :param parameter
@Then current url should not have the :param parameter with the :value value
@When I check the checkbox :selector
@When I uncheck the checkbox :selector
@Given browser validation for the form :selector is disabled
@When I visit the :content_type content revisions page with the title :title
@When I visit the :vocabulary_machine_name term page with the name :term_name
@When I visit the :vocabulary_machine_name term edit page with the name :term_name
@When I visit the :vocabulary_machine_name term delete page with the name :term_name
Updated steps
@Then the path should be :path
@Then the path should not be :path
@When I edit the :vocabulary_machine_name vocabulary :term_name term page
Changelog:
- [#416] Added
When I visit the :vocabulary_machine_name term delete page with the name :term_name
@nsineok (#420) - [#413] Added assertion for the element after element. @nsineok (#419)
- Update all dependencies @renovate[bot] (#417)
- Block, Menu, Date traits pipefail @nsineok (#421)
- #411: added a new scenario - disable browser validation for the form. @nsineok (#412)
- [#399] Added revisions support. @skipper-vp (#408)
- [#407]: Added query parts assertion. @skipper-vp (#410)
- Removed periods from the scenarios in tests. @AlexSkrypnyk (#404)
- [#402] Fixed path trait failing on
<front>
. @AlexSkrypnyk (#403) - Added CheckboxTrait. @skipper-vp (#400)
- Fixed FieldTrait incorrectly sitting in the Drupal namespace. @AlexSkrypnyk (#401)
- Expose STEPS.md file to consumer projects. @AlexSkrypnyk (#397)
Full Changelog: 3.0.0...3.1.0
@AlexSkrypnyk, @df-nikita, @nsineok, @renovate[bot], @skipper-vp and renovate[bot]
3.0.0 - Consistent language and new namespaces
Consistent language for step definition is here! 🎉
A list of new steps are available in the STEPS.md
We’ve reviewed and updated every step to align with our strict language guidelines. We've also added automated checks to make sure that the step definition are written in a consistent way in the future.
Drupal-specific traits are now namespaced under Drupal/
, making it clear that this library is framework-agnostic and suitable for non-Drupal projects as well. More integrations with PHP applications are on the way.
We’ve also added support for Drupal 11, ensuring compatibility with all actively maintained versions.
The testing coverage was increased: we've added positive and negative tests for every trait to guarantee that the tests pass and fail when they expected to do so; we've also added unit tests for some of the traits to check for the most error-prone code.
For migrating from 2.x
, please refer to the migration map.
🤖 Expand to get an AI prompt for features migration
Copy and paste below into your agentic AI client chat.
# Guide to Updating Behat Steps Package in Drupal Projects
This guide explains how to update the drevops/behat-steps package to the latest version and update your Behat tests to work with the new step definitions.
## Overview of the Update Process
1. Update the package version in composer.json
2. Update namespace imports in FeatureContext.php
3. Update step definitions in feature files
4. Test and fix each feature file
## Step-by-Step Instructions
### 1. Update the Package
First, check your current version of drevops/behat-steps in composer.json. Then update to the latest version (3.0.1 or newer) using your project's package management tool.
### 2. Fix FeatureContext.php
The namespace structure has changed in version 3.0.1. You'll need to update your FeatureContext.php file:
1. Locate your FeatureContext.php file (typically in tests/behat/bootstrap/)
2. Update the namespace imports at the top of the file
- Generic traits are now in the root namespace: `DrevOps\BehatSteps\`
- Drupal-specific traits are now in a subdirectory: `DrevOps\BehatSteps\Drupal\`
For example, change:
use DrevOps\BehatSteps\ContentTrait;
use DrevOps\BehatSteps\FieldTrait;
use DrevOps\BehatSteps\FileTrait;
To:
use DrevOps\BehatSteps\Drupal\ContentTrait;
use DrevOps\BehatSteps\Drupal\FieldTrait;
use DrevOps\BehatSteps\Drupal\FileTrait;
Non-Drupal traits remain in the root namespace:
use DrevOps\BehatSteps\LinkTrait;
use DrevOps\BehatSteps\PathTrait;
use DrevOps\BehatSteps\ResponseTrait;
use DrevOps\BehatSteps\WaitTrait;
### 3. Consult the STEPS.md File
**This is the most important reference for the update process!**
The drevops/behat-steps package includes a comprehensive STEPS.md file that documents all available steps. After updating the package:
1. Locate this file at `vendor/drevops/behat-steps/STEPS.md`
2. Review this file thoroughly - it contains all available steps with examples
3. Use this as your primary reference when updating feature files
The STEPS.md file is organized into sections:
- Generic steps (Cookie, Date, Element, Path, etc.)
- Drupal-specific steps (Content, Field, File, Media, etc.)
Each section includes detailed examples of how to use the steps, which is invaluable for updating your tests correctly.
### 4. Find and Update Feature Files
Examine your feature files (typically in tests/behat/features/) and update step definitions to match the new format from STEPS.md:
#### Common Changes Needed:
1. **Path Assertions**:
- Change: `I should be in the "path" path`
- To: `the path should be "path"`
2. **HTTP Response Assertions**:
- Change: `I should get a 200 HTTP response`
- To: `the response status code should be 200`
3. **Response Header Assertions**:
- Change: `response header "X-Header" contains "value"`
- To: `the response header "X-Header" should contain the value "value"`
4. **Link Interaction**:
- Change: `I click the link with title "Title"`
- To: `I click on the link with the title "Title"` or simply `I click "Title"`
5. **Wait Steps**:
- Change: `I wait 2 seconds`
- To: `I wait for 2 seconds`
6. **File Creation**:
- Change: `unmanaged file "public://file.txt" created with content "content"`
- To: `the unmanaged file at the URI "public://file.txt" exists with "content"`
7. **Content Visiting**:
- Change: `I visit content_type "Title"`
- To: `I visit the "content_type" content page with the title "Title"`
### 5. Reference Available Steps
There are two ways to see all available steps in the new package:
1. **STEPS.md File (Recommended)**:
- This is the most comprehensive and user-friendly reference
- Contains examples and descriptions for each step
- Located at `vendor/drevops/behat-steps/STEPS.md`
2. **Behat Definitions Command**:
- Use the Behat definitions command appropriate for your system:
vendor/bin/behat --definitions=i
- This will show all available step definitions but with less context than STEPS.md
Always refer to STEPS.md first, as it provides clearer examples and more detailed information about each step.
### 6. Test Each Feature File
After updating step definitions:
1. Run each feature file individually to identify any issues
2. For failing tests, check screenshots if available to help diagnose the problems
3. Add `@skipped` tag to features that aren't ready to run (you can fix these later)
4. Once individual files pass, run the entire test suite
### 7. Common Troubleshooting
- **Step Not Found**: Verify you're using the current step syntax by checking the step definitions
- **Element Not Found**: The site structure may have changed - update selectors or navigation paths
- **Form Submission Issues**: For form tests, consider checking for broader success indicators rather than specific messages
### Reference Information
The STEPS.md file is your most important reference during this process. It contains:
1. Complete documentation of all available steps
2. Clear examples showing the exact format for each step
3. Descriptions of what each step does
4. Organization by trait/functionality for easy browsing
After updating the package, you should immediately locate and bookmark this file:
vendor/drevops/behat-steps/STEPS.md
If you need to understand specific Behat step behavior in detail, this file should be your first resource.
## Example: Updating a Contact Form Feature
Before:
Scenario: User submits a form
Given I am on the homepage
And I click the link with title "Contact"
When I fill in "Name" with "Test User"
And I press "Send message"
Then I should see the text "Your message has been sent."
After:
Scenario: User submits a form
Given I am on the homepage
And I click "Contact"
When I fill in "Name" with "Test User"
And I press "Send message"
Then I should not see an "#edit-submit" element
What's new since 2.7.0
- Update all dependencies (major) @renovate[bot] (#396)
- Updated docs. @AlexSkrypnyk (#395)
- Split docs generation by context. @AlexSkrypnyk (#394)
- Moved Drupal-related steps into own namespace. @AlexSkrypnyk (#392)
- Removed branch aliases from
composer.json
. @AlexSkrypnyk (#391) - Updated traits docs. @AlexSkrypnyk (#390)
- Updated docs generator to include trait info. @AlexSkrypnyk (#389)
- Merged
RoleTrait
intoUserTrait
. @AlexSkrypnyk (#388) - Merged
SelectTrait
intoFieldTrait
. @AlexSkrypnyk (#387) - Merged the
VisibilityTrait
intoElementTrait
. @AlexSkrypnyk (#386) - Fixed tags on tests. @AlexSkrypnyk (#385)
- [#367] Updated
BlockTrait
. @skipper-vp (#376) - Added unit tests for some traits. @AlexSkrypnyk (#384)
- Added tests for docs generator. @AlexSkrypnyk (#383)
- Fixed hook implementation names. @AlexSkrypnyk (#382)
- Fixed keywords in tests. @AlexSkrypnyk (#381)
- Added D11 to circleci. @skipper-vp (#380)
- Updated steps docs. @AlexSkrypnyk (#378)
- [#319]: Added D11. @skipper-vp (#377)
- [#368] Updated BlockContentTrait. @skipper-vp (#374)
- Fixed more coding standards and removed PHPMD. @AlexSkrypnyk (#373)
- [#302] Updated VisibilityTrait. @skipper-vp (#372)
- Updated examples in comments. @AlexSkrypnyk (#371)
- Moved JsTrait methods to ElementTrait. @AlexSkrypnyk (#370)
- Fixed methods prefixes. @AlexSkrypnyk (#369)
- [#299] Updated SearchApiTrait. @skipper-vp (#364)
- Updated 3.x with changes between 2.6 and 2.7. @AlexSkrypnyk (#366)
- [#292] Updated MenuTrait. @skipper-vp (#363)
- [#284]: Updated EmailTrait. @skipper-vp (#362)
- Updated SelectTrait. @skipper-vp (#361)
- Updated MediaTrait. @skipper-vp (#359)
- [#288]: Updated JSTrait. @skipper-vp (#358)
- [#287] Updated FileTrait. @skipper-vp (#357)
- [#280] Updated CookieTrait. @skipper-vp (#356)
- [#286] Updated FileDownloadTrait. @skipper-vp (#355)
- [#285] Updated FieldTrait. @skipper-vp (#351)
- [#290] Updated
LinkTrait
. @skipper-vp (#349)
Full Changelog: 2.7.0...3.0.0
@AlexSkrypnyk, @renovate[bot], @skipper-vp, Andrey Simonov and renovate[bot]
2.7.0
What's new since 2.6.0
- [#338] Added traits to create, configure blocks and block_content entities. @richardgaunt (#337)
- [#339] Fixed WYSIWYG not filling in multiple fields. @AlexSkrypnyk (#341)
- chore(deps): update selenium/standalone-chromium docker tag to v134 @renovate[bot] (#340)
- chore(deps): update selenium/standalone-chromium docker tag to v133 @renovate[bot] (#336)
- chore(deps): update all dependencies to v25.2.0 @renovate[bot] (#335)
- chore(deps): update uselagoon/php-8.2-fpm docker tag to v25.2.0 @renovate[bot] (#334)
- chore(deps): update selenium/standalone-chromium docker tag to v132 @renovate[bot] (#333)
- chore(deps): update all dependencies to v25 (major) @renovate[bot] (#332)
- chore(deps): update drevops/docker-wait-for-dependencies docker tag to v25.1.1 @renovate[bot] (#330)
- chore(deps): update uselagoon/php-8.2-fpm docker tag to v25 @renovate[bot] (#331)
- chore(deps): update drevops/ci-runner docker tag to v25 @renovate[bot] (#329)
- chore(deps): update drevops/docker-wait-for-dependencies docker tag to v25 @renovate[bot] (#328)
- chore(deps): update all dependencies to v24.12.0 @renovate[bot] (#327)
- chore(deps): update all dependencies to v24.12.0 @renovate[bot] (#326)
- chore(deps): update drevops/docker-wait-for-dependencies docker tag to v24.12.0 @renovate[bot] (#325)
- chore(deps): update selenium/standalone-chromium docker tag to v131 @renovate[bot] (#324)
- chore(deps): update all dependencies to v24.11.0 @renovate[bot] (#323)
- chore(deps): update drevops/ci-runner docker tag to v24.11.0 @renovate[bot] (#316)
Full Changelog: 2.6.0...2.7.0
@AlexSkrypnyk, @renovate[bot], @richardgaunt and renovate[bot]
2.6.0
What's new since 2.5.0
- chore(deps): update selenium/standalone-chromium docker tag to v130 @renovate (#277)
- Moved dev deps into fixture. @AlexSkrypnyk (#278)
- chore(deps): update uselagoon/php-8.2-cli-drupal docker tag to v24.10.0 @renovate (#276)
- Updated code to comply with PHPStan level 7. @AlexSkrypnyk (#274)
- chore(deps): update all dependencies to v24.10.0 @renovate (#275)
- Added
CookieTrait
. @AlexSkrypnyk (#273)
Full Changelog: 2.5.0...2.6.0
@AlexSkrypnyk, @renovate and @renovate[bot]
2.5.0
BC 🚨
These 2 step definitions were removed as it is no longer possible to enable/disable the test system within a test; tag a test with @email
instead:
Given I enable the test email system
Given I disable the test email system
What's new since 2.4.0
- Added a linter for Gherkin and updated test features. @AlexSkrypnyk (#271)
- Email Trait idempotency fixes. @NigelCunninghamRGA (#265)
- Simplified Email trait to be activated on
@email
tag only. @AlexSkrypnyk (#268) - Updated to
selenium/standalone-chromium:129.0
. @AlexSkrypnyk (#267) - chore(deps): update all dependencies @renovate (#264)
- Fixed coding standards. @AlexSkrypnyk (#266)
- chore(deps): update all dependencies to v24.8.0 @renovate (#263)
- Updated
ElementTrait
: Adding new an assert element with wildcard pattern exists. @tannguyen04 (#260) - Added
MetaTagTrait
@tannguyen04 (#261) - Added support for colour field @tannguyen04 (#258)
- Fixed deleting non existing menu items throwing errors. @tannguyen04 (#259)
- Added
UserTrait: set last access time
@tannguyen04 (#256) - Added steps:
scroll to element
andcheck element at the top of page
. @tannguyen04 (#257) - Added a list of step definitions to README.md @tannguyen04 (#255)
- Increase test coverage part 2 @tannguyen04 (#248)
- Increased test coverage. @tannguyen04 (#246)
- Added support to specify relative time in seconds in
DateTrait
. @tannguyen04 (#241)
Full Changelog: 2.4.0...2.5.0
@AlexSkrypnyk, @NigelCunninghamRGA, @renovate, @renovate[bot] and @tannguyen04
2.4.0
What's new since 2.3.0
This is a tiny release, but addresses an important BC change for OverrideTrait
. Also adds strict types.
- BC 🚨: Fixed
OverrideTrait
duplicating step definition names. Please see this note on how to upgrade. @AlexSkrypnyk (#240) - Updated build scripts to use Drupal 10.3. @AlexSkrypnyk (#240)
- Fixed coding standards. @AlexSkrypnyk (#240)
- chore(deps): update Docker containers to
v24.6.0
@renovate (#236)
Full Changelog: 2.3.0...2.4.0
@AlexSkrypnyk, @renovate and @renovate[bot]
2.3.0
What's new since 2.2.0
BC break 🚨
When I go to my edit profile page
-> When I go to my profile edit page
- [#212] Fixed
When I go to my profile edit page
. @AlexSkrypnyk (#219) - [#196] Added code coverage reporting. @AlexSkrypnyk (#213)
- [#216] Decommissioned Drupal 9 test fixtures. @AlexSkrypnyk (#217)
- Updated Drupal fixture to 10.2. @AlexSkrypnyk (#214)
- [#209] Supported additional entity properties when creating files. @ericgsmith (#210)
- chore(deps): update drevops/ci-runner docker tag to v24.4.0 @renovate (#211)
- chore(deps): update seleniarm/standalone-chromium docker tag to v123 @renovate (#207)
- chore(deps): update drevops/docker-wait-for-dependencies docker tag to v24.3.0 @renovate (#206)
- chore(deps): update uselagoon/php-8.1-fpm docker tag to v24.3.1 @renovate (#204)
- chore(deps): update uselagoon/php-8.1-cli-drupal docker tag to v24.3.1 @renovate (#203)
- chore(deps): update uselagoon/nginx-drupal docker tag to v24.3.1 @renovate (#202)
- chore(deps): update uselagoon/mariadb-drupal docker tag to v24.3.1 @renovate (#201)
- chore(deps): update uselagoon/php-8.1-cli-drupal docker tag to v24.3.0 @renovate (#200)
- chore(deps): update uselagoon/nginx-drupal docker tag to v24.3.0 @renovate (#199)
- chore(deps): update uselagoon/mariadb-drupal docker tag to v24.3.0 @renovate (#197)
- chore(deps): update uselagoon/php-8.1-fpm docker tag to v24.3.0 @renovate (#198)
- chore(deps): update dependency palantirnet/drupal-rector to ^0.20 @renovate (#195)
- chore(deps): update drevops/ci-runner docker tag to v24.3.0 @renovate (#194)
- chore(deps): update uselagoon/php-8.1-fpm docker tag to v24.2.0 @renovate (#193)
- chore(deps): update uselagoon/php-8.1-cli-drupal docker tag to v24.2.0 @renovate (#192)
- chore(deps): update uselagoon/mariadb-drupal docker tag to v24.2.0 @renovate (#190)
- chore(deps): update uselagoon/nginx-drupal docker tag to v24.2.0 @renovate (#191)
Full Changelog: 2.2.0...2.3.0
@AlexSkrypnyk, @ericgsmith, @renovate and @renovate[bot]
2.2.0
What's new since 2.1.0
IMPORTANT! Updates version constraints for Mink and MinkSelenium2Driver to use versions after the strict type updates.
If you used Syn
library in your custom FeatureContext.php
- update it accordingly based on changes in those packages. This package is fully compatible with the updated Syn
library.
- [#161] Updated behat/mink-selenium2-driver to 1.7 @tannguyen04 (#187)
- chore(deps): update drevops/docker-wait-for-dependencies docker tag to v24 @renovate (#185)
- [#127] Made dynamic condition for no managed files step. @tannguyen04 (#180)
- chore(deps): update release-drafter/release-drafter action to v6 @renovate (#183)
- [#174] Restructured code to follow scaffold 0.12.0 @tannguyen04 (#179)
- chore(deps): update seleniarm/standalone-chromium docker tag to v121 @renovate (#182)
- chore(deps): update drevops/ci-runner docker tag to v24 @renovate (#181)
- chore(deps): update uselagoon/php-8.1-fpm docker tag to v24 @renovate (#178)
- chore(deps): update uselagoon/php-8.1-cli-drupal docker tag to v24 @renovate (#177)
- chore(deps): update uselagoon/nginx-drupal docker tag to v24 @renovate (#176)
- chore(deps): update uselagoon/mariadb-drupal docker tag to v24 @renovate (#175)
- Added negative assertions for the TaxonomyTrait steps. @tannguyen04 (#172)
- chore(deps): update toshimaru/auto-author-assign action to v2.1.0 @renovate (#173)
- chore(deps): update dependency palantirnet/drupal-rector to ^0.19 @renovate (#171)
- chore(deps): update drevops/ci-runner docker tag to v23.12.0 @renovate (#170)
- chore(deps): update seleniarm/standalone-chromium docker tag to v120 @renovate (#169)
- [#124] Added support for CKEditor 5. @tannguyen04 (#168)
- chore(deps): update seleniarm/standalone-chromium docker tag to v117 @renovate (#167)
- Updated dependencies and added strict types. @AlexSkrypnyk (#162)
Full Changelog: 2.1.0...2.2.0
@AlexSkrypnyk, @renovate, @renovate[bot] and @tannguyen04
2.1.0
What's new since 2.0.1
IMPORTANT! Adds version constraints for Mink and MinkSelenium2Driver to use versions prior to strict type updates (which partially breaks some steps) and Syn
library updates.
The next minor version of behat-steps
will be compatible with newer versions of these packages and these constraints will be removed.
https://github.com/minkphp/Mink/releases/tag/v1.11.0
https://github.com/minkphp/MinkSelenium2Driver/releases/tag/v1.7.0
Features
- Added handling for multiple sessions in bigpipe. @richardgaunt (#148)
Chores
- chore(deps): update uselagoon/nginx-drupal docker tag to v23.12.0 @renovate (#158)
- chore(deps): update uselagoon/php-8.1-cli-drupal docker tag to v23.12.0 @renovate (#159)
- chore(deps): update uselagoon/php-8.1-fpm docker tag to v23.12.0 @renovate (#157)
- chore(deps): update uselagoon/mariadb-drupal docker tag to v23.12.0 @renovate (#156)
- chore(deps): update drevops/ci-runner docker tag to v23.11.0 @renovate (#160)
- chore(deps): update uselagoon/php-8.1-cli-drupal docker tag to v23.11.0 @renovate (#153)
- chore(deps): update uselagoon/php-8.1-fpm docker tag to v23.11.0 @renovate (#154)
- chore(deps): update uselagoon/nginx-drupal docker tag to v23.11.0 @renovate (#152)
- chore(deps): update uselagoon/mariadb-drupal docker tag to v23.11.0 @renovate (#151)
Full Changelog: 2.0.1...2.1.0
@AlexSkrypnyk, @renovate, @renovate[bot] and @richardgaunt
2.0.1
What's new since 2.0.0
- Fixed several static errors. @AlexSkrypnyk (#146)
- chore(deps): update uselagoon/php-8.1-cli-drupal docker tag to v23.10.0 @renovate (#141)
- chore(deps): update uselagoon/php-8.1-fpm docker tag to v23.10.0 @renovate (#142)
- chore(deps): update uselagoon/nginx-drupal docker tag to v23.10.0 @renovate (#140)
- chore(deps): update uselagoon/mariadb-drupal docker tag to v23.10.0 @renovate (#138)
- Updated scaffold files. @AlexSkrypnyk (#136)
Full Changelog: 2.0.0...2.0.1
@AlexSkrypnyk, @renovate and @renovate[bot]