From dda3b02d87565ca55b53fd51d35058cea1e67039 Mon Sep 17 00:00:00 2001 From: TheMilek Date: Thu, 20 Apr 2023 15:42:01 +0200 Subject: [PATCH] Cover Api steps in paying offline during checkout as guest scenario --- .../paying_offline_during_checkout_as_guest.feature | 10 +++++++++- src/Sylius/Behat/Context/Api/Shop/CheckoutContext.php | 10 ++++++++++ .../config/suites/api/checkout/paying_for_order.yml | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/features/checkout/paying_for_order/paying_offline_during_checkout_as_guest.feature b/features/checkout/paying_for_order/paying_offline_during_checkout_as_guest.feature index 0549d58c464b..beeb36e0d127 100644 --- a/features/checkout/paying_for_order/paying_offline_during_checkout_as_guest.feature +++ b/features/checkout/paying_for_order/paying_offline_during_checkout_as_guest.feature @@ -20,9 +20,17 @@ Feature: Paying Offline during checkout as guest And I confirm my order Then I should see the thank you page - @ui + @ui @no-api Scenario: Successfully placing an order using custom locale Given I have product "PHP T-Shirt" in the cart When I proceed through checkout process in the "French (France)" locale with email "john@example.com" And I confirm my order Then I should see the thank you page in "French (France)" + + @api @no-ui + Scenario: Successfully placing an order using custom locale + Given I pick up cart in the "French (France)" locale + And I add product "PHP T-Shirt" to the cart + When I proceed through checkout process + And I confirm my order + Then I should see the thank you page in "French (France)" diff --git a/src/Sylius/Behat/Context/Api/Shop/CheckoutContext.php b/src/Sylius/Behat/Context/Api/Shop/CheckoutContext.php index 1947646fa16d..e114bd76ea67 100644 --- a/src/Sylius/Behat/Context/Api/Shop/CheckoutContext.php +++ b/src/Sylius/Behat/Context/Api/Shop/CheckoutContext.php @@ -34,6 +34,7 @@ use Sylius\Component\Core\Model\ShopUserInterface; use Sylius\Component\Core\OrderCheckoutStates; use Sylius\Component\Core\Repository\OrderRepositoryInterface; +use Sylius\Component\Locale\Model\LocaleInterface; use Sylius\Component\Product\Resolver\ProductVariantResolverInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; use Symfony\Component\HttpFoundation\Request as HTTPRequest; @@ -804,6 +805,15 @@ public function iShouldSeeTheThankYouPage(): void Assert::same($this->getCheckoutState(), OrderCheckoutStates::STATE_COMPLETED); } + /** + * @Then I should see the thank you page in :locale + */ + public function iShouldSeeTheThankYouPageInLocale(LocaleInterface $locale): void + { + $this->iShouldSeeTheThankYouPage(); + Assert::same($this->responseChecker->getValue($this->client->getLastResponse(), 'localeCode'), $locale->getCode()); + } + /** * @Then I should not see :shippingMethod shipping method */ diff --git a/src/Sylius/Behat/Resources/config/suites/api/checkout/paying_for_order.yml b/src/Sylius/Behat/Resources/config/suites/api/checkout/paying_for_order.yml index 85df5a38bc16..80285b78ac86 100644 --- a/src/Sylius/Behat/Resources/config/suites/api/checkout/paying_for_order.yml +++ b/src/Sylius/Behat/Resources/config/suites/api/checkout/paying_for_order.yml @@ -12,6 +12,7 @@ default: - sylius.behat.context.transform.channel - sylius.behat.context.transform.country - sylius.behat.context.transform.lexical + - sylius.behat.context.transform.locale - sylius.behat.context.transform.payment - sylius.behat.context.transform.product - sylius.behat.context.transform.shared_storage