diff --git a/features/ui/frontend/wishlist/share_wishlist_link.feature b/features/ui/frontend/wishlist/share_wishlist_link.feature new file mode 100644 index 0000000000..bf2c7d22ee --- /dev/null +++ b/features/ui/frontend/wishlist/share_wishlist_link.feature @@ -0,0 +1,13 @@ +@ui @wishlist +Feature: Adding a product to the wishlist + Background: + Given the site operates on a store in "Austria" + And the store "Austria" is the default store + + Scenario: Adding a simple product to the wishlist + Given the site has a product "TShirt" priced at 10000 + And the product is active and published and available for store "Austria" + When I add this product to the wishlist + Then I should be on the wishlist summary page + And this wishlist item should have name "TShirt" + And I can see the share wishlist link diff --git a/features/ui/frontend/wishlist/show_shared_wishlist.feature b/features/ui/frontend/wishlist/show_shared_wishlist.feature new file mode 100644 index 0000000000..b0adacca48 --- /dev/null +++ b/features/ui/frontend/wishlist/show_shared_wishlist.feature @@ -0,0 +1,13 @@ +@ui @wishlist +Feature: Adding a product to the wishlist + Background: + Given the site operates on a store in "Austria" + And the store "Austria" is the default store + And the site has a product "TShirt" priced at 10000 + And the product is active and published and available for store "Austria" + When I add this product to the wishlist + Then I should be on the wishlist summary page + + Scenario: Show shared Wishlist + Given I visit the share wishlist link + Then this wishlist item should have name "TShirt" \ No newline at end of file diff --git a/src/CoreShop/Behat/Context/Ui/Frontend/WishlistContext.php b/src/CoreShop/Behat/Context/Ui/Frontend/WishlistContext.php index 2305422131..bcc756b01e 100644 --- a/src/CoreShop/Behat/Context/Ui/Frontend/WishlistContext.php +++ b/src/CoreShop/Behat/Context/Ui/Frontend/WishlistContext.php @@ -98,4 +98,21 @@ public function thisProductShouldHaveName($itemName): void { Assert::true($this->wishlistPage->hasItemNamed($itemName)); } + /** + * @Then I can see the share wishlist link + */ + public function iCanSeeTheShareWishlistLink(): void + { + Assert::true($this->wishlistPage->hasShareWishlistLink()); + } + + + /** + * @Given I visit the share wishlist link + */ + public function iVisitTheShareWishlistLink(): void + { + $this->wishlistPage->open(); + $this->wishlistPage->tryToOpenWithUri($this->wishlistPage->getShareWishlistLink()); + } } diff --git a/src/CoreShop/Behat/Page/Frontend/WishlistPage.php b/src/CoreShop/Behat/Page/Frontend/WishlistPage.php index 70badd73d2..03c0531894 100644 --- a/src/CoreShop/Behat/Page/Frontend/WishlistPage.php +++ b/src/CoreShop/Behat/Page/Frontend/WishlistPage.php @@ -58,10 +58,23 @@ private function hasItemWith(string $attributeName, string|array $selector): boo return false; } + public function hasShareWishlistLink(): bool + { + $this->getElement('share_wishlist_link'); + + return true; + } + + public function getShareWishlistLink(): string + { + return $this->getElement('share_wishlist_link')->getValue(); + } + protected function getDefinedElements(): array { return array_merge(parent::getDefinedElements(), [ 'wishlist_empty' => '[data-test-wishlist-empty]', + 'share_wishlist_link' => '[data-test-share-wishlist-link]', 'wishlist_items' => '[data-test-wishlist-items]', 'delete_button' => '[data-test-wishlist-remove-button="%name%"]', ]); diff --git a/src/CoreShop/Behat/Page/Frontend/WishlistPageInterface.php b/src/CoreShop/Behat/Page/Frontend/WishlistPageInterface.php index 7e8236a830..2146b9ee54 100644 --- a/src/CoreShop/Behat/Page/Frontend/WishlistPageInterface.php +++ b/src/CoreShop/Behat/Page/Frontend/WishlistPageInterface.php @@ -24,5 +24,9 @@ public function isEmpty(): bool; public function hasItemNamed(string $name): bool; + public function hasShareWishlistLink(): bool; + + public function getShareWishlistLink(): string; + public function removeProduct(string $productName): void; } diff --git a/src/CoreShop/Bundle/FrontendBundle/Resources/views/Wishlist/summary.html.twig b/src/CoreShop/Bundle/FrontendBundle/Resources/views/Wishlist/summary.html.twig index f03b0075ab..0a69a9fe7e 100644 --- a/src/CoreShop/Bundle/FrontendBundle/Resources/views/Wishlist/summary.html.twig +++ b/src/CoreShop/Bundle/FrontendBundle/Resources/views/Wishlist/summary.html.twig @@ -7,7 +7,7 @@ {% if share_link is defined and share_link %}