[Behat] Prevent items manipulation after checkout

This commit is contained in:
Rafikooo 2024-08-22 20:08:25 +02:00 committed by Grzegorz Sadowski
parent e486674742
commit 4aed3c2a4b
2 changed files with 13 additions and 1 deletions

View file

@ -39,7 +39,7 @@ Feature: Preventing cart from being modified after checkout
And I proceeded with "Free" shipping method and "Cash on Delivery" payment
And I confirmed my order
When I try to add product "AK-47" to the cart
Then I should be informed that cart items are no longer available
Then I should be informed that I cannot change the cart items after the checkout is completed
@api @no-ui
Scenario: Preventing from removing product after checkout

View file

@ -613,6 +613,18 @@ final class CartContext implements Context
Assert::same($this->responseChecker->getResponseContent($response)['hydra:description'], 'Not Found');
}
/**
* @Then I should be informed that I cannot change the cart items after the checkout is completed
*/
public function iShouldBeInformedThatICannotChangeTheCartItemsAfterTheCheckoutIsCompleted(): void
{
Assert::same(
$this->responseChecker->getError($this->shopClient->getLastResponse()),
'Cannot change cart items after the checkout is completed."',
);
Assert::same($this->shopClient->getLastResponse()->getStatusCode(), 422);
}
/**
* @Then /^the administrator should see "([^"]+)" product with quantity (\d+) in the (?:customer|visitor) cart$/
*/