Cover handling different currencies on multiple channels via API scenarios

This commit is contained in:
Jakub Tobiasz 2023-04-15 10:31:42 +02:00
parent f750f33357
commit dc4cd8a71c
No known key found for this signature in database
GPG key ID: 6434250CB3525233
2 changed files with 36 additions and 4 deletions

View file

@ -5,19 +5,19 @@ Feature: Handling different currencies on multiple channels
I want to browse channels with a valid currency only
Background:
Given the store operates on a channel named "Web" in "EUR" currency
Given the store operates on a channel named "Web" in "EUR" currency and with hostname "web.localhost.example"
And that channel allows to shop using "EUR", "USD" and "GBP" currencies
And the store operates on another channel named "Mobile" in "USD" currency
And the store operates on another channel named "Mobile" in "USD" currency and with hostname "m.localhost.example"
And that channel allows to shop using "USD" and "GBP" currencies
@ui
@ui @api
Scenario: Showing currencies only from the current channel
When I browse the "Mobile" channel
Then I should shop using the "USD" currency
And I should be able to shop using the "GBP" currency
And I should not be able to shop using the "EUR" currency
@ui
@ui @api
Scenario: Browsing channels using their default currencies
When I browse the "Web" channel
And I start browsing the "Mobile" channel

View file

@ -57,4 +57,36 @@ final class ChannelContext implements Context
sprintf('%s/shop/currencies/%s', $this->apiUrlPrefix, $currencyCode),
);
}
/**
* @Then I should be able to shop using the :currencyCode currency
*/
public function iShouldBeAbleToShopUsingTheCurrency(string $currencyCode): void
{
$this->client->index(Resources::CURRENCIES);
Assert::true(
$this->responseChecker->hasItemWithValue(
$this->client->getLastResponse(),
'code',
$currencyCode,
),
);
}
/**
* @Then I should not be able to shop using the :currencyCode currency
*/
public function iShouldNotBeAbleToShopUsingTheCurrency(string $currencyCode): void
{
$this->client->index(Resources::CURRENCIES);
Assert::false(
$this->responseChecker->hasItemWithValue(
$this->client->getLastResponse(),
'code',
$currencyCode,
),
);
}
}