Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API][Admin] Promotion coupons management(CRUD) #15539

Merged
merged 14 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions features/promotion/managing_coupons/adding_coupon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Adding a new coupon
And it is coupon based promotion
And I am logged in as an administrator

@ui
@ui @api
Scenario: Adding a new coupon
When I want to create a new coupon for this promotion
And I specify its code as "SANTA2016"
Expand All @@ -19,4 +19,4 @@ Feature: Adding a new coupon
And I make it valid until "21.04.2017"
And I add it
Then I should be notified that it has been successfully created
And there should be coupon with code "SANTA2016"
And there should be a "Christmas sale" promotion with a coupon code "SANTA2016"
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Feature: Browsing promotion coupons
And the store has promotion "Christmas sale" with coupon "SANTA2016"
And I am logged in as an administrator

@ui
Scenario: Browsing coupons in store
@ui @api
Scenario: Browsing coupons of a promotion
When I want to view all coupons of this promotion
And there should be 1 coupon related to this promotion
And there should be coupon with code "SANTA2016"
And there should be a "Christmas sale" promotion with a coupon code "SANTA2016"
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Coupon unique code validation
And the store has promotion "Christmas sale" with coupon "SANTA2016"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Trying to add coupon with taken code
When I want to create a new coupon for this promotion
And I specify its code as "SANTA2016"
Expand Down
35 changes: 29 additions & 6 deletions features/promotion/managing_coupons/coupon_validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Coupon validation
And it is coupon based promotion
And I am logged in as an administrator

@ui
@ui @api
Scenario: Trying to add a new coupon without specifying its code
When I want to create a new coupon for this promotion
And I do not specify its code
Expand All @@ -19,9 +19,9 @@ Feature: Coupon validation
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that code is required
And there should be 0 coupon related to this promotion
And there should be 0 coupons related to this promotion

@ui
@ui @api
Scenario: Trying to add a new coupon with usage limit below one
When I want to create a new coupon for this promotion
And I specify its code as "SANTA2016"
Expand All @@ -30,9 +30,9 @@ Feature: Coupon validation
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that coupon usage limit must be at least one
And there should be 0 coupon related to this promotion
And there should be 0 coupons related to this promotion

@ui
@ui @api
Scenario: Trying to add a new coupon with per customer usage limit below one
When I want to create a new coupon for this promotion
And I specify its code as "SANTA2016"
Expand All @@ -41,4 +41,27 @@ Feature: Coupon validation
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that coupon usage limit per customer must be at least one
And there should be 0 coupon related to this promotion
And there should be 0 coupons related to this promotion

@api @no-ui
Scenario: Trying to add a new coupon with no promotion
When I want to create a new coupon
And I specify its code as "RANDOM"
And I limit its usage to 30 times
And I limit its per customer usage to 3 times
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that promotion is required
And there should be no coupon with code "RANDOM"

@api @no-ui
Scenario: Trying to add a new coupon for a non-coupon based promotion
Given there is a promotion "Flash sale"
When I want to create a new coupon for this promotion
And I specify its code as "FAST-50"
And I limit its usage to 50 times
And I limit its per customer usage to 1 time
And I make it valid until "26.03.2017"
And I try to add it
Then I should be notified that only coupon based promotions can have coupons
And there should be 0 coupons related to this promotion
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Deleting a coupon
And the store has promotion "Christmas sale" with coupon "SANTA2016"
And I am logged in as an administrator

@domain @ui
@domain @ui @api
Scenario: Deleted coupon should disappear from the registry
When I delete "SANTA2016" coupon related to this promotion
Then I should be notified that it has been successfully deleted
Expand Down
22 changes: 15 additions & 7 deletions features/promotion/managing_coupons/editing_coupon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,39 @@ Feature: Editing promotion coupon
And the store has promotion "Christmas sale" with coupon "SANTA2016"
And I am logged in as an administrator

@ui
@ui @api
Scenario: Changing coupon expires date
When I want to modify the "SANTA2016" coupon for this promotion
And I change expires date to "21.05.2019"
And I change its expiration date to "21.05.2019"
And I save my changes
Then I should be notified that it has been successfully edited
And this coupon should be valid until "21.05.2019"

@ui
@ui @api
Scenario: Changing coupons usage limit
When I want to modify the "SANTA2016" coupon for this promotion
And I change its usage limit to 50
And I save my changes
Then I should be notified that it has been successfully edited
And this coupon should have 50 usage limit

@ui
@ui @api
Scenario: Changing coupons per customer usage limit
When I want to modify the "SANTA2016" coupon for this promotion
And I change its per customer usage limit to 20
And I save my changes
Then I should be notified that it has been successfully edited
And this coupon should have 20 per customer usage limit

@ui
Scenario: Seeing a disabled code field when editing a coupon
@ui @api
Scenario: Changing whether it can be reused from cancelled orders
When I want to modify the "SANTA2016" coupon for this promotion
Then the code field should be disabled
And I make it not reusable from cancelled orders
And I save my changes
Then I should be notified that it has been successfully edited
And this coupon should not be reusable from cancelled orders

@ui @api
Scenario: Being unable to change code of promotion coupon
When I want to modify the "SANTA2016" coupon for this promotion
Then I should not be able to edit its code
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Not being able to delete a coupon which is in use
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@domain @ui
@domain @ui @api
Scenario: Being unable to delete a used coupon
When I try to delete "SANTA2016" coupon related to this promotion
Then I should be notified that it is in use and cannot be deleted
Expand Down
20 changes: 10 additions & 10 deletions features/promotion/managing_coupons/sorting_coupons.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,69 @@ Feature: Sorting listed coupons
And this coupon expires on "20-02-2023"
And I am logged in as an administrator

@ui
@ui @api
Scenario: Coupons are sorted by descending number of uses by default
When I want to view all coupons of this promotion
Then I should see 3 coupons on the list
And the first coupon should have code "Y"

@ui
@ui @api
Scenario: Changing the number of uses sorting order to ascending
Given I am browsing coupons of this promotion
When I sort coupons by ascending number of uses
Then I should see 3 coupons on the list
And the first coupon should have code "X"

@ui
@ui @api
Scenario: Sorting coupons by code in descending order
Given I am browsing coupons of this promotion
When I sort coupons by descending code
Then I should see 3 coupons on the list
And the first coupon should have code "Z"

@ui
@ui @api
Scenario: Sorting coupons by code in ascending order
Given I am browsing coupons of this promotion
When I sort coupons by ascending code
Then I should see 3 coupons on the list
And the first coupon should have code "X"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by usage limit in descending order
Given I am browsing coupons of this promotion
When I sort coupons by descending usage limit
Then I should see 3 coupons on the list
And the first coupon should have code "X"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by usage limit in ascending order
Given I am browsing coupons of this promotion
When I sort coupons by ascending usage limit
Then I should see 3 coupons on the list
And the first coupon should have code "Z"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by usage limit per customer in descending order
Given I am browsing coupons of this promotion
When I sort coupons by descending usage limit per customer
Then I should see 3 coupons on the list
And the first coupon should have code "X"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by usage limit per customer in ascending order
Given I am browsing coupons of this promotion
When I sort coupons by ascending usage limit per customer
Then I should see 3 coupons on the list
And the first coupon should have code "Y"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by expiration date in descending order
Given I am browsing coupons of this promotion
When I sort coupons by descending expiration date
Then I should see 3 coupons on the list
And the first coupon should have code "Z"

@ui @no-postgres
@ui @no-postgres @api
Scenario: Sorting coupons by expiration date in ascending order
Given I am browsing coupons of this promotion
When I sort coupons by ascending expiration date
Expand Down