Skip to content

Instantly share code, notes, and snippets.

@Tobur
Forked from blazarecki/PopupDictionary.php
Created August 12, 2013 10:36
Show Gist options
  • Save Tobur/6209797 to your computer and use it in GitHub Desktop.
Save Tobur/6209797 to your computer and use it in GitHub Desktop.
<?php
namespace Widop\Mink\Extension;
/**
* Dictionary to manage popups.
*
* @author Benjamin Lazarecki <benjamin.lazarecki@gmail.com>
*/
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 The message.
*
* @return bool
*/
public function assertPopupMessage($message)
{
return $message == $this->getSession()->getDriver()->getWebDriverSession()->getAlert_text();
}
/**
* @When /^(?:|I )fill "([^"]*)" in popup$/
*
* @param string $message The message.
*/
public function setPopupText($message)
{
$this->getSession()->getDriver()->getWebDriverSession()->postAlert_text($message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment