NEW Add easy way to dismiss all toasts in behat (#10661)

This commit is contained in:
Guy Sartorelli 2023-01-30 10:30:54 +13:00 committed by GitHub
parent 0fee1aa584
commit 0f4014650c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,21 @@ class CmsUiContext implements Context
Assert::assertNotNull($cms_element, 'CMS not found'); Assert::assertNotNull($cms_element, 'CMS not found');
} }
/**
* @Then /^I dismiss all toasts$/
*/
public function iDismissAllToasts()
{
$page = $this->getSession()->getPage();
$container = $page->find('css', '.toasts');
if (!$container) {
return;
}
foreach ($container->findAll('css', 'button.toast__close') as $button) {
$button->click();
}
}
/** /**
* @Then /^I should see a "(.+)" (\w+) toast$/ * @Then /^I should see a "(.+)" (\w+) toast$/
*/ */