Skip to content

Instantly share code, notes, and snippets.

@nojimage
Forked from blazarecki/PopupDictionary.php
Created December 12, 2012 08:46
Show Gist options
  • Save nojimage/4266176 to your computer and use it in GitHub Desktop.
Save nojimage/4266176 to your computer and use it in GitHub Desktop.
<?php
/**
* @author Benjamin Lazarecki <[email protected]>
* Date: 07/06/12
*/
namespace Widop\Mink\Extension;
trait PopupDictionary
{
/**
* @when /^(?:|I )confirm the popup$/
*/
public function confirmPopup()
{
$this->getSession()->getDriver()->getWebDriverSession()->accept_alert();
}
/**
* @when /^(?:|I )cancel the popup$/
*/
public function cancelPopup()
{
$this->getSession()->getDriver()->getWebDriverSession()->dismiss_alert();
}
/**
* @When /^(?:|I )should see "([^"]*)" in popup$/
*
* @param string $message
*
* @return bool
*/
public function assertPopupMessage($message)
{
return $message == $this->getSession()->getDriver()->getWebDriverSession()->getAlert_text();
}
/**
* @When /^(?:|I )fill "([^"]*)" in popup$/
*
* @param string $test
*/
public function setPopupText($test)
{
$this->getSession()->getDriver()->getWebDriverSession()->postAlert_text($test);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment