From f472819207b23da90f3df435571b844668e39827 Mon Sep 17 00:00:00 2001 From: Hubert Filar Date: Fri, 26 Jul 2024 14:24:37 +0200 Subject: [PATCH] OP-291: Refactor behats --- features/adding_product_to_wishlist.feature | 37 +++++++++++++++++- .../api/adding_product_to_wishlist.feature | 39 ------------------- 2 files changed, 36 insertions(+), 40 deletions(-) delete mode 100644 features/api/adding_product_to_wishlist.feature diff --git a/features/adding_product_to_wishlist.feature b/features/adding_product_to_wishlist.feature index a8d39fcb..18c2ea1d 100644 --- a/features/adding_product_to_wishlist.feature +++ b/features/adding_product_to_wishlist.feature @@ -1,4 +1,4 @@ -@wishlist +@wishlist @api_wishlist Feature: Adding a product to wishlist In order to compare or buy products later As a Visitor @@ -41,3 +41,38 @@ Feature: Adding a product to wishlist And I log out And I log in again Then I should have one item in my wishlist + + @api + Scenario: Adding a product to wishlist as an anonymous user + Given user has a wishlist + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + When user adds product "Jack Daniels Gentleman" to the wishlist + Then user should have product "Jack Daniels Gentleman" in the wishlist + + @api + Scenario: Adding a product to wishlist as an authenticated user + Given there is a user "test@example.com" + And user "test@example.com" "sylius" is authenticated + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + When user has a wishlist + And user adds product "Jack Daniels Gentleman" to the wishlist + Then user should have product "Jack Daniels Gentleman" in the wishlist + + @api + Scenario: Anonymous user tries to add product to another user's wishlist + Given there is a user "test@example.com" + And user "test@example.com" "sylius" is authenticated + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + When user has a wishlist + And user is unauthenticated + Then user tries to add product "Jack Daniels Gentleman" to the wishlist + + @api + Scenario: Authenticated user tries to add product to another user's wishlist + Given there is a user "test@example.com" + And user "test@example.com" "sylius" is authenticated + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + When user has a wishlist + And there is a user "test1@example.com" + And user "test1@example.com" "sylius" is authenticated + Then user tries to add product "Jack Daniels Gentleman" to the wishlist diff --git a/features/api/adding_product_to_wishlist.feature b/features/api/adding_product_to_wishlist.feature deleted file mode 100644 index da129f90..00000000 --- a/features/api/adding_product_to_wishlist.feature +++ /dev/null @@ -1,39 +0,0 @@ -@api_wishlist -Feature: Adding a product to wishlist - Background: - Given the store operates on a single channel in "United States" - - @api - Scenario: Adding a product to wishlist as an anonymous user - Given user has a wishlist - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - When user adds product "Jack Daniels Gentleman" to the wishlist - Then user should have product "Jack Daniels Gentleman" in the wishlist - - @api - Scenario: Adding a product to wishlist as an authenticated user - Given there is a user "test@example.com" - And user "test@example.com" "sylius" is authenticated - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - When user has a wishlist - And user adds product "Jack Daniels Gentleman" to the wishlist - Then user should have product "Jack Daniels Gentleman" in the wishlist - - @api - Scenario: Anonymous user tries to add product to another user's wishlist - Given there is a user "test@example.com" - And user "test@example.com" "sylius" is authenticated - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - When user has a wishlist - And user is unauthenticated - Then user tries to add product "Jack Daniels Gentleman" to the wishlist - - @api - Scenario: Authenticated user tries to add product to another user's wishlist - Given there is a user "test@example.com" - And user "test@example.com" "sylius" is authenticated - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - When user has a wishlist - And there is a user "test1@example.com" - And user "test1@example.com" "sylius" is authenticated - Then user tries to add product "Jack Daniels Gentleman" to the wishlist