3.12.0
·
55 commits
to refs/heads/main
since this release
What's new since 3.11.1
Breaking changes
- [#690] Reclassified trait-specific composer dependencies as optional. @AlexSkrypnyk (#691)
Onlyphp,behat/behat, andbehat/minkremain hard requirements;drupal/drupal-extension,lullabot/mink-selenium2-driver,dmore/behat-chrome-extension, andsoftcreatr/jsonpathmoved torequire-devandsuggest, so projects that relied on transitive installation will lose them on upgrade. Add the packages you actually use to your owncomposer.json:drupal/drupal-extensionfor anyDrevOps\BehatSteps\Drupal\*trait,softcreatr/jsonpathforJsonTrait, and one of the interchangeable driverslullabot/mink-selenium2-driverordmore/behat-chrome-extensionfor@javascriptscenarios (both run the full suite). The full mapping is inMIGRATION.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:mediaAfterScenariobecomes@behat-steps-entity-cleanup-skip:mediaand@behat-steps-skip:blockAfterScenariobecomes@behat-steps-entity-cleanup-skip:block(full mapping inMIGRATION.md) - or use@behat-steps-skip:entityCleanupAfterScenarioto 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 hardinstanceof Selenium2Driverchecks, so@javascriptscenarios can drive headless Chrome directly over the Chrome DevTools Protocol viadmore/behat-chrome-extensionwith 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 theX-Robots-Tagresponse 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 (ignoringsettings.phpoverrides, symmetric with the set steps) and EFFECTIVE values read through the config factory with module andsettings.phpoverrides 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 viaproc_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 newDrupal\BigPipeTraitmakes every step on a@javascriptscenario 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:BigPipeTraitand 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 surfaceXmlTraitgives 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 genericDrevOps\BehatSteps\HelperTraitnow holds only framework-agnostic helpers, while a newDrevOps\BehatSteps\Drupal\HelperTraitholds 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 singleuse; 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