Web steps
28 traits for pages, forms, links, cookies, JSON, XML and REST APIs, on any website.
For any website and every Drupal site
Behat Steps is a library of 449 tested steps for pages, forms, APIs and Drupal sites. Write readable scenarios on day one, and build steps of your own on the same helpers when you need them.
Feature: Drafts Scenario: Editor previews a draft Given the following "page" content exists: | title | status | | About us | 0 | And I am logged in as a user with the role "editor" When I visit the "page" content page with the title "About us" Then I should see the heading "About us" And the "page" content with the title "About us" should not be published1 scenario (1 passed)5 steps (5 passed)
Install with Composer
composer require --dev drevops/behat-steps:^4 Needs PHP 8.3 or newer. Composer installs Behat and Mink with it.
Works with
What you get
Every step comes with an example, and every helper with its signature and a summary, in references generated from the code.
28 traits for pages, forms, links, cookies, JSON, XML and REST APIs, on any website.
29 traits for content, users, media, menus, email, queues, caches and config.
Each step is a thin wrapper over a named helper, so a step of your own reuses the same code.
A step names the capability it needs, so clearing caches runs in-process or through Drush.
BrowserKit for plain HTTP, and Selenium or Chrome DevTools for @javascript scenarios.
The entities a scenario creates are deleted after it, in reverse creation order.
STEPS.md and HELPERS.md ship with the package, so a coding agent reads them from vendor/.
MIGRATION.md lists every changed name, and an AI agent skill can apply it to your project.
How it fits together
Each line of a scenario goes through the same 3 layers, so a step you write yourself can call the same helpers as the shipped ones.
Your feature file, in Gherkin, written with the step text the library ships.
A step trait on your context matches the line and passes its arguments to a helper.
A named method does the work, and your own steps can call it too.
The browser session, or the first backend in your list that can do the job, such as Drupal or Drush.
Built to be trusted
Every step runs in the library's own suite on a real Drupal site, and the suite tests the failures as well as the passes.
Every step follows the same wording rules, so the next trait you pick up reads like the last one.
Every method starts with the name of its trait, such as cookieGetAll(), so none collides with a method of your context.
Get going
Add it to your project's dev dependencies. A few steps need 1 more package, which Installation lists.
composer require --dev drevops/behat-steps:^4 Add WebContext, or DrupalContext for a Drupal site, and the extension to your behat.php. See the whole file.
Write a scenario with the shipped steps, then run Behat.
vendor/bin/behat Keep exploring
Free and open source, and tested on every change against Drupal 11 and 12 on Behat 3.33+ and 4.
composer require --dev drevops/behat-steps:^4