Skip to content

Commit

Permalink
minor Sylius#16111 [Admin][Promotion] Add create and update pages (GS…
Browse files Browse the repository at this point in the history
…adee)

This PR was merged into the bootstrap-admin-panel branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | bootstrap-admin-panel|
| Bug fix?        | no                                                      |
| New feature?    |yes                                                       |
| BC breaks?      | yes                                                       |
| Deprecations?   | no<!-- don't forget to update the UPGRADE-*.md file --> |
| Related tickets | |
| License         | MIT                                                          |

<!--
 - Bug fixes must be submitted against the 1.12 branch
 - Features and deprecations must be submitted against the 1.13 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
-->


Commits
-------
  [Admin] Add Promotion edit page with hooks
  [Admin] Add Promotion create page with hooks
  [Admin] Add initial rules to Promotion edit page
  [Admin] Add initial actions to Promotion edit page
  [Admin] Implement autocompletes for Promotion's rules and action on edit page
  [Admin] Add rules and actions to Promotion create page
  [Behat][Admin] Enable deleting promotion scenario
  [Behat][Admin] Cover scenarios for adding promotion
  [Behat][Admin] Cover scenarios for adding promotion with a label
  [Behat][Admin] Cover scenarios for editing promotion
  [Behat][Admin] Use element instead of trait for promotion form
  [Admin] Improve appearance of channel based promotion rules and actions
  [Behat][Admin] Cover scenarios for adding promotion with action
  [Behat][Admin] Enable preventing deletion of promotion scenario
  [Behat] Improve AutocompleteHelper to allow to select by name or by value
  [Behat][Admin] Cover scenarios for adding promotion with rules and actions filters
  [Behat][Admin] Enable seeing correct percentage discounts scenario
  [Behat][Admin] Cover scenarios for promotions filters validation
  [Behat][Admin] Cover scenarios for promotions validation
  [Admin] Overwrite promotion rules configuration instead of morphing to fix replacing autocomplete fields
  [Behat][Admin] Minor clean up in promotion pages
  [Admin] Fix static analysis
  [Admin] Fix accordion for translations
  [Admin] Refactor naming of promotion Twig Hooks and templates
  [Behat][Admin] Revert removing getValidationMessage from Crud/CreatePage
  [Behat][Admin] Introduce shared FormElement
  [Admin] Remove unneeded labels for promotion rules and actions
  [Behat] Change driver of some scenarios to chromedriver
  [Behat] Minor fixes
  [Admin] Bring back delete button for promotion rules and actions
  • Loading branch information
NoResponseMate authored Apr 18, 2024
2 parents 4ef7dda + b004e01 commit f26e6b1
Show file tree
Hide file tree
Showing 78 changed files with 1,559 additions and 574 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Adding a new promotion
Given the store operates on a single channel in "United States"
And I am logged in as an administrator

@api @todo @ui
@api @ui
Scenario: Adding a new promotion
When I want to create a new promotion
And I specify its code as "FULL_METAL_PROMOTION"
Expand All @@ -17,7 +17,7 @@ Feature: Adding a new promotion
Then I should be notified that it has been successfully created
And the "Full metal promotion" promotion should appear in the registry

@api @todo @ui
@api @ui
Scenario: Adding a new promotion with usage limit
When I want to create a new promotion
And I specify its code as "FULL_METAL_PROMOTION"
Expand All @@ -27,7 +27,7 @@ Feature: Adding a new promotion
Then I should be notified that it has been successfully created
And the "Full metal promotion" promotion should be available to be used only 50 times

@api @todo @ui
@api @ui
Scenario: Adding a new exclusive promotion
When I want to create a new promotion
And I specify its code as "FULL_METAL_PROMOTION"
Expand All @@ -37,7 +37,7 @@ Feature: Adding a new promotion
Then I should be notified that it has been successfully created
And the "Full metal promotion" promotion should be exclusive

@api @todo @ui
@api @ui
Scenario: Adding a new coupon based promotion
When I want to create a new promotion
And I specify its code as "FULL_METAL_PROMOTION"
Expand All @@ -47,7 +47,7 @@ Feature: Adding a new promotion
Then I should be notified that it has been successfully created
And the "Full metal promotion" promotion should be coupon based

@api @todo @ui
@api @ui
Scenario: Adding a new channels promotion
When I want to create a new promotion
And I specify its code as "FULL_METAL_PROMOTION"
Expand All @@ -57,7 +57,7 @@ Feature: Adding a new promotion
Then I should be notified that it has been successfully created
And the "Full metal promotion" promotion should be applicable for the "United States" channel

@api @todo @ui
@api @ui
Scenario: Adding a promotion with start and end date
When I want to create a new promotion
And I specify its code as "FULL_METAL_PROMOTION"
Expand All @@ -66,7 +66,7 @@ Feature: Adding a new promotion
And I add it
Then I should be notified that it has been successfully created

@api @todo @ui
@api @ui
Scenario: Adding a promotion not applies to discounted by catalog promotion items
When I want to create a new promotion
And I specify its code as "FULL_METAL_PROMOTION"
Expand All @@ -75,3 +75,11 @@ Feature: Adding a new promotion
And I add it
Then I should be notified that it has been successfully created
And the "Full metal promotion" promotion should not applies to discounted items

@ui @javascript @no-api
Scenario: Seeing rule and action configuration forms
When I want to create a new promotion
And I add a new rule
And I add a new action
Then I should see the rule configuration form
And I should see the action configuration form
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Adding promotion in different languages
And that channel allows to shop using "English (United States)" and "Polish (Poland)" locales
And I am logged in as an administrator

@api @todo @ui @javascript
@api @ui
Scenario: Adding a promotion with a label in a different language
When I want to create a new promotion
And I specify its code as "FULL_METAL_PROMOTION"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Adding a new promotion with action
Given the store operates on a single channel in "United States"
And I am logged in as an administrator

@api @todo @ui @javascript
@api @ui @javascript
Scenario: Adding a new promotion with fixed discount
When I want to create a new promotion
And I specify its code as "10_for_all_products"
Expand All @@ -18,7 +18,7 @@ Feature: Adding a new promotion with action
Then I should be notified that it has been successfully created
And the "$10.00 for all products!" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @javascript
Scenario: Adding a promotion with item percentage discount
When I want to create a new promotion
And I specify its code as "promotion_for_all_product_items"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ Feature: Adding a new promotion with action configured in different channels
And the store also operates on another channel named "Web-GB" in "GBP" currency
And I am logged in as an administrator

@todo @ui @mink:chromedriver @api
@ui @mink:chromedriver @api
Scenario: Adding a new promotion with item fixed discount
When I want to create a new promotion
And I specify its code as "20_for_all_products"
And I name it "Item fixed discount for all products!"
And I add the "Item fixed discount" action configured with amount of "$10.00" for "United States" channel
And it is also configured with amount of "£16.00" for "Web-GB" channel
And I add it
Then I should be notified that it has been successfully created
And the "Item fixed discount for all products!" promotion should appear in the registry
Then the "Item fixed discount for all products!" promotion should be successfully created
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ Feature: Adding promotion with filter
Given the store operates on a single channel in "United States"
And I am logged in as an administrator

@api @todo @ui @mink:chromedriver
@api @ui @mink:chromedriver
Scenario: Adding a promotion with item fixed discount only for products over 10
When I want to create a new promotion
And I specify its code as "10_for_all_products_over_10"
And I name it "$10 discount for all products over $10!"
And I add the "Item fixed discount" action configured with amount of "$10.00" for "United States" channel
And I specify that on "United States" channel this action should be applied to items with price greater than "$10.00"
And I add it
Then I should be notified that it has been successfully created
And the "$10 discount for all products over $10!" promotion should appear in the registry
Then the "$10 discount for all products over $10!" promotion should be successfully created

@api @todo @ui @javascript
@api @ui @javascript
Scenario: Adding a promotion with item fixed discount only for products between 10 and 100
When I want to create a new promotion
And I specify its code as "10_for_all_products_over_10"
Expand All @@ -30,31 +29,31 @@ Feature: Adding promotion with filter
Then I should be notified that it has been successfully created
And the "$10 discount for (almost) all products!" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @mink:chromedriver
Scenario: Adding a promotion with fixed discount for all t-shirts
Given the store classifies its products as "T-Shirts" and "Mugs"
When I want to create a new promotion
And I specify its code as "10_for_all_t_shirts"
And I name it "$10 discount for all T-Shirts!"
And I add the "Item fixed discount" action configured with amount of "$10.00" for "United States" channel
And I specify that this action should be applied to items from "T-Shirts" category
And I specify that this action should be applied to items from "T-Shirts" category for "United States" channel
And I add it
Then I should be notified that it has been successfully created
And the "$10 discount for all T-Shirts!" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @mink:chromedriver
Scenario: Adding a promotion with fixed discount for PHP T-Shirt
Given the store has a product "PHP T-Shirt" priced at "$100.00"
When I want to create a new promotion
And I specify its code as "10_for_php_t_shirt"
And I name it "$10 discount for PHP T-Shirts!"
And I add the "Item fixed discount" action configured with amount of "$10.00" for "United States" channel
And I specify that this action should be applied to the "PHP T-Shirt" product
And I specify that this action should be applied to the "PHP T-Shirt" product for "United States" channel
And I add it
Then I should be notified that it has been successfully created
And the "$10 discount for PHP T-Shirts!" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @javascript
Scenario: Adding a promotion with item percentage discount only for products over 10
When I want to create a new promotion
And I specify its code as "10_for_all_products_over_10"
Expand All @@ -65,7 +64,7 @@ Feature: Adding promotion with filter
Then I should be notified that it has been successfully created
And the "$10 discount for all products over $10!" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @javascript
Scenario: Adding a promotion with item percentage discount only for products between 10 and 100
When I want to create a new promotion
And I specify its code as "10_for_all_products_over_10"
Expand All @@ -76,26 +75,26 @@ Feature: Adding promotion with filter
Then I should be notified that it has been successfully created
And the "$10 discount for (almost) all products!" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @mink:chromedriver
Scenario: Adding a promotion with 10% percentage discount for all t-shirts
Given the store classifies its products as "T-Shirts" and "Mugs"
When I want to create a new promotion
And I specify its code as "10_for_all_t_shirts"
And I name it "$10 discount for all T-Shirts!"
And I add the "Item percentage discount" action configured with a percentage value of "10%" for "United States" channel
And I specify that this action should be applied to items from "T-Shirts" category
And I specify that this action should be applied to items from "T-Shirts" category for "United States" channel
And I add it
Then I should be notified that it has been successfully created
And the "$10 discount for all T-Shirts!" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @mink:chromedriver
Scenario: Adding a promotion with 10% percentage discount for PHP T-Shirt
Given the store has a product "PHP T-Shirt" priced at "$100.00"
When I want to create a new promotion
And I specify its code as "10_for_php_t_shirt"
And I name it "10% discount for PHP T-Shirts!"
And I add the "Item percentage discount" action configured with a percentage value of "10%" for "United States" channel
And I specify that this action should be applied to the "PHP T-Shirt" product
And I specify that this action should be applied to the "PHP T-Shirt" product for "United States" channel
And I add it
Then I should be notified that it has been successfully created
And the "10% discount for PHP T-Shirts!" promotion should appear in the registry
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Adding a new promotion with rule
And the store classifies its products as "T-Shirts" and "Mugs"
And I am logged in as an administrator

@api @todo @ui @javascript
@api @ui @mink:chromedriver
Scenario: Adding a new promotion with taxon rule
When I want to create a new promotion
And I specify its code as "HOLIDAY_SALE"
Expand All @@ -19,7 +19,7 @@ Feature: Adding a new promotion with rule
Then I should be notified that it has been successfully created
And the "Holiday sale" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @mink:chromedriver
Scenario: Adding a new promotion with total price of items from taxon rule
When I want to create a new promotion
And I specify its code as "100_MUGS_PROMOTION"
Expand All @@ -29,7 +29,7 @@ Feature: Adding a new promotion with rule
Then I should be notified that it has been successfully created
And the "100 Mugs promotion" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @mink:chromedriver
Scenario: Adding a new promotion with contains product rule
Given the store has a product "PHP T-Shirt" priced at "$100.00"
When I want to create a new promotion
Expand All @@ -40,7 +40,7 @@ Feature: Adding a new promotion with rule
Then I should be notified that it has been successfully created
And the "PHP T-Shirt promotion" promotion should appear in the registry

@api @todo @ui @javascript
@api @ui @javascript
Scenario: Adding a new group based promotion
Given the store has a customer group "Wholesale"
When I want to create a new promotion
Expand All @@ -50,11 +50,3 @@ Feature: Adding a new promotion with rule
And I add it
Then I should be notified that it has been successfully created
And the "Wholesale promotion" promotion should appear in the registry

@todo @ui @javascript @no-api
Scenario: Adding a new promotion of default type with one action
When I want to create a new promotion
And I add a new rule
And I add a new action
Then I should see the rule configuration form
And I should see the action configuration form
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ Feature: Adding a new promotion with rule configured in different channels
And the store operates on a channel named "Web-GB" in "GBP" currency
And I am logged in as an administrator

@todo @api @ui @mink:chromedriver
@api @ui @mink:chromedriver
Scenario: Adding a new promotion with total price of items from taxon rule
When I want to create a new promotion
And I specify its code as "100_IN_EVERY_CURRENCY"
And I name it "100 in every currency"
And I add the "Item total" rule configured with "€100.00" amount for "United States" channel and "£100.00" amount for "Web-GB" channel
And I add it
Then I should be notified that it has been successfully created
And the "100 in every currency" promotion should appear in the registry
Then the "100 in every currency" promotion should be successfully created
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Deleting a promotion
And there is a promotion "Christmas sale"
And I am logged in as an administrator

@api @todo @ui
@api @ui
Scenario: Deleted promotion should disappear from the registry
When I delete a "Christmas sale" promotion
Then I should be notified that it has been successfully deleted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,69 +10,79 @@ Feature: Editing promotion
And there is a promotion "Holiday sale" with priority 1
And I am logged in as an administrator

@api @todo @ui
@api @ui
Scenario: Being unable to change code of promotion
When I want to modify a "Christmas sale" promotion
Then I should not be able to edit its code

@api @todo @ui
@api @ui
Scenario: Editing promotions usage limit
When I want to modify a "Christmas sale" promotion
And I set its usage limit to 50
And I save my changes
Then I should be notified that it has been successfully edited
And the "Christmas sale" promotion should be available to be used only 50 times

@api @todo @ui
@api @ui
Scenario: Editing promotion exclusiveness
When I want to modify a "Christmas sale" promotion
And I set it as exclusive
And I save my changes
Then I should be notified that it has been successfully edited
And the "Christmas sale" promotion should be exclusive

@api @todo @ui
@api @ui
Scenario: Editing promotions coupon based option
When I want to modify a "Christmas sale" promotion
And I make it coupon based
And I save my changes
Then I should be notified that it has been successfully edited
And the "Christmas sale" promotion should be coupon based

@api @todo @ui
@api @ui
Scenario: Editing promotions channels
When I want to modify a "Christmas sale" promotion
And I make it applicable for the "United States" channel
And I save my changes
Then I should be notified that it has been successfully edited
And the "Christmas sale" promotion should be applicable for the "United States" channel

@api @todo @ui
@api @ui
Scenario: Editing a promotion with start and end date
When I want to modify a "Christmas sale" promotion
And I make it available from "12.12.2017" to "24.12.2017"
And I save my changes
Then I should be notified that it has been successfully edited
And the "Christmas sale" promotion should be available from "12.12.2017" to "24.12.2017"

@api @todo @ui
@api @ui
Scenario: Editing promotion after adding a new channel
Given this promotion gives "$10.00" discount to every order
When the store also operates on another channel named "EU-WEB"
Then I should be able to modify a "Christmas sale" promotion

@todo @ui @no-api
Scenario: Remove priority from existing promotion
@ui @no-api
Scenario: Removing priority from existing promotion
When I want to modify a "Christmas sale" promotion
And I remove its priority
And I save my changes
Then I should be notified that it has been successfully edited
And the "Christmas sale" promotion should have priority 1

@api @todo @ui
@api @ui
Scenario: Setting promotion to the lowest priority
When I want to modify a "Christmas sale" promotion
And I set its priority to "-1"
And I save my changes
Then I should be notified that it has been successfully edited
And the "Christmas sale" promotion should have priority 1

@ui @javascript
Scenario: Removing rule and action from existing promotion
Given the promotion gives "$10.00" discount to every order with quantity at least 1
When I want to modify a "Holiday sale" promotion
And I remove its last rule
And I remove its last action
And I save my changes
Then I should not see the rule configuration form
And I should not see the action configuration form
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Prevent deletion of promotions applied to order
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@api @todo @ui
@api @ui
Scenario: Being unable to delete a promotion that was applied to an order
When I try to delete a "Christmas sale" promotion
Then I should be notified that it is in use and cannot be deleted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Promotion unique code validation
And there is a promotion "No-VAT promotion" identified by "NO_VAT" code
And I am logged in as an administrator

@api @todo @ui
@api @ui
Scenario: Trying to add promotion with taken code
When I want to create a new promotion
And I specify its code as "NO_VAT"
Expand Down
Loading

0 comments on commit f26e6b1

Please sign in to comment.