Skip to content

Conversation

@AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Jun 3, 2025

closes #1709

Summary by CodeRabbit

  • New Features

    • Expanded test capabilities by adding a wide range of new traits to the testing context, enabling more comprehensive and modular test scenarios.
  • Chores

    • Updated development dependencies to newer versions for improved compatibility and features.
    • Enhanced screenshot configuration to always capture fullscreen images using a specific resizing algorithm.
  • Style

    • Standardized and clarified the wording of test steps across multiple feature files for consistency and readability.

@coderabbitai
Copy link

coderabbitai bot commented Jun 3, 2025

Walkthrough

The 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

File(s) Change Summary
behat.yml Added always_fullscreen and fullscreen_algorithm options to screenshot extension configuration.
composer.json Updated dev dependencies: drevops/behat-screenshot to ^2.1, drevops/behat-steps to ^3.1.
tests/behat/bootstrap/FeatureContext.php Added multiple traits from DrevOps\BehatSteps and DrevOps\BehatSteps\Drupal to FeatureContext.
tests/behat/features/clamav.feature Reworded steps for unmanaged file creation in Background section.
tests/behat/features/homepage.feature Reworded steps for verifying homepage path in two scenarios.
tests/behat/features/search.feature Updated steps for adding content to search index, added explicit indexing step, minor rewording of wait step.
.vortex/tests/bats/_helper.workflow.bash Updated assertion step phrase for Behat test failure in two places.

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
Loading

Assessment against linked issues

Objective Addressed Explanation
Upgrade to Behat Steps 3 (#1709)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Addition of always_fullscreen and fullscreen_algorithm in behat.yml These configuration changes are not directly required by the upgrade to Behat Steps 3.
Rewording of steps in feature files (clamav.feature, homepage.feature, search.feature) The rewording of steps, while possibly related to new step definitions, is not strictly required for the upgrade.

Poem

In the warren where Behat hops anew,
Traits abound—now more than a few!
Steps reworded, configs shine bright,
Upgraded dependencies, testing’s delight.
With every hop, our coverage grows—
A rabbit’s dream, as every coder knows!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot temporarily deployed to commit June 3, 2025 01:13 Inactive
Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 682a9d4 and 2ffead0.

⛔ Files ignored due to path filters (5)
  • .vortex/installer/tests/Fixtures/install/_baseline/behat.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/_baseline/tests/behat/bootstrap/FeatureContext.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/clamav.feature is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/homepage.feature is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/search.feature is 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) and drevops/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: true ensures all screenshots capture the full page content
  • fullscreen_algorithm: resize uses resizing for fullscreen captures (alternative to 'stitch')

These options are supported by the upgraded drevops/behat-screenshot version 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:

  1. Content addition: "I add the 'page' content with the title '[title]' to the search index" is more explicit than the previous "I index" syntax
  2. Explicit indexing: "I run search indexing for 2 items" provides clear separation between adding content and running the indexing process
  3. 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-steps to 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/src

Length 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
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.75%. Comparing base (682a9d4) to head (b26bf57).
Report is 2 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/upgrade-behat-steps branch from 2ffead0 to b26bf57 Compare June 3, 2025 01:25
@github-actions github-actions bot temporarily deployed to commit June 3, 2025 01:27 Inactive
Copy link

@coderabbitai coderabbitai bot left a 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 of use DrevOps\BehatSteps\* statements would benefit from grouping by namespace segment (e.g., all Drupal\* 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
Within FeatureContext, the use statements 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2ffead0 and b26bf57.

⛔ Files ignored due to path filters (5)
  • .vortex/installer/tests/Fixtures/install/_baseline/behat.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/_baseline/tests/behat/bootstrap/FeatureContext.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/clamav.feature is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/homepage.feature is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/_baseline/tests/behat/features/search.feature is 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-steps version ^2.6 to ^3.1 represents 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-steps package 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-steps package 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:^2

After 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:


🏁 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-steps v3.1.0 upgrade

Packagist confirms that drevops/behat-steps v3.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 .feature files to match the new definitions
tests/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_fullscreen and fullscreen_algorithm options improve screenshot consistency by ensuring all captures are fullscreen using the resize algorithm. These options are appropriate for the upgraded drevops/behat-screenshot v2.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_fullscreen and fullscreen_algorithm features as of version 2.1:

always_fullscreen

  • When set to true, the extension captures fullscreen screenshots for every screenshot step—even if the fullscreen keyword 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: true

With 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 stitch method 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:


Approved – Screenshot configuration validated

The always_fullscreen: true and fullscreen_algorithm: resize settings 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 in homepage.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… and I run search indexing for 2 items) correctly utilize the newly available SearchApiTrait. 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
Copy link

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.

@AlexSkrypnyk AlexSkrypnyk merged commit 36e8323 into develop Jun 3, 2025
30 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/upgrade-behat-steps branch June 3, 2025 01:46
@github-project-automation github-project-automation bot moved this from BACKLOG to Release queue in Vortex Jun 3, 2025
@AlexSkrypnyk AlexSkrypnyk moved this from Release queue to Released in 25.6.0 in Vortex Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Upgrade to Behat Steps 3

2 participants