Skip to content

v6.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 22 Jun 05:40
773601d

What's new since v6.0.0

Breaking changes

  • [#874] Removed the 'field_parser: legacy' parser. @AlexSkrypnyk (#880)
    The field_parser configuration node and its legacy value (which opted back into the pre-6.0 inline field syntax) are gone, so EntityFieldParser is now always active and accepts no configuration. Any field_parser key left in behat.yml now triggers a hard configuration error on load. To migrate, delete the field_parser entry from your Drupal\DrupalExtension config and convert any feature files still written in the legacy field syntax to the current syntax (see the field-syntax mapping table in UPGRADING.md).
  • [#876] Removed the 'region_map' configuration key. @AlexSkrypnyk (#879)
    The region_map key, superseded by the identically structured regions key in 6.0.0, has been removed, and a behat.yml that still uses it now fails to load with an "Unrecognized option" error. To migrate, rename region_map: to regions: in your Drupal\DrupalExtension configuration; the nested structure is unchanged, so only the key name needs updating.
  • [#875] Removed flat message selector keys. @AlexSkrypnyk (#878)
    The four flat keys under selectors: - message_selector, error_message_selector, success_message_selector, and warning_message_selector - are no longer accepted, and the nested selectors.messages: map (keyed default, error, success, warning) is now the only supported form. A missing selector now raises a RuntimeException naming the exact path to configure, e.g. Drupal\DrupalExtension.selectors.messages.error. To migrate, move each flat key into the nested map under its corresponding type.
  • [#873] Removed the legacy '<?name>' random token syntax. @AlexSkrypnyk (#877)
    The <?name> random-token form has been removed, leaving the typed [?name:type,args] syntax as the only one RandomContext understands. As a side effect RandomContext no longer implements ParametersAwareInterface or DeprecationInterface, so subclasses that relied on those members are affected. To migrate, replace every <?name> token in your feature files with the [?name] / [?name:type,args] form documented in docs/writing-tests.md.

Highlights

  • [#597] Added HTTP Basic authentication support for sites behind webserver-level basic auth. @AlexSkrypnyk (#870)
    You can now test Drupal sites sitting behind Apache/Nginx HTTP Basic auth, which previously failed because fastLogout() reset the session and discarded the Authorization header, returning a 401 before the login form ever loaded. Credentials are read from a new basic_auth: {username, password} config node (or the base_url userinfo) and re-applied automatically after every session reset, so the whole login flow stays authenticated.
  • [#536] Added best-practice docs and a tested example for module-shipped Behat contexts. @AlexSkrypnyk (#869)
    A new "Shipping contexts in a module" guide documents where to place context classes, how to namespace them (Drupal\Tests\{module}\Behat\Context\), and how to wire PSR-4 autoloading for standalone Behat runs - filling the gap left when sub-context auto-discovery was removed. It is backed by a working ExampleContext in the behat_test fixture module that CI exercises under --strict, so the recommended pattern is proven rather than theoretical.
  • [#813] Added '@AfterScenario' cleanup of files attached through the UI. @AlexSkrypnyk (#868)
    Files uploaded via the I attach the file step are now tracked and their managed-file entities deleted after each scenario, so re-uploading the same filename is no longer silently renamed by Drupal (e.g. image.png becomes image_0.png) and breaking path-based assertions. Tag a scenario or feature with @no-file-cleanup to opt out; the hook is a no-op on blackbox and other non-in-process drivers.
  • [#672] Added email attachment assertion steps to 'MailContext'. @AlexSkrypnyk (#867)
    Four new Then steps let you assert that a sent email carries specific attachment(s), optionally filtered by recipient and/or subject, and the When I send the following (e)mail: step gains an attachments table column so tests can send mails with attachments in the first place. This makes it possible to verify attachment delivery end to end without writing custom step code.
  • [#734] Added steps to run a failing drush command and assert its output. @AlexSkrypnyk (#866)
    New I run the failing drush command steps run a Drush command expected to exit non-zero and capture its output so the existing the drush output should contain/match steps can assert on it, failing the step if the command unexpectedly succeeds. This closes the gap where a non-zero exit previously aborted the scenario before you could inspect the error output.
  • [#115] Added 'MappingContext' resolving '{{ Key }}' tokens from 'mappings' config. @AlexSkrypnyk (#865)
    A new MappingContext replaces {{ Key }} tokens in any step argument or table cell with values defined under a new mappings key in behat.yml, letting you centralise shared test data (URLs, labels, IDs) in one place instead of repeating literals across feature files. Keys must be globally unique - duplicates are rejected at config load - and an unknown key fails the step immediately rather than passing through unresolved.

All changes

  • [#874] Removed the 'field_parser: legacy' parser. @AlexSkrypnyk (#880)
    Deletes the field_parser config node, the legacy value, and the backing LegacyEntityFieldParser class, leaving EntityFieldParser as the sole parser with no configuration. Any field_parser key in behat.yml now produces a hard configuration error on load.
  • [#876] Removed the 'region_map' configuration key. @AlexSkrypnyk (#879)
    Drops the region_map key from the config schema in favour of the identically structured regions key, so a stale region_map now fails to load with an "Unrecognized option" error. Rename the key to regions to upgrade.
  • [#875] Removed flat message selector keys. @AlexSkrypnyk (#878)
    Removes the flat message_selector, error_message_selector, success_message_selector, and warning_message_selector keys, so selectors must now live under the nested selectors.messages: map. An unconfigured selector throws a RuntimeException that names the exact nested path to add.
  • [#873] Removed the legacy '<?name>' random token syntax. @AlexSkrypnyk (#877)
    Removes the <?name> token form and the legacy parsing path from RandomContext, leaving the typed [?name:type,args] syntax as the only supported form. As a result RandomContext no longer implements ParametersAwareInterface or DeprecationInterface, and the per-run [Deprecation] notices it printed are gone.
  • Switched back to stable DrupalDriver. @AlexSkrypnyk (#872)
    Restores the drupal/drupal-driver requirement to a stable version range, replacing the temporary dev-master pin used while driver-side APIs needed by recent features were still unreleased. Consumers get a stable, tagged driver constraint again.
  • Updated information about maintainers. @AlexSkrypnyk (#871)
    Refreshes the project's maintainer information. A documentation-only change with no effect on the extension's behaviour.
  • [#597] Added HTTP Basic authentication support for sites behind webserver-level basic auth. @AlexSkrypnyk (#870)
    Adds first-class HTTP Basic auth: credentials from a new basic_auth config node (or the base_url userinfo) are applied to the Mink session and re-applied automatically after each reset, so logging into a site behind Apache/Nginx basic auth no longer fails with a 401. JavaScript/Selenium drivers, which cannot set request headers, fall back to the base_url userinfo and degrade to a silent no-op where unsupported.
  • [#536] Added best-practice docs and a tested example for module-shipped Behat contexts. @AlexSkrypnyk (#869)
    Adds a "Shipping contexts in a module" guide covering directory layout, namespacing, and PSR-4 autoloading for standalone Behat runs, plus a working ExampleContext and helper trait in the behat_test fixture module that CI exercises under --strict. This documents the recommended replacement for the removed sub-context auto-discovery.
  • [#813] Added '@AfterScenario' cleanup of files attached through the UI. @AlexSkrypnyk (#868)
    Tracks files uploaded via the I attach the file step and deletes their managed-file entities after each scenario, preventing Drupal from renaming a re-uploaded file (e.g. image.png to image_0.png) and breaking path-based assertions. Opt out per scenario or feature with @no-file-cleanup; the hook is a no-op on blackbox and other non-in-process drivers.
  • [#672] Added email attachment assertion steps to 'MailContext'. @AlexSkrypnyk (#867)
    Adds four Then steps that assert a sent email carries specific attachment(s), with optional recipient and subject filters, and extends When I send the following (e)mail: with an attachments table column so such mails can be sent in tests. Lets you verify attachment delivery without writing custom step definitions.
  • [#734] Added steps to run a failing drush command and assert its output. @AlexSkrypnyk (#866)
    Adds I run the failing drush command steps that execute a Drush command expected to exit non-zero, capture its output for the existing the drush output should contain/match assertions, and fail if the command unexpectedly exits 0. Previously a non-zero exit aborted the scenario before its error output could be checked.
  • [#115] Added 'MappingContext' resolving '{{ Key }}' tokens from 'mappings' config. @AlexSkrypnyk (#865)
    Adds a driver-free MappingContext that substitutes {{ Key }} tokens in step arguments and table cells with values defined under a new mappings key in behat.yml. Keys must be globally unique (duplicates are rejected at config load) and an unknown key fails the step rather than passing through unresolved.
  • [#860] Added a test for 'color_field' field support. @AlexSkrypnyk (#863)
    Adds end-to-end coverage for the contrib color_field module's color_field_type, driving a Gherkin table cell through the entity-field parser, the driver's ColorFieldTypeHandler (from drupal/drupal-driver v3.1.0), Drupal storage, and rendered output. It exercises both the bare-hex shorthand and the color/opacity form, covering the extension-level path a user actually drives.
  • [#861] Documented bracketed test markers as a compound-mode trigger in 'UPGRADING.md'. @AlexSkrypnyk (#862)
    Documents a non-obvious upgrade footgun: in the modern parser a compound column value beginning with [ (such as a [TEST] or [DEV] marker) is read as the start of a [name:value] token and causes a parse error. The new guidance shows that wrapping the value in double quotes makes the bracket literal, and explains why an unrelated column can tip a whole cell into compound mode.
  • Fixed PHPStan always-true comparison errors in docs generator and field parser. @AlexSkrypnyk (#864)
    Resolves three PHPStan always-true comparison errors that were failing ahoy lint, by dropping a provably-redundant condition in scripts/docs.php and reading the stop character in EntityFieldParser::parseScalarList() via substr() instead of offset indexing. Both changes are behavior-preserving, with no PHPStan config, baseline, or ignore annotations added.

Full Changelog: v6.0.0...v6.1.0