mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Describe redirect issue with the Behat scenario
This commit is contained in:
parent
6193a33da8
commit
b26ec93813
9 changed files with 78 additions and 16 deletions
|
|
@ -0,0 +1,21 @@
|
|||
@managing_payment_methods
|
||||
Feature: Being redirected to previous filtered page
|
||||
In order to smoothen navigating through the Admin panel
|
||||
As an Administrator
|
||||
I want to be redirected to a previously filtered page after taking any action
|
||||
|
||||
Background:
|
||||
Given the store operates on a channel named "Poland"
|
||||
And the store allows paying with "Cash on Delivery"
|
||||
And the store allows paying with "Offline"
|
||||
And this payment method has been disabled
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui @no-api
|
||||
Scenario: Being redirected to previous filtered page after cancelling creating a new payment method
|
||||
When I browse payment methods
|
||||
And I choose enabled filter
|
||||
And I filter
|
||||
And I want to create a new offline payment method
|
||||
And I cancel my changes
|
||||
Then I should be redirected to the previous page of only enabled payment methods
|
||||
|
|
@ -166,6 +166,14 @@ final class ManagingPaymentMethodsContext implements Context
|
|||
$this->createPage->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I cancel my changes
|
||||
*/
|
||||
public function iCancelMyChanges(): void
|
||||
{
|
||||
$this->createPage->cancelChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I check (also) the :paymentMethodName payment method
|
||||
*/
|
||||
|
|
@ -211,6 +219,22 @@ final class ManagingPaymentMethodsContext implements Context
|
|||
$this->indexPage->open();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I choose enabled filter
|
||||
*/
|
||||
public function iChooseEnabledFilter(): void
|
||||
{
|
||||
$this->indexPage->chooseEnabledFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I filter
|
||||
*/
|
||||
public function iFilter(): void
|
||||
{
|
||||
$this->indexPage->filter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the first payment method on the list should have :field :value
|
||||
*/
|
||||
|
|
@ -440,4 +464,12 @@ final class ManagingPaymentMethodsContext implements Context
|
|||
$this->createPage->setStripeSecretKey('TEST');
|
||||
$this->createPage->setStripePublishableKey('TEST');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be redirected to the previous page of only enabled payment methods
|
||||
*/
|
||||
public function iShouldBeRedirectedToThePreviousFilteredPageWithFilter(): void
|
||||
{
|
||||
Assert::true($this->indexPage->isEnabledFilterApplied());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,16 @@ class IndexPage extends SymfonyPage implements IndexPageInterface
|
|||
$this->getDocument()->clickLink($order);
|
||||
}
|
||||
|
||||
public function chooseEnabledFilter(): void
|
||||
{
|
||||
$this->getElement('enabled_filter')->selectOption('Yes');
|
||||
}
|
||||
|
||||
public function isEnabledFilterApplied(): bool
|
||||
{
|
||||
return $this->getElement('enabled_filter')->getValue() === 'true';
|
||||
}
|
||||
|
||||
public function getRouteName(): string
|
||||
{
|
||||
return $this->routeName;
|
||||
|
|
@ -150,6 +160,7 @@ class IndexPage extends SymfonyPage implements IndexPageInterface
|
|||
return array_merge(parent::getDefinedElements(), [
|
||||
'bulk_actions' => '.sylius-grid-nav__bulk',
|
||||
'confirmation_button' => '#confirmation-button',
|
||||
'enabled_filter' => '#criteria_enabled',
|
||||
'filter' => 'button:contains("Filter")',
|
||||
'table' => '.table',
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -34,9 +34,13 @@ interface IndexPageInterface extends SymfonyPageInterface
|
|||
|
||||
public function countItems(): int;
|
||||
|
||||
public function chooseEnabledFilter(): void;
|
||||
|
||||
public function filter(): void;
|
||||
|
||||
public function bulkDelete(): void;
|
||||
|
||||
public function sort(string $order): void;
|
||||
|
||||
public function isEnabledFilterApplied(): bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
);
|
||||
}
|
||||
|
||||
public function cancelChanges(): void
|
||||
{
|
||||
$this->getElement('cancel_button')->click();
|
||||
}
|
||||
|
||||
public function checkChannel(string $channelName): void
|
||||
{
|
||||
$this->getDocument()->checkField($channelName);
|
||||
|
|
@ -97,6 +102,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
protected function getDefinedElements(): array
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
'cancel_button' => '[data-test-cancel-changes-button]',
|
||||
'code' => '#sylius_payment_method_code',
|
||||
'enabled' => '#sylius_payment_method_enabled',
|
||||
'gateway_name' => '#sylius_payment_method_gatewayConfig_gatewayName',
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ interface CreatePageInterface extends BaseCreatePageInterface
|
|||
|
||||
public function disable(): void;
|
||||
|
||||
public function cancelChanges(): void;
|
||||
|
||||
public function nameIt(string $name, string $languageCode): void;
|
||||
|
||||
public function specifyCode(string $code): void;
|
||||
|
|
|
|||
|
|
@ -48,11 +48,6 @@ class IndexPage extends CrudIndexPage implements IndexPageInterface
|
|||
$this->getElement('channel_filter')->selectOption($channelName);
|
||||
}
|
||||
|
||||
public function chooseEnabledFilter(): void
|
||||
{
|
||||
$this->getElement('enabled_filter')->selectOption('Yes');
|
||||
}
|
||||
|
||||
public function hasProductAccessibleImage(string $productCode): bool
|
||||
{
|
||||
$productRow = $this->getTableAccessor()->getRowWithFields($this->getElement('table'), ['code' => $productCode]);
|
||||
|
|
@ -85,11 +80,6 @@ class IndexPage extends CrudIndexPage implements IndexPageInterface
|
|||
return $this->getElement('last_product')->find('css', sprintf('[%s]', $attributeName)) !== null;
|
||||
}
|
||||
|
||||
public function isEnabledFilterApplied(): bool
|
||||
{
|
||||
return $this->getElement('enabled_filter')->getValue() === 'true';
|
||||
}
|
||||
|
||||
public function getPageNumber(): int
|
||||
{
|
||||
return (int) $this->getElement('page_number')->getText();
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ interface IndexPageInterface extends CrudIndexPageInterface
|
|||
|
||||
public function chooseChannelFilter(string $channelName): void;
|
||||
|
||||
public function chooseEnabledFilter(): void;
|
||||
|
||||
public function filter(): void;
|
||||
|
||||
public function goToPage(int $page): void;
|
||||
|
|
@ -36,6 +34,4 @@ interface IndexPageInterface extends CrudIndexPageInterface
|
|||
public function checkLastProductHasDataAttribute(string $attributeName): bool;
|
||||
|
||||
public function getPageNumber(): int;
|
||||
|
||||
public function isEnabledFilterApplied(): bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,16 +12,16 @@ default:
|
|||
- sylius.behat.context.transform.product
|
||||
- sylius.behat.context.transform.taxon
|
||||
|
||||
- sylius.behat.context.setup.admin_security
|
||||
- sylius.behat.context.setup.admin_user
|
||||
- sylius.behat.context.setup.channel
|
||||
- sylius.behat.context.setup.product
|
||||
- sylius.behat.context.setup.admin_security
|
||||
- sylius.behat.context.setup.taxonomy
|
||||
|
||||
- sylius.behat.context.ui.admin.browsing_product_variants
|
||||
- sylius.behat.context.ui.admin.managing_products
|
||||
- sylius.behat.context.ui.shop.browsing_product
|
||||
- Sylius\Behat\Context\Ui\Admin\ProductCreationContext
|
||||
|
||||
|
||||
filters:
|
||||
tags: "@admin_panel&&@ui"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue