Skip to content

[UPMERGE] 2.0 -> 2.1#17736

Merged
mpysiak merged 29 commits into2.1from
upmerge/2.0_2.1
Mar 26, 2025
Merged

[UPMERGE] 2.0 -> 2.1#17736
mpysiak merged 29 commits into2.1from
upmerge/2.0_2.1

Conversation

@SyliusBot
Copy link
Copy Markdown
Contributor

@SyliusBot SyliusBot commented Mar 12, 2025

This PR has been generated automatically.
For more details see upmerge_pr.yaml.

Remember! The upmerge should always be merged with using Merge pull request button.

In case of conflicts, please resolve them manually with usign the following commands:

git fetch upstream
gh pr checkout <this-pr-number>
git merge upstream/2.1 -m "Resolve conflicts between 2.0 and 2.1"

If you use other name for the upstream remote, please replace upstream with the name of your remote pointing to the Sylius/Sylius repository.

Once the conflicts are resolved, please run git merge --continue and push the changes to this PR.

Summary by CodeRabbit

  • Documentation

    • Corrected the configuration reference in the customization guide for API settings.
  • Refactor

    • Enhanced the flexibility of multiple administration and storefront components by integrating improved hook support, enabling more dynamic customization.
  • Style

    • Adjusted layout classes and standardized template hooks to optimize responsive behavior and consistency across navigation, checkout, and product review views.
  • New Features

    • Introduced a new DriverHelper method to wait for page loads, enhancing reliability in page interactions.
    • Added custom attributes to cart elements for improved testing and manipulation capabilities.
    • Enhanced the getElement method in SymfonyPage to wait for page loads before retrieving elements.
  • Chores

    • Updated import statements across various classes to reflect the new namespace for SymfonyPage.
    • Added conflict declarations in composer.json files for compatibility management.

loic425 and others added 12 commits February 11, 2025 10:53
This PR has been generated automatically.
For more details see
[upmerge_pr.yaml](/Sylius/Sylius/blob/1.13/.github/workflows/upmerge_pr.yaml).

**Remember!** The upmerge should always be merged with using `Merge pull
request` button.

In case of conflicts, please resolve them manually with usign the
following commands:
```
git fetch upstream
gh pr checkout <this-pr-number>
git merge upstream/2.0-docs -m "Resolve conflicts between 2.0 and 2.0-docs"
```

If you use other name for the upstream remote, please replace `upstream`
with the name of your remote pointing to the `Sylius/Sylius` repository.

Once the conflicts are resolved, please run `git merge --continue` and
push the changes to this PR.
This PR has been generated automatically.
For more details see
[upmerge_pr.yaml](/Sylius/Sylius/blob/1.13/.github/workflows/upmerge_pr.yaml).

**Remember!** The upmerge should always be merged with using `Merge pull
request` button.

In case of conflicts, please resolve them manually with usign the
following commands:
```
git fetch upstream
gh pr checkout <this-pr-number>
git merge upstream/2.0-docs -m "Resolve conflicts between 2.0 and 2.0-docs"
```

If you use other name for the upstream remote, please replace `upstream`
with the name of your remote pointing to the `Sylius/Sylius` repository.

Once the conflicts are resolved, please run `git merge --continue` and
push the changes to this PR.
This PR has been generated automatically.
For more details see
[upmerge_pr.yaml](/Sylius/Sylius/blob/1.13/.github/workflows/upmerge_pr.yaml).

**Remember!** The upmerge should always be merged with using `Merge pull
request` button.

In case of conflicts, please resolve them manually with usign the
following commands:
```
git fetch upstream
gh pr checkout <this-pr-number>
git merge upstream/2.0-docs -m "Resolve conflicts between 2.0 and 2.0-docs"
```

If you use other name for the upstream remote, please replace `upstream`
with the name of your remote pointing to the `Sylius/Sylius` repository.

Once the conflicts are resolved, please run `git merge --continue` and
push the changes to this PR.
| Q               | A
|-----------------|-----
| Branch?         | 2.0
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | n/a
| License         | MIT
@SyliusBot SyliusBot requested review from a team as code owners March 12, 2025 02:28
@probot-autolabeler probot-autolabeler bot added Admin AdminBundle related issues and PRs. Documentation Documentation related issues and PRs - requests, fixes, proposals. Maintenance CI configurations, READMEs, releases, etc. Shop ShopBundle related issues and PRs. labels Mar 12, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2025

Walkthrough

This pull request updates the configuration documentation and augments many component classes by adding hook-related traits. In the documentation, the configuration file path is corrected. In both AdminBundle and ShopBundle components, the HookableComponentTrait (or similar variants) has been added to enable hook functionalities, with some ShopBundle components also having their readonly modifier removed. Additionally, several Twig templates were modified to simplify hook identifiers and adjust CSS classes.

Changes

File(s) Change Summary
docs/the-customization-guide/customizing-api.md Updated configuration example comment from # config/sylius_api.yaml to # config/packages/sylius_api.yaml.
src/Sylius/Bundle/AdminBundle/Twig/Component/{Dashboard/NewCustomersComponent.php, Order/AddressHistoryComponent.php, Product/Form/ProductTaxonsComponent.php, Shared/Navbar/{NotificationsComponent.php, ShopPreviewComponent.php, UserDropdownComponent.php}, Shared/RenderEntityWithTemplateComponent.php} Added HookableComponentTrait to integrate hook functionality in admin component classes.
src/Sylius/Bundle/AdminBundle/Twig/Component/Product/ProductAttributeAutocompleteComponent.php Added HookableLiveComponentTrait and reorganized trait inclusions (with ComponentToolsTrait, DefaultActionTrait, and TemplatePropTrait).
src/Sylius/Bundle/ShopBundle/Twig/Component/Common/{CurrencySwitcherComponent.php, LocaleSwitcherComponent.php, TaxonMenuComponent.php} and src/Sylius/Bundle/ShopBundle/Twig/Component/Product/BreadcrumbComponent.php Removed the readonly modifier and added HookableComponentTrait to allow for mutable classes with enhanced hook functionality.
src/Sylius/Bundle/ShopBundle/Twig/Component/Product/{AssociationComponent.php, BySlugComponent.php, CardComponent.php} and src/Sylius/Bundle/ShopBundle/Twig/Component/ProductReview/{CountComponent.php, ListComponent.php} Integrated HookableComponentTrait without altering existing logic.
src/Sylius/Bundle/ShopBundle/templates/{checkout/common/layout.html.twig, product/index/content/body/main/header.html.twig, shared/layout/base/header/navbar/menu.html.twig, shared/product_review/list.html.twig} Updated CSS classes and simplified hook identifiers; modified hook contexts and variables in Twig templates.

Suggested reviewers

  • GSadee
  • mpysiak

Poem

A hop in our code, a skip in the flow,
Traits join the dance, making hooks glow,
From docs to templates, updates so neat,
Every component now plays a new beat,
With paws on keys, I cheer this code show! 🐇✨


🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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
Copy link
Copy Markdown

github-actions bot commented Mar 12, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

mpysiak and others added 2 commits March 12, 2025 06:25
| Q               | A
|-----------------|-----
| Branch?         |2.0 
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | 
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->

Extracted from #17635 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Enhanced query handling and expression management across various
components, including cart management, product filtering, and review
processing.
- Improved method chaining and parameter handling in query builders for
better flexibility in data retrieval.
- Transitioned from specific repository implementations to more generic
interfaces, enhancing flexibility.

- **Chore**
- Updated import statements and namespace structures for better
alignment with the latest library versions, ensuring compatibility and
maintainability.
- Adjusted method signatures to improve type safety and clarity in the
codebase.

These updates contribute to a more efficient and reliable user
experience throughout the shopping and order processes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Mar 13, 2025
bartek-sek and others added 7 commits March 18, 2025 11:32
| Q               | A
|-----------------|-----
| Branch?         | 1.14
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | n/a
| License         | MIT
| Q               | A
|-----------------|-----
| Branch?         | 2.0 <!-- see the comment below -->
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes failing CI on 2.x
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->
Wojdylak and others added 7 commits March 25, 2025 08:10
This PR has been generated automatically.
For more details see
[upmerge_pr.yaml](/Sylius/Sylius/blob/1.13/.github/workflows/upmerge_pr.yaml).

**Remember!** The upmerge should always be merged with using `Merge pull
request` button.

In case of conflicts, please resolve them manually with usign the
following commands:
```
git fetch upstream
gh pr checkout <this-pr-number>
git merge upstream/2.0 -m "Resolve conflicts between 1.14 and 2.0"
```

If you use other name for the upstream remote, please replace `upstream`
with the name of your remote pointing to the `Sylius/Sylius` repository.

Once the conflicts are resolved, please run `git merge --continue` and
push the changes to this PR.
| Q               | A
|-----------------|-----
| Branch?         | 2.0
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | failing CI
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->
Copy link
Copy Markdown

@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

🧹 Nitpick comments (3)
src/Sylius/Bundle/ApiBundle/composer.json (1)

50-52: Conflict Declaration Update

The newly added "conflict" section correctly prevents installation of "api-platform/jsonld": "^4.1.1". This ensures that incompatible versions will not be inadvertently introduced. For maintainability, consider referencing the details documented in CONFLICTS.md so that developers have a clear cross-reference for the rationale behind this constraint.

src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (2)

54-55: Consider adding a comment explaining the repository instantiation approach

Direct instantiation of the repository represents a significant change from dependency injection. While this works fine, a brief comment explaining why this approach was chosen would help future maintainers understand the rationale behind this architectural change.


78-86: Comprehensive query builder setup

The query builder setup is thorough and well-structured. The use of Argument::cetera() for select and from method arguments provides flexibility for future changes.

However, the hard-coded parameter value on line 82 ('%"1739bc61-9e42-4c80-8b9a-f97f0579cccb"%') could be extracted to a variable for improved readability and maintainability.

- $queryBuilder->setParameter('key', '%"1739bc61-9e42-4c80-8b9a-f97f0579cccb"%')->shouldBeCalled()->willReturn($queryBuilder);
+ $removedChoiceKey = '1739bc61-9e42-4c80-8b9a-f97f0579cccb';
+ $queryBuilder->setParameter('key', '%"' . $removedChoiceKey . '"%')->shouldBeCalled()->willReturn($queryBuilder);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a1b903 and 2187232.

📒 Files selected for processing (66)
  • .github/workflows/ci_e2e-mysql.yaml (0 hunks)
  • CONFLICTS.md (1 hunks)
  • behat.yml.dist (1 hunks)
  • composer.json (1 hunks)
  • features/hybrid/checkout/placing_order_on_multi_channel/placing_an_order_on_a_single_channel_store.feature (1 hunks)
  • features/hybrid/checkout/placing_order_on_multi_channel/placing_an_order_on_multiple_channels_with_same_currency.feature (2 hunks)
  • features/shop/checkout/receiving_confirmation_email_after_completing_checkout.feature (1 hunks)
  • src/Sylius/Behat/Element/Admin/Taxon/FormElement.php (1 hunks)
  • src/Sylius/Behat/Element/Admin/Taxon/TreeElement.php (2 hunks)
  • src/Sylius/Behat/Element/Shop/Account/RegisterElement.php (1 hunks)
  • src/Sylius/Behat/Element/Shop/CartWidgetElement.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Account/LoginPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Account/RequestPasswordResetPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Account/ResetPasswordPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Administrator/ImpersonateUserPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/CatalogPromotion/ShowPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Crud/CreatePage.php (2 hunks)
  • src/Sylius/Behat/Page/Admin/Crud/IndexPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Crud/UpdatePage.php (2 hunks)
  • src/Sylius/Behat/Page/Admin/Customer/ShowPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/DashboardPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Order/HistoryPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Order/ShowPage.php (2 hunks)
  • src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/ShowPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Product/ShowPage.php (1 hunks)
  • src/Sylius/Behat/Page/Admin/Shipment/ShowPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/AddressBook/CreatePage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/AddressBook/IndexPage.php (2 hunks)
  • src/Sylius/Behat/Page/Shop/Account/AddressBook/UpdatePage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/ChangePasswordPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/DashboardPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/LoginPage.php (2 hunks)
  • src/Sylius/Behat/Page/Shop/Account/Order/IndexPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/Order/ShowPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/ProfileUpdatePage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/RegisterPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/RegisterThankYouPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/RequestPasswordResetPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/ResetPasswordPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/VerificationPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Account/WellKnownPasswordChangePage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Checkout/AddressPage.php (2 hunks)
  • src/Sylius/Behat/Page/Shop/Checkout/CompletePage.php (2 hunks)
  • src/Sylius/Behat/Page/Shop/Checkout/SelectPaymentPage.php (3 hunks)
  • src/Sylius/Behat/Page/Shop/Checkout/SelectShippingPage.php (3 hunks)
  • src/Sylius/Behat/Page/Shop/HomePage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Order/ShowPage.php (4 hunks)
  • src/Sylius/Behat/Page/Shop/Order/ThankYouPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Page.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/PaymentRequest/PaymentRequestNotifyPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Product/IndexPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/Product/ShowPage.php (1 hunks)
  • src/Sylius/Behat/Page/Shop/ProductReview/CreatePage.php (2 hunks)
  • src/Sylius/Behat/Page/Shop/ProductReview/IndexPage.php (1 hunks)
  • src/Sylius/Behat/Page/SymfonyPage.php (1 hunks)
  • src/Sylius/Behat/Page/SymfonyPageInterface.php (1 hunks)
  • src/Sylius/Behat/Page/TestPlugin/MainPage.php (1 hunks)
  • src/Sylius/Behat/Resources/config/services/pages.xml (1 hunks)
  • src/Sylius/Behat/Service/DriverHelper.php (2 hunks)
  • src/Sylius/Behat/Service/JQueryHelper.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/DateFormat.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php (2 hunks)
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (3 hunks)
  • src/Sylius/Bundle/ShopBundle/templates/shared/components/header/cart.html.twig (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/ci_e2e-mysql.yaml
✅ Files skipped from review due to trivial changes (30)
  • features/hybrid/checkout/placing_order_on_multi_channel/placing_an_order_on_multiple_channels_with_same_currency.feature
  • src/Sylius/Behat/Page/Admin/Administrator/ImpersonateUserPage.php
  • src/Sylius/Behat/Page/Admin/DashboardPage.php
  • src/Sylius/Behat/Page/Shop/HomePage.php
  • src/Sylius/Behat/Page/Admin/Crud/IndexPage.php
  • src/Sylius/Behat/Page/Admin/Account/LoginPage.php
  • src/Sylius/Behat/Page/Admin/Shipment/ShowPage.php
  • src/Sylius/Behat/Page/Shop/Account/RegisterThankYouPage.php
  • src/Sylius/Behat/Page/Admin/Product/ShowPage.php
  • src/Sylius/Behat/Page/Shop/Account/ChangePasswordPage.php
  • src/Sylius/Behat/Page/Shop/Account/Order/ShowPage.php
  • src/Sylius/Behat/Page/Shop/Account/ProfileUpdatePage.php
  • src/Sylius/Behat/Page/Shop/Account/VerificationPage.php
  • src/Sylius/Behat/Page/Admin/Customer/ShowPage.php
  • src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/ShowPage.php
  • src/Sylius/Behat/Page/Admin/CatalogPromotion/ShowPage.php
  • src/Sylius/Behat/Page/Shop/Account/WellKnownPasswordChangePage.php
  • src/Sylius/Behat/Page/Shop/ProductReview/IndexPage.php
  • src/Sylius/Behat/Page/Shop/Product/IndexPage.php
  • features/hybrid/checkout/placing_order_on_multi_channel/placing_an_order_on_a_single_channel_store.feature
  • src/Sylius/Behat/Page/Admin/Order/HistoryPage.php
  • src/Sylius/Behat/Page/Shop/Account/DashboardPage.php
  • src/Sylius/Behat/Page/Shop/Account/Order/IndexPage.php
  • src/Sylius/Behat/Page/SymfonyPageInterface.php
  • src/Sylius/Behat/Page/Admin/Account/ResetPasswordPage.php
  • src/Sylius/Behat/Page/Shop/PaymentRequest/PaymentRequestNotifyPage.php
  • src/Sylius/Behat/Page/Admin/Account/RequestPasswordResetPage.php
  • src/Sylius/Behat/Page/Shop/Account/AddressBook/UpdatePage.php
  • src/Sylius/Behat/Page/Shop/Account/ResetPasswordPage.php
  • src/Sylius/Behat/Page/TestPlugin/MainPage.php
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/DateFormat.php
🧰 Additional context used
🧬 Code Definitions (8)
src/Sylius/Behat/Page/Shop/Account/RegisterPage.php (1)
src/Sylius/Behat/Page/SymfonyPage.php (1)
  • SymfonyPage (20-28)
src/Sylius/Behat/Page/Shop/Account/RequestPasswordResetPage.php (1)
src/Sylius/Behat/Page/SymfonyPage.php (1)
  • SymfonyPage (20-28)
src/Sylius/Behat/Page/Shop/Account/AddressBook/CreatePage.php (1)
src/Sylius/Behat/Page/SymfonyPage.php (1)
  • SymfonyPage (20-28)
src/Sylius/Behat/Page/Shop/Checkout/CompletePage.php (3)
src/Sylius/Behat/Page/Shop/Page.php (1)
  • Page (21-66)
src/Sylius/Behat/Page/SymfonyPage.php (1)
  • SymfonyPage (20-28)
src/Sylius/Behat/Service/DriverHelper.php (2)
  • DriverHelper (22-40)
  • waitForPageToLoad (34-39)
src/Sylius/Behat/Page/Admin/Crud/UpdatePage.php (2)
src/Sylius/Behat/Page/SymfonyPage.php (1)
  • SymfonyPage (20-28)
src/Sylius/Behat/Service/DriverHelper.php (2)
  • DriverHelper (22-40)
  • waitForPageToLoad (34-39)
src/Sylius/Behat/Page/Shop/Account/LoginPage.php (2)
src/Sylius/Behat/Page/SymfonyPage.php (1)
  • SymfonyPage (20-28)
src/Sylius/Behat/Service/DriverHelper.php (2)
  • DriverHelper (22-40)
  • waitForPageToLoad (34-39)
src/Sylius/Behat/Page/Admin/Crud/CreatePage.php (2)
src/Sylius/Behat/Page/SymfonyPage.php (1)
  • SymfonyPage (20-28)
src/Sylius/Behat/Service/DriverHelper.php (2)
  • DriverHelper (22-40)
  • waitForPageToLoad (34-39)
src/Sylius/Behat/Page/Shop/Order/ThankYouPage.php (2)
src/Sylius/Behat/Page/SymfonyPage.php (2)
  • SymfonyPage (20-28)
  • getElement (22-27)
src/Sylius/Behat/Service/DriverHelper.php (2)
  • DriverHelper (22-40)
  • waitForPageToLoad (34-39)
⏰ Context from checks skipped due to timeout of 90000ms (27)
  • GitHub Check: End-to-end tests (MySQL) / JS with Panther, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Panther, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Panther, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Panther, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / Non-JS, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Chromedriver, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / Non-JS, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Chromedriver, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Chromedriver, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Chromedriver, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / Non-JS, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (PostgreSQL) / Non-JS, PHP 8.3, Symfony ^7.1, PostgreSQL 16.4
  • GitHub Check: End-to-end tests (MySQL) / Non-JS, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (PostgreSQL) / Non-JS, PHP 8.2, Symfony ^6.4, PostgreSQL 15.8
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.3, Symfony ^7.1, MariaDB 11.4.3, State Machine Adapter winzou_state_machine
  • GitHub Check: Frontend / NodeJS 20.x
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.3, Symfony ^7.1, MariaDB 11.4.3, State Machine Adapter symfony_workflow
  • GitHub Check: Frontend / NodeJS 20.x
  • GitHub Check: Packages / PHP 8.3, Symfony ^7.1
  • GitHub Check: Packages / PHP 8.3, Symfony ^7.1
  • GitHub Check: Packages / PHP 8.2, Symfony ^6.4
  • GitHub Check: Packages / PHP 8.2, Symfony ^6.4
  • GitHub Check: End-to-end tests (PostgreSQL) / Non-JS, PHP 8.3, Symfony ^7.1, PostgreSQL 16.4
  • GitHub Check: End-to-end tests (PostgreSQL) / Non-JS, PHP 8.2, Symfony ^6.4, PostgreSQL 15.8
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.3, Symfony ^7.1, MariaDB 11.4.3, State Machine Adapter winzou_state_machine
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.3, Symfony ^7.1, MariaDB 11.4.3, State Machine Adapter symfony_workflow
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.2, Symfony ^6.4, MariaDB 10.11.9, State Machine Adapter symfony_workflow
🔇 Additional comments (52)
src/Sylius/Bundle/ShopBundle/templates/shared/components/header/cart.html.twig (1)

19-19: Improved testability with cart quantity attribute.

The addition of the sylius_test_html_attribute with the 'cart-quantity' identifier enhances testability by making the cart quantity value directly accessible for automated tests, following the same pattern used elsewhere in this template ('cart-button' and 'cart-total'). This is a good practice for maintaining consistent testing attributes throughout the codebase.

features/shop/checkout/receiving_confirmation_email_after_completing_checkout.feature (2)

14-14: LGTM: Updated testing tag for better browser automation control.

The change from @javascript to @mink:chromedriver provides more explicit control over the browser driver used for testing, which is a good practice for test stability. This change is part of standardizing the testing approach across the codebase.


22-22: LGTM: Consistent tag update across scenarios.

The same tag update has been appropriately applied to this scenario as well, maintaining consistency throughout the feature file. This standardization helps ensure all scenarios use the same browser automation approach.

composer.json (1)

244-246: Root Composer Conflict Declaration Check

The conflict block added here mirrors the one in the ApiBundle's composer file, ensuring consistency across the project. This prevents the incompatible version of "api-platform/jsonld" from being installed. The addition is clear and aligns with the dependency resolution strategy.

src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (3)

16-27: Well-structured updates to imports

The changes to imports reflect a shift towards using the query builder pattern instead of direct repository methods. The use of Doctrine\Persistence\Event\LifecycleEventArgs instead of the ORM-specific version is particularly good as it reduces coupling to a specific ORM implementation.


45-47: Good addition of required dependencies

The addition of QueryBuilder, Connection, and Query parameters correctly supports the new implementation approach.


71-71: Good addition of connection retrieval

The addition of the connection retrieval from the entity manager properly supports the new query-based approach.

src/Sylius/Behat/Page/Shop/Product/ShowPage.php (1)

388-388: Improved wait time to enhance test stability.

Increasing the wait time from 1 to 2 seconds when waiting for the summary page to be open helps address potential race conditions, especially in complex JavaScript interactions. This change should reduce test flakiness.

src/Sylius/Behat/Element/Admin/Taxon/FormElement.php (1)

90-91: Improved stability by ensuring page is fully loaded before retrieving values.

Adding DriverHelper::waitForPageToLoad() ensures that the page has completed loading before retrieving translation field values, reducing the possibility of flaky tests that might occur when attempting to access elements before they're fully rendered.

src/Sylius/Behat/Page/Shop/Checkout/AddressPage.php (2)

21-21: Added necessary import for DriverHelper.

This import enables the use of the waitForPageToLoad method to improve page loading handling.


208-208: Enhanced checkout flow stability with page load waiting.

Adding DriverHelper::waitForPageToLoad() after clicking the next step button ensures that the application waits for the next page to fully load before proceeding, preventing race conditions in the checkout flow tests.

src/Sylius/Behat/Element/Shop/Account/RegisterElement.php (2)

19-19: Added necessary import for DriverHelper.

This import supports the new page load waiting functionality added to the register method.


26-27: Improved registration flow stability with page load waiting.

Adding DriverHelper::waitForPageToLoad() after the register button click ensures that the code waits for the page to fully load after registration submission, preventing potential test failures that could occur if subsequent operations execute before the page transition completes.

src/Sylius/Behat/Page/Shop/Order/ThankYouPage.php (2)

17-17: Added helpful import for DriverHelper.

The import of DriverHelper class provides access to utility methods for handling driver behavior, especially waiting for page loads. This addition supports the subsequent changes in the method implementation.


24-25: Improved reliability by adding wait for page load.

Adding DriverHelper::waitForPageToLoad() after the click action is an important enhancement that prevents race conditions and ensures the page is fully loaded before proceeding with subsequent actions. This is especially important for JavaScript-driven pages where elements might not be immediately available after navigation.

src/Sylius/Behat/Page/Shop/Account/AddressBook/CreatePage.php (1)

18-18: Updated import to use Sylius's own SymfonyPage implementation.

The import has been changed from FriendsOfBehat\PageObjectExtension\Page\SymfonyPage to Sylius\Behat\Page\SymfonyPage. This is a positive change as it leverages Sylius's own implementation which, based on the provided context, includes automatic page load waiting in the getElement method.

This change is part of a broader refactoring to improve test reliability. The custom SymfonyPage implementation automatically calls DriverHelper::waitForPageToLoad() when getting elements, which helps prevent race conditions throughout the test suite.

behat.yml.dist (1)

53-68: Enhanced Chrome browser configuration for headless testing.

The addition of the options section with detailed browser_arguments significantly improves the headless Chrome configuration for testing. These arguments:

  1. Set window size for consistent viewport
  2. Enable headless mode
  3. Disable various features that can interfere with automated testing (sandbox, GPU, infobars, etc.)
  4. Prevent browser popups and background activities

This configuration will lead to more stable and predictable test runs across different environments.

src/Sylius/Behat/Page/Shop/ProductReview/CreatePage.php (2)

17-17: Added important import for DriverHelper.

The import of DriverHelper class provides access to utility methods for handling driver behavior, specifically waiting for page loads. This addition supports the subsequent changes in the method implementation.


55-56: Improved test reliability by adding wait for page load after form submission.

Adding DriverHelper::waitForPageToLoad() after the form submission is an excellent enhancement that prevents race conditions and ensures the page is fully loaded before proceeding. This is particularly important after form submissions, which typically trigger page reloads or redirects.

This change improves the test reliability by ensuring that any subsequent actions or assertions only happen after the page has completely loaded following the review submission.

src/Sylius/Behat/Element/Admin/Taxon/TreeElement.php (1)

17-17: Good improvement for test reliability!

Adding the DriverHelper::waitForPageToLoad() call before counting taxons ensures the page is fully loaded prior to accessing DOM elements. This is an important fix that will reduce flaky tests by preventing premature element counting before the page has completely rendered.

Also applies to: 35-36

src/Sylius/Behat/Page/SymfonyPage.php (1)

1-29: Excellent architectural improvement for test reliability!

Creating this custom SymfonyPage class that extends the base implementation is a strong design choice. By overriding the getElement method to ensure pages are fully loaded before element retrieval, you've implemented a consistent approach that automatically benefits all page objects without requiring changes to individual implementations.

This will significantly reduce flaky tests across the entire test suite by preventing premature element access.

src/Sylius/Behat/Service/JQueryHelper.php (1)

23-23: Improved approach to detecting asynchronous actions!

This change shifts from jQuery-specific detection to a more robust DOM-based approach by:

  1. Looking for the absence of [data-live-loading=true] elements rather than relying on jQuery's ajax state
  2. Adding a proper check for JavaScript-enabled drivers before attempting to wait
  3. Using document.readyState in combination with the loading attribute check

This makes the tests more resilient to different ajax implementation methods and provides a standardized way to detect loading states across the application.

Also applies to: 28-30

src/Sylius/Behat/Resources/config/services/pages.xml (1)

32-32: Necessary service configuration update for the enhanced SymfonyPage

This change properly updates the service definition to use Sylius' custom SymfonyPage implementation instead of the external FriendsOfBehat version. This ensures all page services will benefit from the enhanced wait-for-page-load functionality introduced in the custom implementation.

src/Sylius/Behat/Page/Shop/Account/RequestPasswordResetPage.php (1)

17-17: Clean namespace transition for SymfonyPage.

The import statement is updated to use the internal Sylius implementation instead of the external library. This change is beneficial as it reduces external dependencies and provides enhanced functionality through the new SymfonyPage implementation, which now includes page loading verification before element retrieval.

src/Sylius/Behat/Page/Shop/Page.php (1)

18-19: Updated imports align with enhanced page object model.

Both changes improve the test framework:

  1. Using the internal Sylius\Behat\Page\SymfonyPage implementation reduces external dependencies
  2. Adding DriverHelper import supports the enhanced functionality in the page object model

These changes allow the Page class to benefit from the waitForPageToLoad functionality that's now built into the SymfonyPage parent class.

src/Sylius/Behat/Service/DriverHelper.php (1)

19-19: Excellent addition of page loading helper function.

This new waitForPageToLoad method significantly improves test reliability by ensuring elements are fully loaded before interaction. The implementation is well-designed:

  1. It only applies the wait to JavaScript-capable drivers (Selenium, ChromeDriver, PantherDriver)
  2. The wait condition is comprehensive, checking both document readiness and absence of loading indicators
  3. The method will now be used by the SymfonyPage class to make all element interactions more robust

This is a valuable enhancement that will help prevent flaky tests caused by timing issues.

Also applies to: 34-39

src/Sylius/Behat/Page/Shop/Account/RegisterPage.php (1)

17-17: SymfonyPage namespace transition improves page object model.

The import statement update is part of a consistent pattern across the codebase, replacing the external FriendsOfBehat\PageObjectExtension\Page\SymfonyPage with the internal Sylius\Behat\Page\SymfonyPage implementation. This change leverages the enhanced functionality of the internal implementation, particularly the automatic page loading verification before element retrieval.

src/Sylius/Behat/Page/Admin/Crud/CreatePage.php (2)

21-21: Updated import path for SymfonyPage.

The import statement has been updated to use the local Sylius\Behat\Page\SymfonyPage instead of the external FriendsOfBehat\PageObjectExtension\Page\SymfonyPage. This change aligns with the custom implementation that includes the waitForPageToLoad functionality in the getElement method.


43-43: Added page load wait after button click for improved test reliability.

Adding DriverHelper::waitForPageToLoad($this->getSession()); after the create button click ensures that the page is fully loaded before proceeding with subsequent operations. This enhances test stability by preventing race conditions where tests might try to interact with elements before they're fully rendered.

src/Sylius/Behat/Page/Shop/Checkout/SelectPaymentPage.php (3)

17-17: Updated import path for SymfonyPage.

The import statement has been updated to use the local Sylius\Behat\Page\SymfonyPage class which includes additional functionality for handling page loading states.


30-30: Added DOM readiness check before interacting with payment methods.

Adding a wait condition to ensure the document body is available before attempting to interact with payment method elements. This improves test reliability, especially in JavaScript-enabled test environments where DOM elements might not be immediately available.


63-63: Added page load wait after navigation to enhance test stability.

Adding DriverHelper::waitForPageToLoad($this->getSession()); after proceeding to the next checkout step ensures that the page is fully loaded before continuing. This prevents potential race conditions where tests might fail because they're interacting with elements on the next page before it's fully rendered.

src/Sylius/Behat/Page/Shop/Checkout/SelectShippingPage.php (3)

17-17: Updated import path for SymfonyPage.

The import statement has been updated to use the local Sylius\Behat\Page\SymfonyPage class which includes additional functionality for handling page loading states.


30-30: Added DOM readiness check before interacting with shipping methods.

Adding a wait condition to ensure the document body is available before attempting to interact with shipping method elements. This improves test reliability, especially in JavaScript-enabled test environments where DOM elements might not be immediately available.


79-79: Added page load wait after navigation to enhance test stability.

Adding DriverHelper::waitForPageToLoad($this->getSession()); after proceeding to the next checkout step ensures that the page is fully loaded before continuing. This prevents potential race conditions where tests might fail because they're interacting with elements on the next page before it's fully rendered.

src/Sylius/Behat/Page/Admin/Crud/UpdatePage.php (2)

21-21: Updated import path for SymfonyPage.

The import statement has been updated to use the local Sylius\Behat\Page\SymfonyPage instead of the external FriendsOfBehat\PageObjectExtension\Page\SymfonyPage. This change aligns with the custom implementation that includes the waitForPageToLoad functionality in the getElement method.


43-43: Added page load wait after button click for improved test reliability.

Adding DriverHelper::waitForPageToLoad($this->getSession()); after clicking the update changes button ensures that the page is fully loaded before proceeding with subsequent operations. This enhances test stability by preventing race conditions where tests might try to interact with elements before they're fully rendered.

src/Sylius/Behat/Page/Shop/Checkout/CompletePage.php (2)

18-18: Updated import to use Sylius namespace.

The import statement for SymfonyPage has been changed from FriendsOfBehat\PageObjectExtension\Page\SymfonyPage to Sylius\Behat\Page\SymfonyPage. This change aligns with a broader effort to transition the codebase to Sylius-namespace components.


185-186: Added page load waiting after confirm button press.

Adding DriverHelper::waitForPageToLoad after the confirm button is pressed improves test reliability by ensuring the page has fully loaded before proceeding with any subsequent operations. This helps prevent race conditions where tests might try to interact with elements before they're available in the DOM.

src/Sylius/Behat/Page/Shop/Account/LoginPage.php (2)

16-17: Updated imports to use Sylius namespace and added DriverHelper.

The import statement for SymfonyPage has been changed to use the Sylius namespace, and an import for DriverHelper has been added. This is part of the broader effort to transition away from direct dependencies on external libraries.


34-35: Added page load waiting after login button click.

Adding DriverHelper::waitForPageToLoad after clicking the login button ensures the page has completely loaded before proceeding with subsequent actions. This enhancement makes tests more robust by preventing timing-related issues, especially in JavaScript-enabled browser tests.

src/Sylius/Behat/Page/Shop/Account/AddressBook/IndexPage.php (2)

16-17: Updated imports to use Sylius namespace and added DriverHelper.

The import statement for SymfonyPage has been updated to use the Sylius namespace, and an import for DriverHelper has been added. This change is consistent with other files in this PR that are transitioning to Sylius-namespace components.


61-62: Added page load waiting after delete button press.

Adding DriverHelper::waitForPageToLoad after pressing the delete button ensures the page is fully loaded before executing any subsequent actions. This improves test reliability by avoiding potential race conditions where tests might proceed before the deletion is complete and the page has updated.

src/Sylius/Behat/Page/Admin/Order/ShowPage.php (2)

19-21: Updated imports to use Sylius namespace and added DriverHelper.

The import statements have been updated to use the Sylius namespace for SymfonyPage and to add the DriverHelper service. This change is consistent with the other files in this PR, indicating a systematic effort to transition to Sylius-namespace components.


344-345: Added page load waiting before retrieving currency information.

Adding DriverHelper::waitForPageToLoad at the beginning of the getOrderCurrency method ensures the page is fully loaded before attempting to retrieve the currency element's text. This enhancement improves test reliability by preventing potential timing issues where the method might try to access the element before it's available in the DOM.

src/Sylius/Behat/Page/Shop/Order/ShowPage.php (4)

16-18: Good addition of DriverHelper for stable tests

You've updated the imports to use the internal Sylius\Behat\Page\SymfonyPage instead of the external one, and added the DriverHelper which will improve test stability.


32-37: Enhanced reliability in pay() method with page load waiting

Adding the wait for page load after clicking the pay link will help prevent flaky tests by ensuring the page is fully loaded before proceeding to the next steps.


52-58: Improved test stability in choosePaymentMethod()

Adding the wait for page load at the beginning of the method ensures that the payment method elements are fully loaded and interactive before attempting to select them.


72-85: Enhanced getChosenPaymentMethod() reliability

The addition of the wait for page load ensures that all payment method elements are fully rendered before attempting to find and check their state.

src/Sylius/Behat/Element/Shop/CartWidgetElement.php (3)

16-18: Good addition of DriverHelper import

The added import for DriverHelper aligns with other changes in the codebase, even though it's not directly used in this file yet.


21-31: Improved robustness of cart quantity retrieval

The updated implementation is more resilient:

  1. It properly handles cases when the cart quantity element doesn't exist
  2. It directly uses the data-test-cart-quantity attribute instead of parsing text
  3. It has proper type checking with the is_numeric function

This change will make the tests more stable and less prone to failure when the UI changes.


33-38: Updated element definition to match implementation

The element definition has been updated from cart_button to cart_quantity to align with the new implementation that focuses on the quantity element directly.

Comment on lines +1 to +9
# CONFLICTS

This document explains why certain conflicts were added to `composer.json` and
references related issues.

- `api-platform/jsonld: ^4.1.1`

API Platform introduced changes in version 4.1.1 that modify API responses, potentially breaking compatibility with our current implementation.
To ensure stable behavior, we have added this conflict until we can verify and adapt to the changes.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

New Conflict Documentation Review

The CONFLICTS.md file now clearly documents the conflict with "api-platform/jsonld": "^4.1.1", explaining that changes introduced in version 4.1.1 may break compatibility with the current implementation. This added documentation improves transparency and aids in the troubleshooting of dependency issues. For further clarity, consider adding a reference (e.g., issue number or PR link) if available.

This PR has been generated automatically.
For more details see
[refactor.yaml](/Sylius/Sylius/blob/1.12/.github/workflows/refactor.yaml).
@mpysiak mpysiak merged commit 750e888 into 2.1 Mar 26, 2025
76 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin AdminBundle related issues and PRs. API APIs related issues and PRs. Documentation Documentation related issues and PRs - requests, fixes, proposals. Maintenance CI configurations, READMEs, releases, etc. Shop ShopBundle related issues and PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants