Skip to content

Commit

Permalink
[Behat] IBX-5755 Added test scenarios for product variants (#823)
Browse files Browse the repository at this point in the history
Co-authored-by: Bogdan Mazur <[email protected]>
  • Loading branch information
bogusez and Bogdan Mazur authored Jul 14, 2023
1 parent 2e73d72 commit a8249c5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/Behat/BrowserContext/NotificationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
10 changes: 10 additions & 0 deletions src/lib/Behat/Component/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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'),
];
Expand Down

0 comments on commit a8249c5

Please sign in to comment.