From 22521e7b6cbbf684a67ba922f5cbb0debd6a22e5 Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Thu, 3 Dec 2020 13:29:49 +0100 Subject: [PATCH] Add Behat scenarios reproducing the bug --- ...board_more_than_one_pay_pal_seller.feature | 5 +++++ .../Admin/ManagingPaymentMethodsContext.php | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/features/trying_to_onboard_more_than_one_pay_pal_seller.feature b/features/trying_to_onboard_more_than_one_pay_pal_seller.feature index c40967c7..a7fe86a2 100644 --- a/features/trying_to_onboard_more_than_one_pay_pal_seller.feature +++ b/features/trying_to_onboard_more_than_one_pay_pal_seller.feature @@ -13,3 +13,8 @@ Feature: Trying to onboard more than one PayPal seller Scenario: Trying to onboard second PayPal seller When I try to create a new payment method with "PayPal" gateway factory Then I should be notified that I cannot onboard more than one PayPal seller + + @ui + Scenario: Being able to create different payment methods + When I want to create a new offline payment method + Then I should not be notified that I cannot onboard more than one PayPal seller diff --git a/tests/Behat/Context/Admin/ManagingPaymentMethodsContext.php b/tests/Behat/Context/Admin/ManagingPaymentMethodsContext.php index c32e4cd5..73bdce83 100644 --- a/tests/Behat/Context/Admin/ManagingPaymentMethodsContext.php +++ b/tests/Behat/Context/Admin/ManagingPaymentMethodsContext.php @@ -5,6 +5,8 @@ namespace Tests\Sylius\PayPalPlugin\Behat\Context\Admin; use Behat\Behat\Context\Context; +use Behat\Mink\Exception\ElementNotFoundException; +use Sylius\Behat\Exception\NotificationExpectationMismatchException; use Sylius\Behat\NotificationType; use Sylius\Behat\Page\Admin\Crud\IndexPageInterface; use Sylius\Behat\Page\Admin\PaymentMethod\CreatePageInterface; @@ -67,4 +69,21 @@ public function iShouldBeNotifiedThatICannotOnboardMoreThanOnePayPalSeller(): vo NotificationType::failure() ); } + + /** + * @Then I should not be notified that I cannot onboard more than one PayPal seller + */ + public function iShouldNotBeNotifiedThatICannotOnboardMoreThanOnePayPalSeller(): void + { + try { + $this->notificationChecker->checkNotification( + 'You cannot onboard more than one PayPal seller!', + NotificationType::failure() + ); + } catch (NotificationExpectationMismatchException|ElementNotFoundException $exception) { + return; + } + + throw new \DomainException('Step should fail'); + } }