Add BDD test for shipping method filter in orders list

This commit is contained in:
Jacques Bodin-Hullin 2020-06-25 23:41:54 +02:00
parent c0457468b7
commit ce38decc08
No known key found for this signature in database
GPG key ID: CD2C5D48C181EBE4
4 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,43 @@
@managing_orders
Feature: Filtering orders by a shipping method
In order to filter orders by a specific shipping method
As an Administrator
I want to be able to filter orders on the list
Background:
Given the store operates on a single channel in "United States"
And the store has a product "Blue ElePHPant"
And the store has a product "White ElePHPant"
And the store has a product "Red ElePHPant"
And the store ships everywhere for free
But the store has "DHL" shipping method with "$10.00" fee
And the store allows paying offline
And there is a customer "jack@teambiz.com" that placed an order "#000001337"
And the customer bought a single "Blue ElePHPant"
And the customer chose "Free" shipping method to "United States" with "Offline" payment
And there is a customer "gui@teambiz.com" that placed an order "#000000042"
And the customer bought a single "White ElePHPant"
And the customer chose "Free" shipping method to "United States" with "Offline" payment
And there is another customer "max@teambiz.com" that placed an order "#000001338"
And the customer bought a single "Red ElePHPant"
And the customer chose "DHL" shipping method to "United States" with "Offline" payment
And I am logged in as an administrator
@ui
Scenario: Filtering orders by DHL shipping method
When I browse orders
And I choose "DHL" as a shipping method filter
And I filter
Then I should see a single order in the list
And I should see an order with "#000001338" number
And I should not see an order with "#000001337" number
@ui
Scenario: Filtering orders by an another shipping method
When I browse orders
And I choose "Free" as a shipping method filter
And I filter
Then I should see 2 orders in the list
And I should see an order with "#000001337" number
And I should see an order with "#000000042" number
But I should not see an order with "#000001338" number

View file

@ -160,6 +160,14 @@ final class ManagingOrdersContext implements Context
$this->indexPage->chooseChannelFilter($channelName);
}
/**
* @When I choose :methodName as a shipping method filter
*/
public function iChooseMethodAsAShippingMethodFilter($methodName)
{
$this->indexPage->chooseShippingMethodFilter($methodName);
}
/**
* @When I choose :currencyName as the filter currency
*/

View file

@ -38,6 +38,11 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
$this->getElement('filter_channel')->selectOption($channelName);
}
public function chooseShippingMethodFilter(string $methodName): void
{
$this->getElement('filter_shipping_method')->selectOption($methodName);
}
public function chooseCurrencyFilter(string $currencyName): void
{
$this->getElement('filter_currency')->selectOption($currencyName);
@ -57,6 +62,7 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
{
return array_merge(parent::getDefinedElements(), [
'filter_channel' => '#criteria_channel',
'filter_shipping_method' => '#criteria_shipping_method',
'filter_currency' => '#criteria_total_currency',
]);
}

View file

@ -23,6 +23,8 @@ interface IndexPageInterface extends BaseIndexPageInterface
public function chooseChannelFilter(string $channelName): void;
public function chooseShippingMethodFilter(string $methodName): void;
public function chooseCurrencyFilter(string $currencyName): void;
public function specifyFilterTotalGreaterThan(string $total): void;