Skip to content

3.12.0

Choose a tag to compare

@github-actions github-actions released this 09 Jul 06:30
· 55 commits to refs/heads/main since this release
67a7598

What's new since 3.11.1

Breaking changes

  • [#690] Reclassified trait-specific composer dependencies as optional. @AlexSkrypnyk (#691)
    Only php, behat/behat, and behat/mink remain hard requirements; drupal/drupal-extension, lullabot/mink-selenium2-driver, dmore/behat-chrome-extension, and softcreatr/jsonpath moved to require-dev and suggest, so projects that relied on transitive installation will lose them on upgrade. Add the packages you actually use to your own composer.json: drupal/drupal-extension for any DrevOps\BehatSteps\Drupal\* trait, softcreatr/jsonpath for JsonTrait, and one of the interchangeable drivers lullabot/mink-selenium2-driver or dmore/behat-chrome-extension for @javascript scenarios (both run the full suite). The full mapping is in MIGRATION.md.
  • [#677] Added shared entity registry with automatic scenario cleanup. @AlexSkrypnyk (#686)
    Entity-creating traits now register into one shared registry that a single hook deletes in reverse creation order, and as a result the per-trait cleanup skip tags are removed. Search your feature files and replace each old tag with its per-type equivalent - for example @behat-steps-skip:mediaAfterScenario becomes @behat-steps-entity-cleanup-skip:media and @behat-steps-skip:blockAfterScenario becomes @behat-steps-entity-cleanup-skip:block (full mapping in MIGRATION.md) - or use @behat-steps-skip:entityCleanupAfterScenario to skip all cleanup at once.

Highlights

  • [#205] Added selenium-less headless Chrome driver for JavaScript steps. @AlexSkrypnyk (#689)
    JavaScript-dependent steps no longer assume a Selenium2/WebDriver session: six traits now use capability checks instead of hard instanceof Selenium2Driver checks, so @javascript scenarios can drive headless Chrome directly over the Chrome DevTools Protocol via dmore/behat-chrome-extension with no Selenium server in the loop. You can drop the Selenium container from your test stack and still run the full JavaScript suite, and CI now runs both drivers to prove the steps behave identically.
  • [#675] Added SEO and head assertion steps to 'MetatagTrait'. @AlexSkrypnyk (#688)
    Beyond generic <meta> tag presence and content checks, the trait now asserts canonical URLs, indexability (reading both the robots meta tag and the X-Robots-Tag response header), individual robots directives, hreflang alternate validity and reciprocal return links, and Open Graph / Twitter Card tag sets. Common SEO and head checks that projects previously hand-rolled are now first-class steps.
  • [#676] Added 'ConfigTrait' for stored and effective Drupal config value steps. @AlexSkrypnyk (#687)
    New Gherkin steps set Drupal configuration and assert it two ways: STORED values read editable config (ignoring settings.php overrides, symmetric with the set steps) and EFFECTIVE values read through the config factory with module and settings.php overrides applied. Every config object a scenario touches is snapshotted on first write and reverted at teardown, so configuration changes never leak between scenarios.
  • [#671] Added 'DiagnosticsTrait' for automatic on-failure diagnostics. @AlexSkrypnyk (#683)
    This opt-in trait appends a compact diagnostics block - current URL, HTTP status, active Mink driver, captured JavaScript console errors, and a ready-to-paste re-run command - to the message of any failed step. A red CI run becomes self-explanatory without needing a reproduction re-run first, each field can be individually suppressed, and every value source degrades gracefully so the trait never turns a failure into a different failure.
  • [#669] Added 'CommandTrait' for shell command execution and assertions. @AlexSkrypnyk (#682)
    A new dependency-free generic trait runs a local shell command via proc_open() and asserts on its stdout, stderr, exit code, and duration, so any Behat suite - not only Drupal ones - can drive CLI tools from Gherkin. It drains both pipes concurrently to avoid a buffer deadlock and guards against a hung command with a configurable timeout that kills and reaps the process.
  • [#673] Added automatic Drupal BigPipe placeholder wait for JavaScript scenarios. @AlexSkrypnyk (#681)
    Including the new Drupal\BigPipeTrait makes every step on a @javascript scenario wait, best-effort, until BigPipe's streamed placeholders have been replaced before the step runs. This removes the flaky race where JavaScript assertions fire against placeholder markup before BigPipe finishes progressive rendering; the wait is opt-out via @behat-steps-skip:BigPipeTrait and never throws on timeout, so a genuinely stuck placeholder still surfaces as the real assertion failure.
  • [#668] Added 'JsonTrait' for JSON response path and schema assertions. @AlexSkrypnyk (#679)
    JSON API responses now get the same assertion surface XmlTrait gives XML bodies: valid-JSON checks, JSONPath value/type/existence/count assertions, and JSON Schema validation, with content sourced from the live page, a fixture file, or an inline PyString. Decoded JSON is cached per response body so repeated path queries do not re-decode, and schema validation is wired as an optional dependency so consumers who do not need it are not forced to install it.

Other changes

  • Split 'HelperTrait' into generic and Drupal-specific helper traits. @AlexSkrypnyk (#685)
    The generic DrevOps\BehatSteps\HelperTrait now holds only framework-agnostic helpers, while a new DrevOps\BehatSteps\Drupal\HelperTrait holds the Drupal-specific ones and includes the generic trait as a superset. Non-Drupal traits (Wait, Link, Field, Accessibility) no longer pull in Drupal classes through the helper, and Drupal consumers still get both sets from a single use; this is an internal refactor with no behaviour change.
  • [#672] Added index-based element interaction and count steps to 'ElementTrait'. @AlexSkrypnyk (#684)
    New steps click, follow a link, or press a button by 1-based index when a selector, link text, or label matches several repeated elements such as cards, rows, or menu items, plus a parent-scoped assertion for the exact count of descendants matching a selector. This fills the gap where interactions always resolved to the first match and MinkContext only offered a page-wide element count, and each new step throws a distinct, clear error for an index below 1, no matches, or an index beyond the number of matches.
  • [#670] Added XML schema and feed validation to 'XmlTrait'. @AlexSkrypnyk (#680)
    A response body can now be validated against a full XSD, DTD, or RelaxNG schema (inline via a PyString or loaded from a fixture file) and checked for structural validity as an RSS 2.0 or Atom feed, instead of only asserting on individual elements, attributes, or namespaces. All validation runs through native libxml/DOM APIs, so no new Composer dependency is introduced.

Full Changelog: 3.11.1...3.12.0