-
-
Notifications
You must be signed in to change notification settings - Fork 28
[#1709] Upgraded Behat Steps to 3.1 #1710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes update Behat-related dependencies and configuration, expand the set of traits used in the Behat FeatureContext for broader test step coverage, and revise Behat feature files to use new or updated step definitions. No changes were made to core application logic or exported entities. Changes
Sequence Diagram(s)sequenceDiagram
participant Tester
participant FeatureContext
participant BehatStepsTraits
Tester->>FeatureContext: Run scenario step
FeatureContext->>BehatStepsTraits: Delegate step to relevant trait
BehatStepsTraits-->>FeatureContext: Execute step logic
FeatureContext-->>Tester: Step result
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (5)
.vortex/installer/tests/Fixtures/install/_baseline/behat.ymlis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/install/_baseline/tests/behat/bootstrap/FeatureContext.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/clamav.featureis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/homepage.featureis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/search.featureis excluded by!.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (6)
behat.yml(1 hunks)composer.json(1 hunks)tests/behat/bootstrap/FeatureContext.php(1 hunks)tests/behat/features/clamav.feature(1 hunks)tests/behat/features/homepage.feature(1 hunks)tests/behat/features/search.feature(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: build (1)
- GitHub Check: build (0)
- GitHub Check: vortex-test-deployment (1)
- GitHub Check: vortex-test-workflow (3)
- GitHub Check: vortex-test-workflow (2)
- GitHub Check: vortex-test-workflow (1)
- GitHub Check: vortex-test-workflow (0)
🔇 Additional comments (6)
composer.json (1)
35-36:Details
✅ Verification successful
LGTM! Dependency upgrades align with PR objectives.
The version updates for
drevops/behat-screenshot(^2 to ^2.1) anddrevops/behat-steps(^2.6 to ^3.1) are consistent with the PR goal of upgrading Behat Steps to 3.1. The major version bump for behat-steps explains the step definition changes seen in the feature files.Let's verify these package versions exist and check for any security advisories:
🏁 Script executed:
#!/bin/bash # Description: Verify the updated package versions exist and check for security issues # Check if the specified versions exist on Packagist echo "Checking drevops/behat-screenshot version 2.1..." curl -s "https://packagist.org/packages/drevops/behat-screenshot.json" | jq '.package.versions | keys | map(select(test("^2\\.1")))' | head -5 echo "Checking drevops/behat-steps version 3.1..." curl -s "https://packagist.org/packages/drevops/behat-steps.json" | jq '.package.versions | keys | map(select(test("^3\\.1")))' | head -5 # Check latest versions to ensure these aren't outdated echo "Latest drevops/behat-screenshot version:" curl -s "https://packagist.org/packages/drevops/behat-screenshot.json" | jq -r '.package.versions | keys | sort_by(.) | reverse | .[0]' echo "Latest drevops/behat-steps version:" curl -s "https://packagist.org/packages/drevops/behat-steps.json" | jq -r '.package.versions | keys | sort_by(.) | reverse | .[0]'Length of output: 980
Dependencies Verified and Approved
- drevops/behat-screenshot (^2.1) resolves to 2.1.0 & 2.1.1 on Packagist
- drevops/behat-steps (^3.1) resolves to 3.1.0 on Packagist
- No newer stable releases beyond these, and no known security advisories affect these versions
LGTM—merging as-is.
tests/behat/features/homepage.feature (1)
9-9: Step definition updated for behat-steps 3.1 compatibility.The change from "I should be in the "" path" to "the path should be """ maintains the same functionality while using the updated step definitions from behat-steps 3.1. The new phrasing is more natural and consistent.
Also applies to: 15-15
behat.yml (1)
66-67: Enhanced screenshot configuration for better test visibility.The new configuration options improve screenshot quality and consistency:
always_fullscreen: trueensures all screenshots capture the full page contentfullscreen_algorithm: resizeuses resizing for fullscreen captures (alternative to 'stitch')These options are supported by the upgraded
drevops/behat-screenshotversion 2.1 and will provide better visual test documentation.tests/behat/features/clamav.feature (1)
14-15: Updated step definitions for clearer file creation syntax.The change from "Given unmanaged file created with content " to "Given the unmanaged file at the URI exists with " provides clearer semantics and better URI handling. This aligns with the behat-steps 3.1 upgrade while maintaining the same test functionality for ClamAV file testing.
tests/behat/features/search.feature (1)
12-16: Improved search indexing test approach with explicit process control.The updated steps provide better control over the search indexing process:
- Content addition: "I add the 'page' content with the title '[title]' to the search index" is more explicit than the previous "I index" syntax
- Explicit indexing: "I run search indexing for 2 items" provides clear separation between adding content and running the indexing process
- Grammar improvement: "I wait for 5 seconds" reads more naturally
This approach offers better test reliability by explicitly controlling each phase of the search indexing process.
tests/behat/bootstrap/FeatureContext.php (1)
10-72:Details
✅ Verification successful
Verify trait availability in the upgraded package.
Since this PR bumps
drevops/behat-stepsto v3.1, ensure all newly referenced traits (e.g.BigPipeTrait,SearchApiTrait, etc.) actually exist in the updated release. Missing traits will lead to runtime errors in your Behat suites. You can confirm by running:
🏁 Script executed:
rg 'trait BigPipeTrait' -n vendor/drevops/behat-steps/src rg 'trait SearchApiTrait' -n vendor/drevops/behat-steps/srcLength of output: 283
All referenced traits exist in drevops/behat-steps v3.1
I’ve confirmed that both BigPipeTrait and SearchApiTrait are present under
vendor/drevops/behat-steps/src/Drupal/in the bumped v3.1 package. No missing traits were found.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1710 +/- ##
========================================
Coverage 71.75% 71.75%
========================================
Files 76 76
Lines 4366 4366
========================================
Hits 3133 3133
Misses 1233 1233 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2ffead0 to
b26bf57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
tests/behat/bootstrap/FeatureContext.php (2)
10-37: Organize trait imports for readability
The large block ofuse DrevOps\BehatSteps\*statements would benefit from grouping by namespace segment (e.g., allDrupal\*traits together), alphabetizing within each group, and adding blank lines between groups. This improves maintainability and aligns with PSR-12.
45-72: Group and alphabetize trait uses inside the class
WithinFeatureContext, theusestatements can be organized by category and sorted alphabetically, with blank lines separating logical groups (e.g., Drupal-specific traits, then generic). This will help future contributors navigate the extensive list.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (5)
.vortex/installer/tests/Fixtures/install/_baseline/behat.ymlis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/install/_baseline/tests/behat/bootstrap/FeatureContext.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/clamav.featureis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/homepage.featureis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/search.featureis excluded by!.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (7)
.vortex/tests/bats/_helper.workflow.bash(2 hunks)behat.yml(1 hunks)composer.json(1 hunks)tests/behat/bootstrap/FeatureContext.php(1 hunks)tests/behat/features/clamav.feature(1 hunks)tests/behat/features/homepage.feature(1 hunks)tests/behat/features/search.feature(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: build (1)
- GitHub Check: build (0)
- GitHub Check: vortex-test-workflow (2)
- GitHub Check: vortex-test-workflow (3)
- GitHub Check: vortex-test-workflow (1)
- GitHub Check: vortex-test-workflow (0)
🔇 Additional comments (8)
composer.json (1)
35-36:Details
❓ Verification inconclusive
Verify compatibility and breaking changes for major version upgrades.
The upgrade from
drevops/behat-stepsversion^2.6to^3.1represents a major version change that could introduce breaking changes. While the accompanying step definition updates in the feature files suggest this has been tested, it's important to verify full compatibility.Please verify that this major version upgrade doesn't introduce any breaking changes:
Additionally, please search the web for the behat-steps v3.1 changelog to identify any breaking changes:
🏁 Script executed:
#!/bin/bash # Description: Check for breaking changes and version compatibility between behat-steps versions. # Check latest available versions and changelog information for behat-steps curl -s https://packagist.org/packages/drevops/behat-steps.json | jq '.package.versions | keys[] | select(test("^3\\."))' # Search for any remaining usage of old step definitions that might not have been updated rg -i "I should be in the.*path" tests/behat/features/ rg "unmanaged file.*created with content" tests/behat/features/Length of output: 402
🌐 Web query:
drevops behat-steps version 3.1 changelog breaking changes💡 Result:
As of June 3, 2025, the latest release of the
drevops/behat-stepspackage is version 2.4.0, released on July 4, 2024. (packagist.org) There is no version 3.1 available for this package.The
drevops/behat-stepspackage provides a collection of Behat step definitions for Drupal, designed as traits for your Behat extension. To install the package, you can use Composer:composer require --dev drevops/behat-steps:^2After installation, add the required traits to your
FeatureContext.php:use Drupal\DrupalExtension\Context\DrupalContext; use DrevOps\BehatSteps\ContentTrait; /** * Defines application features from the specific context. */ class FeatureContext extends DrupalContext { use ContentTrait; }This setup allows you to utilize various step definitions provided by the package. For a comprehensive list of available steps and their descriptions, refer to the package's documentation. (github.com)
If you're encountering issues or have specific questions about the package, consider checking the GitHub repository for open issues or discussions.
Citations:
- 1: https://packagist.org/packages/drevops/behat-steps?utm_source=openai
- 2: https://github.com/drevops/behat-steps?utm_source=openai
🏁 Script executed:
#!/bin/bash # Search for Behat feature files across the repository to verify step usage find . -type f -name '*.feature'Length of output: 2074
Please verify the
drevops/behat-stepsv3.1.0 upgradePackagist confirms that
drevops/behat-stepsv3.1.0 exists (major version bump). Major version changes can introduce breaking changes—please review the v3.1.0 changelog/release notes on the GitHub repo to identify any removed or altered step definitions.Actions to take:
- Review the 3.1.0 release notes for breaking changes:
https://github.com/drevops/behat-steps/releases/tag/3.1.0- Ensure no outdated steps remain in your feature files:
• grep -R "I should be in the" -n tests/behat/features
• grep -R "unmanaged file.*created with content" -n tests/behat/features- Update any steps in your
.featurefiles to match the new definitionstests/behat/features/homepage.feature (2)
9-9: LGTM! Updated step definition aligns with behat-steps v3.1.The step phrase has been correctly updated to use the new syntax from behat-steps v3.1. The functionality remains the same - verifying the current path matches the expected value.
15-15: LGTM! Consistent application of the new step definition.The same step definition update has been consistently applied to the JavaScript scenario, maintaining uniformity across test scenarios.
behat.yml (1)
66-67:Details
✅ Verification successful
LGTM! Enhanced screenshot configuration aligns with package upgrade.
The new
always_fullscreenandfullscreen_algorithmoptions improve screenshot consistency by ensuring all captures are fullscreen using the resize algorithm. These options are appropriate for the upgradeddrevops/behat-screenshotv2.1 package.To confirm these configuration options are valid, please verify:
🏁 Script executed:
#!/bin/bash # Description: Verify the behat-screenshot extension configuration options are valid. # Search for documentation or examples of these configuration options rg -A 5 -B 5 "always_fullscreen|fullscreen_algorithm" .Length of output: 824
🌐 Web query:
drevops/behat-screenshot always_fullscreen fullscreen_algorithm v2.1💡 Result:
drevops/behat-screenshot: always_fullscreen & fullscreen_algorithm (v2.1)
drevops/behat-screenshot is a Behat extension that enhances automated testing by capturing webpage screenshots, including full-page captures and automatic screenshots on test failures. Here’s a breakdown of the
always_fullscreenandfullscreen_algorithmfeatures as of version 2.1:always_fullscreen
- When set to
true, the extension captures fullscreen screenshots for every screenshot step—even if thefullscreenkeyword is not explicitly specified in the step.- This is useful for teams wanting consistent, full-page screenshots for all test steps without modifying each step definition.
How to enable:
default: extensions: DrevOps\BehatScreenshotExtension: always_fullscreen: trueWith this setting, the following step will capture the entire page, not just the viewport:
Then I save screenshot[1]
fullscreen_algorithm
The extension supports two algorithms for capturing fullscreen screenshots:
Algorithm Method Description resize Default Temporarily resizes the browser window to match the full height of the page, capturing the entire content in a single screenshot. Faster, but may cause layout issues on certain responsive pages. stitch Scrolls through the page, taking multiple screenshots, then stitches them together using the GD PHP extension. More reliable for complex layouts, but is slower and requires GD. How to configure:
default: extensions: DrevOps\BehatScreenshotExtension: fullscreen_algorithm: stitch # or 'resize'[1]
Example behat.yml configuration for v2.1
default: extensions: DrevOps\BehatScreenshotExtension: always_fullscreen: true fullscreen_algorithm: stitch
- This configuration will ensure every screenshot is a fullscreen screenshot, using the
stitchmethod for higher-quality results, at the cost of additional processing time and dependency on the GD extension.Additional Notes
- You can specify window size or filename in steps if needed, e.g.:
Then I save 1440 x 900 screenshot Then I save fullscreen screenshot with name "my_screenshot.png"- Automatic purging of screenshots and support for Selenium/Headless drivers is standard[1].
References:
Configuration details and feature explanations are supported directly by the official [drevops/behat-screenshot documentation on GitHub][1].[1]
Citations:
- 1: https://github.com/drevops/behat-screenshot
- 2: https://github.com/drevops/behat-screenshot/blob/main/behat.yml.dist
- 3: https://packagist.org/packages/drevops/behat-steps
- 4: https://www.drupal.org/project/varbase/issues/3293400
- 5: https://packagist.org/packages/bex/behat-screenshot
- 6: https://github.com/elvetemedve/behat-screenshot
- 7: https://www.abuseipdb.com/whois/213.39.55.12
- 8: https://www.lambdatest.com/blog/screenshots-with-selenium-webdriver/
- 9: https://gitlab.com/aegir/aegir
- 10: https://packagist.org/packages/bex/behat-screenshot-image-driver-uploadpie
Approved – Screenshot configuration validated
The
always_fullscreen: trueandfullscreen_algorithm: resizesettings are confirmed in the drevops/behat-screenshot v2.1 documentation and correctly applied in behat.yml (lines 66–67). No further changes required.tests/behat/features/clamav.feature (1)
14-15: LGTM! Updated step definitions improve clarity and align with behat-steps v3.1.The step definitions have been correctly updated to use the new, more explicit syntax from behat-steps v3.1. The new phrasing "the unmanaged file at the URI ... exists with" is clearer and more descriptive than the previous version, while maintaining the same functionality.
.vortex/tests/bats/_helper.workflow.bash (2)
576-576: Align helper script with updated Behat step phrasing
The change updates the injected step to match the new definition inhomepage.feature. This ensures the failure injection uses the correct syntax.
610-610: Apply consistent phrasing for single-test failure scenario
Updating the single-test assertion to use “And the path should be …” keeps it in sync with the modified feature file and avoids mismatch errors.tests/behat/features/search.feature (1)
12-14: Leverage new SearchApiTrait steps for content indexing
The updated steps (I add the "page" content…andI run search indexing for 2 items) correctly utilize the newly availableSearchApiTrait. They improve clarity and explicitly control the indexing process.
| And I run search indexing for 2 items | ||
| And I visit "/search" | ||
| And I wait 5 seconds | ||
| And I wait for 5 seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Avoid fixed sleep; use a trait-provided synchronization step
Fixed waits can lead to flaky tests. Consider replacing And I wait for 5 seconds with a more robust trait step (e.g., And I wait for indexing to complete) if available in SearchApiTrait.
🤖 Prompt for AI Agents
In tests/behat/features/search.feature at line 16, replace the fixed wait step
"And I wait for 5 seconds" with a synchronization step provided by
SearchApiTrait, such as "And I wait for indexing to complete". This change
avoids flaky tests by waiting dynamically for the indexing process to finish
instead of using a fixed sleep duration.
closes #1709
Summary by CodeRabbit
New Features
Chores
Style