diff --git a/features/order/managing_orders/order_filtration/filtering_orders_by_shipping_method.feature b/features/order/managing_orders/order_filtration/filtering_orders_by_shipping_method.feature new file mode 100644 index 0000000000..e4953e4b9f --- /dev/null +++ b/features/order/managing_orders/order_filtration/filtering_orders_by_shipping_method.feature @@ -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 diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingOrdersContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingOrdersContext.php index 5edc470327..a9124c66f8 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingOrdersContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingOrdersContext.php @@ -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 */ diff --git a/src/Sylius/Behat/Page/Admin/Order/IndexPage.php b/src/Sylius/Behat/Page/Admin/Order/IndexPage.php index 92b9388e83..d3dbd86ef8 100644 --- a/src/Sylius/Behat/Page/Admin/Order/IndexPage.php +++ b/src/Sylius/Behat/Page/Admin/Order/IndexPage.php @@ -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', ]); } diff --git a/src/Sylius/Behat/Page/Admin/Order/IndexPageInterface.php b/src/Sylius/Behat/Page/Admin/Order/IndexPageInterface.php index be166b7781..fdc869fdee 100644 --- a/src/Sylius/Behat/Page/Admin/Order/IndexPageInterface.php +++ b/src/Sylius/Behat/Page/Admin/Order/IndexPageInterface.php @@ -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;