Skip to content

Commit

Permalink
Cover Api steps in paying offline during checkout as guest scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMilek committed Apr 20, 2023
1 parent db561c9 commit dda3b02
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
10 changes: 10 additions & 0 deletions src/Sylius/Behat/Context/Api/Shop/CheckoutContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dda3b02

Please sign in to comment.