Adjust behat tests

This commit is contained in:
Michał Pysiak 2024-10-29 07:08:26 +01:00
parent b847995f96
commit 7d6b4d6e5b
No known key found for this signature in database
GPG key ID: 9C1F2D0F99830187
4 changed files with 16 additions and 2 deletions

View file

@ -21,7 +21,7 @@ Feature: Adding images to an existing product
Scenario: Trying to add svg image to an existing product
Given the store has a product "Lamborghini Gallardo Model"
When I want to modify this product
And I attach the "sylius.svg" image
And I attach the "sylius.svg" image with "banner" type to this product
And I save my changes to the images
Then I should be notified that svg file is not allowed
And this product should not have any images

View file

@ -220,6 +220,19 @@ final class ManagingProductImagesContext implements Context
);
}
/**
* @Then I should be notified that svg file is not allowed
*/
public function iShouldBeNotifiedThatSvgFileIsNotAllowed(): void
{
Assert::contains(
$this->responseChecker->getError($this->client->getLastResponse()),
sprintf(
'The file is not a valid image.',
),
);
}
private function createProductImage(
string $path,
ProductInterface $product,

View file

@ -1086,7 +1086,7 @@ final class ManagingProductsContext implements Context
*/
public function iShouldBeNotifiedThatSvgTypeIsNotAllowed(): void
{
$this->assertValidationMessage('image', 'This file type is not allowed.');
$this->mediaFormElement->hasValidationErrorWithMessage('This file type is not allowed.');
}
/**

View file

@ -52,6 +52,7 @@ final class NotificationContext implements Context
);
}
/**
* @Then I should be notified that it :has been successfully deleted
* @Then I should be notified that they :have been successfully deleted