The extension adds following step definitions to feature context that allows to test popups:
Given /^(?:|I )press ok on alert$/
Given /^(?:|I )press ok on confirmation$/
Given /^(?:|I )press ok on input popup$/
Given /^(?:|I ) press cancel on confirmation$/
Given /^(?:|I ) press cancel on input popup$/
Given /^(?:|I ) type "([^"]*)" into input popup$/
Given /^the alert message should contain "([^"]*)"$/
Given /^the confirmation message should contain "([^"]*)"$/
Given /^the prompt message should contain "([^"]*)"$/
Given /^the alert message should not contain "([^"]*)"$/
Given /^the confirmation message should not contain "([^"]*)"$/
Given /^the prompt message should not contain "([^"]*)"$/
The simplest way to install the extension is to add following code to your composer.json:
{
"require": {
"irs/behat-popup-extension": "dev-master"
}
}
After that do composer install
and add following lines to behat.yml
to enable extension:
default:
extensions:
Irs\BehatPopupExtension\Extension: ~
Now you can use Irs\BehatPopupExtension\PopupContext
trait in the feature context. And do not forget that features' context should implement Behat\MinkExtension\Context\MinkAwareInterface
.