mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
admin filtering promotions by coupon code
This commit is contained in:
parent
0e30e3b002
commit
522dc253fd
4 changed files with 46 additions and 1 deletions
|
|
@ -0,0 +1,19 @@
|
|||
@managing_promotions
|
||||
Feature: Filtering promotions by coupon code
|
||||
In order to filter promotions by coupon code
|
||||
As an Administrator
|
||||
I want to filter the promotions on the list
|
||||
|
||||
Background:
|
||||
Given the store operates on a single channel in "United States"
|
||||
And there is a promotion "Basic promotion"
|
||||
And the store has promotion "Holiday sale" with coupon "HOLIDAY"
|
||||
And the store has promotion "Christmas sale" with coupon "MAGIC"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Filtering promotions by coupon code
|
||||
When I want to browse promotions
|
||||
And I filter promotions by coupon code equal "MAGIC"
|
||||
And I should see a single promotion in the list
|
||||
And I should see the promotion "Christmas sale" in the list
|
||||
|
|
@ -272,7 +272,7 @@ final class ManagingPromotionsContext implements Context
|
|||
*/
|
||||
public function thereShouldBePromotion(int $amount = 1): void
|
||||
{
|
||||
Assert::same($amount, $this->indexPage->countItems());
|
||||
Assert::same($this->indexPage->countItems(), $amount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -671,6 +671,17 @@ final class ManagingPromotionsContext implements Context
|
|||
Assert::false($this->updatePage->hasAnyRule());
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^I filter promotions by coupon code equal "([^"]+)"/
|
||||
*/
|
||||
public function iFilterPromotionsByCouponCodeEqual(string $value): void
|
||||
{
|
||||
$this->indexPage->specifyFilterType('coupon_code', 'equal');
|
||||
$this->indexPage->specifyFilterValue('coupon_code', $value);
|
||||
|
||||
$this->indexPage->filter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $element
|
||||
* @param string $expectedMessage
|
||||
|
|
|
|||
|
|
@ -40,6 +40,16 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
return 'Yes' === $coupons->getText();
|
||||
}
|
||||
|
||||
public function specifyFilterType(string $field, string $type): void
|
||||
{
|
||||
$this->getDocument()->fillField(sprintf('criteria_%s_type', $field), $type);
|
||||
}
|
||||
|
||||
public function specifyFilterValue(string $field, string $value): void
|
||||
{
|
||||
$this->getDocument()->fillField(sprintf('criteria_%s_value', $field), $value);
|
||||
}
|
||||
|
||||
private function getPromotionFieldsWithHeader(PromotionInterface $promotion, string $header): NodeElement
|
||||
{
|
||||
$tableAccessor = $this->getTableAccessor();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ sylius_grid:
|
|||
couponBased:
|
||||
type: boolean
|
||||
label: sylius.ui.coupon_based
|
||||
coupon_code:
|
||||
type: string
|
||||
label: sylius.ui.coupon
|
||||
options:
|
||||
fields: [coupons.code]
|
||||
actions:
|
||||
main:
|
||||
create:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue