diff --git a/src/lib/Behat/BrowserContext/NotificationContext.php b/src/lib/Behat/BrowserContext/NotificationContext.php index dedae187e1..48de5c041b 100644 --- a/src/lib/Behat/BrowserContext/NotificationContext.php +++ b/src/lib/Behat/BrowserContext/NotificationContext.php @@ -41,6 +41,17 @@ public function notificationAppears(string $itemType, string $itemName, string $ $this->notification->closeAlert(); } + /** + * @Then warning notification that :message appears + */ + public function warningNotificationAppears(string $message): void + { + $this->notification->verifyIsLoaded(); + $this->notification->verifyAlertWarning(); + $this->notification->verifyMessage($message); + $this->notification->closeAlert(); + } + /** * @Then success notification that :message appears */ diff --git a/src/lib/Behat/Component/Notification.php b/src/lib/Behat/Component/Notification.php index 1fd93bccf1..0725a44e1e 100644 --- a/src/lib/Behat/Component/Notification.php +++ b/src/lib/Behat/Component/Notification.php @@ -23,6 +23,15 @@ public function verifyAlertSuccess(): void ->isVisible(); } + public function verifyAlertWarning(): void + { + $this->getHTMLPage() + ->setTimeout(20) + ->find($this->getLocator('warningAlert')) + ->assert() + ->isVisible(); + } + public function verifyAlertFailure(): void { Assert::assertTrue( @@ -72,6 +81,7 @@ protected function specifyLocators(): array new VisibleCSSLocator('alert', '.ibexa-notifications-container .alert'), new VisibleCSSLocator('alertMessage', '.ibexa-notifications-container .ibexa-alert__title'), new VisibleCSSLocator('successAlert', '.ibexa-alert--success'), + new VisibleCSSLocator('warningAlert', '.ibexa-alert--warning'), new VisibleCSSLocator('failureAlert', '.ibexa-alert--error'), new VisibleCSSLocator('closeAlert', '.ibexa-alert__close-btn'), ];