mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
API Add check for text in current alert
This commit is contained in:
parent
4276dd9b96
commit
9d083e0135
@ -8,6 +8,8 @@ use Behat\Behat\Event\StepEvent;
|
|||||||
use Behat\Behat\Event\ScenarioEvent;
|
use Behat\Behat\Event\ScenarioEvent;
|
||||||
use Behat\Mink\Driver\Selenium2Driver;
|
use Behat\Mink\Driver\Selenium2Driver;
|
||||||
use Behat\Mink\Element\NodeElement;
|
use Behat\Mink\Element\NodeElement;
|
||||||
|
use Behat\Mink\Session;
|
||||||
|
use Behat\MinkExtension\Context\RawMinkContext;
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\Assets\Filesystem;
|
use SilverStripe\Assets\Filesystem;
|
||||||
|
|
||||||
@ -60,11 +62,13 @@ class BasicContext extends BehatContext
|
|||||||
* Get Mink session from MinkContext
|
* Get Mink session from MinkContext
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return \Behat\Mink\Session
|
* @return Session
|
||||||
*/
|
*/
|
||||||
public function getSession($name = null)
|
public function getSession($name = null)
|
||||||
{
|
{
|
||||||
return $this->getMainContext()->getSession($name);
|
/** @var SilverStripeContext $context */
|
||||||
|
$context = $this->getMainContext();
|
||||||
|
return $context->getSession($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -479,6 +483,18 @@ JS;
|
|||||||
$this->iDismissTheDialog();
|
$this->iDismissTheDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Given /^I see the text "([^"]+)" in the alert$/
|
||||||
|
*/
|
||||||
|
public function iSeeTheDialogText($expected)
|
||||||
|
{
|
||||||
|
$session = $this->getSession();
|
||||||
|
/** @var Selenium2Driver $driver */
|
||||||
|
$driver = $session->getDriver();
|
||||||
|
$text = $driver->getWebDriverSession()->getAlert_text();
|
||||||
|
assertContains($expected, $text);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Given /^I type "([^"]*)" into the dialog$/
|
* @Given /^I type "([^"]*)" into the dialog$/
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user