diff --git a/features/admin/product/managing_products/changing_images_of_product.feature b/features/admin/product/managing_products/changing_images_of_product.feature index 16b34e483b..16502da93a 100644 --- a/features/admin/product/managing_products/changing_images_of_product.feature +++ b/features/admin/product/managing_products/changing_images_of_product.feature @@ -31,8 +31,8 @@ Feature: Changing images of an existing product @api @ui @mink:chromedriver Scenario: Changing the type of image of a simple product Given the store has a product "Lamborghini Gallardo Model" - And this product has an image "lamborghini.jpg" with "thumbnail" type - And this product has an image "ford.jpg" with "banner" type + And this product has an image "lamborghini.jpg" with "thumbnail" type at position 1 + And this product has an image "ford.jpg" with "banner" type at position 2 When I want to modify this product And I change the first image type to "banner" And I save my changes to the images @@ -43,8 +43,8 @@ Feature: Changing images of an existing product @api @ui @mink:chromedriver Scenario: Changing the type of image of a configurable product Given the store has a "Lamborghini Gallardo Model" configurable product - And this product has an image "lamborghini.jpg" with "thumbnail" type - And this product has an image "ford.jpg" with "banner" type + And this product has an image "lamborghini.jpg" with "thumbnail" type at position 1 + And this product has an image "ford.jpg" with "banner" type at position 2 When I want to modify this product And I change the first image type to "banner" And I save my changes to the images diff --git a/features/shop/cart/shopping_cart/having_proper_product_image_displayed_in_cart.feature b/features/shop/cart/shopping_cart/having_proper_product_image_displayed_in_cart.feature index 91c5284538..77047d47ad 100644 --- a/features/shop/cart/shopping_cart/having_proper_product_image_displayed_in_cart.feature +++ b/features/shop/cart/shopping_cart/having_proper_product_image_displayed_in_cart.feature @@ -9,8 +9,8 @@ Feature: Having proper product image displayed in the cart And the store has a product "T-Shirt Car" And this product has "Small logo" variant priced at "$12.35" And this product has "Medium logo" variant priced at "$15.35" - And this product has an image "lamborghini.jpg" with "main" type - And this product has an image "ford.jpg" with "main" type for "Medium logo" variant + And this product has an image "lamborghini.jpg" with "main" type at position 0 + And this product has an image "ford.jpg" with "main" type at position 1 for "Medium logo" variant @no-api @ui @javascript Scenario: Having a variant's image displayed in the cart diff --git a/features/shop/product/show/viewing_product_images.feature b/features/shop/product/show/viewing_product_images.feature index e3a7289ed6..1129292bd7 100644 --- a/features/shop/product/show/viewing_product_images.feature +++ b/features/shop/product/show/viewing_product_images.feature @@ -10,13 +10,13 @@ Feature: Viewing a product's images on a product details page And this product has an image "lamborghini.jpg" with "other" type at position 2 And this product has an image "lamborghini.jpg" with "main" type at position 1 - @api @ui @mink:chromedriver + @api @ui @javascript Scenario: Viewing a product's main image on a product details page When I view product "Lamborghini Gallardo Model" Then I should see the product name "Lamborghini Gallardo Model" And I should be able to see a main image of type "main" - @api @ui @mink:chromedriver + @api @ui @javascript Scenario: Viewing a products images in correct order When I view product "Lamborghini Gallardo Model" Then I should see the product name "Lamborghini Gallardo Model" diff --git a/src/Sylius/Behat/Context/Setup/ProductContext.php b/src/Sylius/Behat/Context/Setup/ProductContext.php index ea63a0e4ca..f9fc102803 100644 --- a/src/Sylius/Behat/Context/Setup/ProductContext.php +++ b/src/Sylius/Behat/Context/Setup/ProductContext.php @@ -871,15 +871,16 @@ final class ProductContext implements Context } /** - * @Given /^(this product) has an image "([^"]+)" with "([^"]+)" type for ("[^"]+" variant)$/ + * @Given /^(this product) has an image "([^"]+)" with "([^"]+)" type at position (\d+) for ("[^"]+" variant)$/ */ public function thisProductHasAnImageWithTypeForVariant( ProductInterface $product, string $imagePath, string $imageType, + int $position, ProductVariantInterface $variant, ): void { - $this->createProductImage($product, $imagePath, $imageType, $variant); + $this->createProductImage($product, $imagePath, $imageType, $variant, $position); } /** @@ -1593,7 +1594,7 @@ final class ProductContext implements Context string $imagePath, string $imageType, ?ProductVariantInterface $variant = null, - ?int $position = null, + ?int $position = 0, ): void { $filesPath = $this->getParameter('files_path'); diff --git a/src/Sylius/Bundle/AdminBundle/templates/product/form/sections/media/images.html.twig b/src/Sylius/Bundle/AdminBundle/templates/product/form/sections/media/images.html.twig index 744750e5a2..e5f361ac5b 100644 --- a/src/Sylius/Bundle/AdminBundle/templates/product/form/sections/media/images.html.twig +++ b/src/Sylius/Bundle/AdminBundle/templates/product/form/sections/media/images.html.twig @@ -37,9 +37,11 @@