From a755c2256ec10e10e9b1e45007b00a917cb03386 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 | 76 ++++++++++++++++++- ...t_to_wishlist_on_multiple_channels.feature | 39 +++++++++- .../api/adding_product_to_wishlist.feature | 39 ---------- ...t_to_wishlist_on_multiple_channels.feature | 49 ------------ ...adding_product_variant_to_wishlist.feature | 44 ----------- .../removing_product_from_wishlist.feature | 41 ---------- ...ving_product_variant_from_wishlist.feature | 24 ------ .../removing_product_from_wishlist.feature | 59 +++++++++++++- 8 files changed, 170 insertions(+), 201 deletions(-) delete mode 100644 features/api/adding_product_to_wishlist.feature delete mode 100644 features/api/adding_product_to_wishlist_on_multiple_channels.feature delete mode 100644 features/api/adding_product_variant_to_wishlist.feature delete mode 100644 features/api/removing_product_from_wishlist.feature delete mode 100644 features/api/removing_product_variant_from_wishlist.feature diff --git a/features/adding_product_to_wishlist.feature b/features/adding_product_to_wishlist.feature index a8d39fcb..b0bd20a7 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,77 @@ 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 with API 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 with API 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 with API + 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 with API + 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 + + @api + Scenario: Adding a product variant to wishlist with API as an anonymous user + Given user has a wishlist + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" + When user adds "700ML" product variant to the wishlist + Then user should have "700ML" product variant in the wishlist + + @api + Scenario: Adding a product variant to wishlist with API as an authenticated user + Given there is a user "test@example.com" + And user "test@example.com" "sylius" is authenticated + And user has a wishlist + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" + When user adds "700ML" product variant to the wishlist + Then user should have "700ML" product variant in the wishlist + + @api + Scenario: Anonymous user tries to add product variant to another user's wishlist with API + 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" + And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" + When user has a wishlist + And user is unauthenticated + Then user tries to add "700ML" product variant to the wishlist + + @api + Scenario: Authenticated user tries to add product to another user's wishlist with API + 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" + And the product "Jack Daniels Gentleman" has a "700ML" variant 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 "700ML" product variant to the wishlist diff --git a/features/adding_product_to_wishlist_on_multiple_channels.feature b/features/adding_product_to_wishlist_on_multiple_channels.feature index f04289e9..053009d4 100644 --- a/features/adding_product_to_wishlist_on_multiple_channels.feature +++ b/features/adding_product_to_wishlist_on_multiple_channels.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 @@ -12,7 +12,7 @@ Feature: Adding a product to wishlist And all store products appear under a main taxonomy @ui - Scenario: Adding product to wishlist in the first channel checking wishlist on the second channel. + Scenario: Adding product to wishlist in the first channel checking wishlist on the second channel Given I change my current channel to "Web-EU" When I add "Leprechaun's Silver" product to my wishlist And I should be notified that the product has been successfully added to my wishlist @@ -65,3 +65,38 @@ Feature: Adding a product to wishlist And I go to the wishlist page And I should have one item in my wishlist + @api + Scenario: Adding product to wishlist with API in the first channel checking wishlist on the second channel + Given I am browsing channel "Web-EU" + And user has a wishlist + When user adds product "Leprechaun's Silver" to the wishlist in "Web-EU" + Then user should have product "Leprechaun's Silver" in the wishlist + Then I am browsing channel "Web-US" + And user has a wishlist in "Web-US" + Then user should have an empty wishlist in "Web-US" + + @api + Scenario: Adding product to wishlisht with API on both channels + Given I change my current channel to "Web-EU" + And user has a wishlist in "Web-EU" + When user adds product "Leprechaun's Silver" to the wishlist in "Web-EU" + Then user should have product "Leprechaun's Silver" in the wishlist + Then I change my current channel to "Web-US" + And user has a wishlist in "Web-US" + When user adds product "Leprechaun's Gold" to the wishlist in "Web-US" + Then user should have product "Leprechaun's Gold" in the wishlist + + @api + Scenario: Adding product to wishlist with API on both channels and removing from one channel + Given I change my current channel to "Web-EU" + And user has a wishlist in "Web-EU" + When user adds product "Leprechaun's Silver" to the wishlist in "Web-EU" + Then user should have product "Leprechaun's Silver" in the wishlist + Then I change my current channel to "Web-US" + And user has a wishlist in "Web-US" + When user adds product "Leprechaun's Gold" to the wishlist in "Web-US" + Then user should have product "Leprechaun's Gold" in the wishlist + Then user removes product "Leprechaun's Gold" from the wishlist + Then user should have an empty wishlist + And I change my current channel to "Web-EU" + Then user should have product "Leprechaun's Silver" in the wishlist on "Web-EU" 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 diff --git a/features/api/adding_product_to_wishlist_on_multiple_channels.feature b/features/api/adding_product_to_wishlist_on_multiple_channels.feature deleted file mode 100644 index c5cd193a..00000000 --- a/features/api/adding_product_to_wishlist_on_multiple_channels.feature +++ /dev/null @@ -1,49 +0,0 @@ -@api_wishlist -Feature: Adding a product to wishlist - In order to compare or buy products later - As a Visitor - I want to be able to add products to my wishlist on 2 different channels - - Background: - Given the store operates on a channel named "Web-US" in "USD" currency - And the store also operates on another channel named "Web-EU" in "EUR" currency - And the store has a product "Leprechaun's Gold" priced at "$100.00" available in channel "Web-US" and channel "Web-EU" - And the store has a product "Leprechaun's Silver" priced at "€10.00" in "Web-EU" channel - And all store products appear under a main taxonomy - - @api - Scenario: Adding product to wishlist in the first channel checking wishlist on the second channel. - Given I am browsing channel "Web-EU" - And user has a wishlist - When user adds product "Leprechaun's Silver" to the wishlist in "Web-EU" - Then user should have product "Leprechaun's Silver" in the wishlist - Then I am browsing channel "Web-US" - And user has a wishlist in "Web-US" - Then user should have an empty wishlist in "Web-US" - - - @api - Scenario: Adding product to wishlisht on both channels - Given I change my current channel to "Web-EU" - And user has a wishlist in "Web-EU" - When user adds product "Leprechaun's Silver" to the wishlist in "Web-EU" - Then user should have product "Leprechaun's Silver" in the wishlist - Then I change my current channel to "Web-US" - And user has a wishlist in "Web-US" - When user adds product "Leprechaun's Gold" to the wishlist in "Web-US" - Then user should have product "Leprechaun's Gold" in the wishlist - - @api - Scenario: Adding product to wishlist on both channels and removing from one channel. - Given I change my current channel to "Web-EU" - And user has a wishlist in "Web-EU" - When user adds product "Leprechaun's Silver" to the wishlist in "Web-EU" - Then user should have product "Leprechaun's Silver" in the wishlist - Then I change my current channel to "Web-US" - And user has a wishlist in "Web-US" - When user adds product "Leprechaun's Gold" to the wishlist in "Web-US" - Then user should have product "Leprechaun's Gold" in the wishlist - Then user removes product "Leprechaun's Gold" from the wishlist - Then user should have an empty wishlist - And I change my current channel to "Web-EU" - Then user should have product "Leprechaun's Silver" in the wishlist on "Web-EU" diff --git a/features/api/adding_product_variant_to_wishlist.feature b/features/api/adding_product_variant_to_wishlist.feature deleted file mode 100644 index 0619c099..00000000 --- a/features/api/adding_product_variant_to_wishlist.feature +++ /dev/null @@ -1,44 +0,0 @@ -@api_wishlist -Feature: Adding a product variant to wishlist - - Background: - Given the store operates on a single channel in "United States" - - @api - Scenario: Adding a product variant to wishlist as an anonymous user - Given user has a wishlist - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" - When user adds "700ML" product variant to the wishlist - Then user should have "700ML" product variant in the wishlist - - @api - Scenario: Adding a product variant to wishlist as an authenticated user - Given there is a user "test@example.com" - And user "test@example.com" "sylius" is authenticated - And user has a wishlist - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" - When user adds "700ML" product variant to the wishlist - Then user should have "700ML" product variant in the wishlist - - @api - Scenario: Anonymous user tries to add product variant 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" - And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" - When user has a wishlist - And user is unauthenticated - Then user tries to add "700ML" product variant 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" - And the product "Jack Daniels Gentleman" has a "700ML" variant 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 "700ML" product variant to the wishlist diff --git a/features/api/removing_product_from_wishlist.feature b/features/api/removing_product_from_wishlist.feature deleted file mode 100644 index 57d3915a..00000000 --- a/features/api/removing_product_from_wishlist.feature +++ /dev/null @@ -1,41 +0,0 @@ -@api_wishlist -Feature: Removing product from the wishlist - Background: - Given the store operates on a single channel in "United States" - - @api - Scenario: Removing product from the 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 - And user removes product "Jack Daniels Gentleman" from the wishlist - Then user should have an empty wishlist - - @api - Scenario: Removing product from the wishlist as an authenticated user - Given there is a user "test@example.com" - And user "test@example.com" "sylius" is authenticated - 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 - And user removes product "Jack Daniels Gentleman" from the wishlist - Then user should have an empty wishlist - - @api - Scenario: Anonymous user tries to remove product from 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 remove product "Jack Daniels Gentleman" from the wishlist - - @api - Scenario: Authenticated user tries to remove product from 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 remove product "Jack Daniels Gentleman" from the wishlist diff --git a/features/api/removing_product_variant_from_wishlist.feature b/features/api/removing_product_variant_from_wishlist.feature deleted file mode 100644 index 02abd93a..00000000 --- a/features/api/removing_product_variant_from_wishlist.feature +++ /dev/null @@ -1,24 +0,0 @@ -@api_wishlist -Feature: Removing product variant from wishlist - Background: - Given the store operates on a single channel in "United States" - - @api - Scenario: Removing product variant from wishlist as an anonymous user - Given user has a wishlist - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" - When user adds "700ML" product variant to the wishlist - Then user removes "700ML" product variant from the wishlist - Then user should have an empty wishlist - - @api - Scenario: Removing a product variant from wishlist as an authenticated user - Given there is a user "test@example.com" - And user "test@example.com" "sylius" is authenticated - And user has a wishlist - And the store has a product "Jack Daniels Gentleman" priced at "$10.00" - And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" - When user adds "700ML" product variant to the wishlist - Then user removes "700ML" product variant from the wishlist - Then user should have an empty wishlist diff --git a/features/removing_product_from_wishlist.feature b/features/removing_product_from_wishlist.feature index e7ee7977..ce88a38c 100644 --- a/features/removing_product_from_wishlist.feature +++ b/features/removing_product_from_wishlist.feature @@ -1,4 +1,4 @@ -@wishlist +@wishlist @api_wishlist Feature: Removing a product from wishlist In order to compare or buy products later As a Visitor @@ -24,3 +24,60 @@ Feature: Removing a product from wishlist Then I check "Jack Daniels Gentleman" And I remove selected products from wishlist And I should have 0 products in my wishlist + + @api + Scenario: Removing product from the wishlist with API 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 + And user removes product "Jack Daniels Gentleman" from the wishlist + Then user should have an empty wishlist + + @api + Scenario: Removing product from the wishlist with API as an authenticated user + Given there is a user "test@example.com" + And user "test@example.com" "sylius" is authenticated + 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 + And user removes product "Jack Daniels Gentleman" from the wishlist + Then user should have an empty wishlist + + @api + Scenario: Anonymous user tries to remove product from another user's wishlist with API + 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 remove product "Jack Daniels Gentleman" from the wishlist + + @api + Scenario: Authenticated user tries to remove product from another user's wishlist with API + 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 remove product "Jack Daniels Gentleman" from the wishlist + + @api + Scenario: Removing product variant from wishlist with API as an anonymous user + Given user has a wishlist + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" + When user adds "700ML" product variant to the wishlist + Then user removes "700ML" product variant from the wishlist + Then user should have an empty wishlist + + @api + Scenario: Removing a product variant from wishlist with API as an authenticated user + Given there is a user "test@example.com" + And user "test@example.com" "sylius" is authenticated + And user has a wishlist + And the store has a product "Jack Daniels Gentleman" priced at "$10.00" + And the product "Jack Daniels Gentleman" has a "700ML" variant priced at "$10.00" + When user adds "700ML" product variant to the wishlist + Then user removes "700ML" product variant from the wishlist + Then user should have an empty wishlist