mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge branch '5.0' into 5
This commit is contained in:
commit
99fd1ac53b
@ -11,6 +11,7 @@ use Behat\Behat\Hook\Scope\AfterScenarioScope;
|
||||
use Behat\Behat\Hook\Scope\AfterStepScope;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use Behat\Behat\Hook\Scope\BeforeStepScope;
|
||||
use Behat\Mink\Driver\Selenium2Driver;
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Session;
|
||||
@ -562,7 +563,12 @@ JS;
|
||||
*/
|
||||
public function iSeeTheDialogText($expected)
|
||||
{
|
||||
$text = $this->getExpectedAlert()->getText();
|
||||
$driver = $this->getSession()->getDriver();
|
||||
if ($driver instanceof Selenium2Driver) {
|
||||
$text = $driver->getWebDriverSession()->getAlert_text();
|
||||
} else {
|
||||
$text = $this->getExpectedAlert()->getText();
|
||||
}
|
||||
Assert::assertStringContainsString($expected, $text);
|
||||
}
|
||||
|
||||
@ -597,12 +603,17 @@ JS;
|
||||
*/
|
||||
public function iConfirmTheDialog()
|
||||
{
|
||||
$session = $this->getWebDriverSession();
|
||||
$session->wait()->until(
|
||||
WebDriverExpectedCondition::alertIsPresent(),
|
||||
"Alert is expected"
|
||||
);
|
||||
$session->switchTo()->alert()->accept();
|
||||
$driver = $this->getSession()->getDriver();
|
||||
if ($driver instanceof Selenium2Driver) {
|
||||
$driver->getWebDriverSession()->accept_alert();
|
||||
} else {
|
||||
$session = $this->getWebDriverSession();
|
||||
$session->wait()->until(
|
||||
WebDriverExpectedCondition::alertIsPresent(),
|
||||
"Alert is expected"
|
||||
);
|
||||
$session->switchTo()->alert()->accept();
|
||||
}
|
||||
$this->handleAjaxTimeout();
|
||||
}
|
||||
|
||||
@ -611,7 +622,12 @@ JS;
|
||||
*/
|
||||
public function iDismissTheDialog()
|
||||
{
|
||||
$this->getExpectedAlert()->dismiss();
|
||||
$driver = $this->getSession()->getDriver();
|
||||
if ($driver instanceof Selenium2Driver) {
|
||||
$driver->getWebDriverSession()->dismiss_alert();
|
||||
} else {
|
||||
$this->getExpectedAlert()->dismiss();
|
||||
}
|
||||
$this->handleAjaxTimeout();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user