Fix the js tests

This commit is contained in:
Kamil Grygierzec 2024-09-24 10:53:13 +02:00
parent c83f3524b6
commit 318522acfa
No known key found for this signature in database
GPG key ID: 7F54EE42DAD4B9E9
5 changed files with 17 additions and 14 deletions

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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');

View file

@ -37,9 +37,11 @@
<div class="mb-3">
{{ form_row(image_form.file, sylius_test_form_attribute('file')) }}
</div>
{% if image_form.position is defined %}
<div class="mb-3">
{{ form_row(image_form.position, sylius_test_form_attribute('position')) }}
</div>
{% endif %}
</div>
</div>
{% endfor %}