Skip to content

Instantly share code, notes, and snippets.

@blazarecki
Last active November 10, 2021 15:54

Revisions

  1. blazarecki revised this gist May 27, 2013. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions PopupDictionary.php
    Original file line number Diff line number Diff line change
    @@ -14,15 +14,15 @@ trait PopupDictionary
    */
    public function confirmPopup()
    {
    $this->getSession()->getDriver()->wdSession->accept_alert();
    $this->getSession()->getDriver()->getWebDriverSession()->accept_alert();
    }

    /**
    * @when /^(?:|I )cancel the popup$/
    */
    public function cancelPopup()
    {
    $this->getSession()->getDriver()->wdSession->dismiss_alert();
    $this->getSession()->getDriver()->getWebDriverSession()->dismiss_alert();
    }

    /**
    @@ -34,7 +34,7 @@ public function cancelPopup()
    */
    public function assertPopupMessage($message)
    {
    return $message == $this->getSession()->getDriver()->wdSession->getAlert_text();
    return $message == $this->getSession()->getDriver()->getWebDriverSession()->getAlert_text();
    }

    /**
    @@ -44,6 +44,6 @@ public function assertPopupMessage($message)
    */
    public function setPopupText($message)
    {
    $this->getSession()->getDriver()->wdSession->postAlert_text($message);
    $this->getSession()->getDriver()->getWebDriverSession()->postAlert_text($message);
    }
    }
  2. blazarecki revised this gist Feb 21, 2013. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions PopupDictionary.php
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    <?php

    namespace Widop\Mink\Extension;

    /**
    * Dictionary to manage popups.
    *
    * @author Benjamin Lazarecki <benjamin.lazarecki@gmail.com>
    * Date: 07/06/12
    */

    namespace Widop\Mink\Extension;

    trait PopupDictionary
    {
    /**
    @@ -28,7 +28,7 @@ public function cancelPopup()
    /**
    * @When /^(?:|I )should see "([^"]*)" in popup$/
    *
    * @param string $message
    * @param string $message The message.
    *
    * @return bool
    */
    @@ -40,10 +40,10 @@ public function assertPopupMessage($message)
    /**
    * @When /^(?:|I )fill "([^"]*)" in popup$/
    *
    * @param string $test
    * @param string $message The message.
    */
    public function setPopupText($test)
    public function setPopupText($message)
    {
    $this->getSession()->getDriver()->wdSession->postAlert_text($test);
    $this->getSession()->getDriver()->wdSession->postAlert_text($message);
    }
    }
    }
  3. blazarecki revised this gist Jun 8, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion PopupDictionary.php
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ public function cancelPopup()
    /**
    * @When /^(?:|I )should see "([^"]*)" in popup$/
    *
    * @param $message
    * @param string $message
    *
    * @return bool
    */
  4. blazarecki revised this gist Jun 8, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions PopupDictionary.php
    Original file line number Diff line number Diff line change
    @@ -12,15 +12,15 @@ trait PopupDictionary
    /**
    * @when /^(?:|I )confirm the popup$/
    */
    public function confirm()
    public function confirmPopup()
    {
    $this->getSession()->getDriver()->wdSession->accept_alert();
    }

    /**
    * @when /^(?:|I )cancel the popup$/
    */
    public function cancel()
    public function cancelPopup()
    {
    $this->getSession()->getDriver()->wdSession->dismiss_alert();
    }
  5. blazarecki renamed this gist Jun 8, 2012. 1 changed file with 4 additions and 9 deletions.
    13 changes: 4 additions & 9 deletions popup.php → PopupDictionary.php
    Original file line number Diff line number Diff line change
    @@ -5,12 +5,7 @@
    * Date: 07/06/12
    */

    use Behat\Gherkin\Node\TableNode;

    use Behat\Mink\Mink,
    Behat\Mink\WebAssert;

    use Behat\Behat\Context\Step;
    namespace Widop\Mink\Extension;

    trait PopupDictionary
    {
    @@ -45,10 +40,10 @@ public function assertPopupMessage($message)
    /**
    * @When /^(?:|I )fill "([^"]*)" in popup$/
    *
    * @param $jsonText
    * @param string $test
    */
    public function setPopupText($jsonText)
    public function setPopupText($test)
    {
    $this->getSession()->getDriver()->wdSession->postAlert_text($jsonText);
    $this->getSession()->getDriver()->wdSession->postAlert_text($test);
    }
    }
  6. blazarecki revised this gist Jun 7, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions popup.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    <?php

    /**
    * @author Benjamin Lazarecki <benjamin.lazarecki@gmail.com>
    * Date: 07/06/12
  7. blazarecki revised this gist Jun 7, 2012. No changes.
  8. blazarecki revised this gist Jun 7, 2012. No changes.
  9. blazarecki created this gist Jun 7, 2012.
    52 changes: 52 additions & 0 deletions popup.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    /**
    * @author Benjamin Lazarecki <benjamin.lazarecki@gmail.com>
    * Date: 07/06/12
    */

    use Behat\Gherkin\Node\TableNode;

    use Behat\Mink\Mink,
    Behat\Mink\WebAssert;

    use Behat\Behat\Context\Step;

    trait PopupDictionary
    {
    /**
    * @when /^(?:|I )confirm the popup$/
    */
    public function confirm()
    {
    $this->getSession()->getDriver()->wdSession->accept_alert();
    }

    /**
    * @when /^(?:|I )cancel the popup$/
    */
    public function cancel()
    {
    $this->getSession()->getDriver()->wdSession->dismiss_alert();
    }

    /**
    * @When /^(?:|I )should see "([^"]*)" in popup$/
    *
    * @param $message
    *
    * @return bool
    */
    public function assertPopupMessage($message)
    {
    return $message == $this->getSession()->getDriver()->wdSession->getAlert_text();
    }

    /**
    * @When /^(?:|I )fill "([^"]*)" in popup$/
    *
    * @param $jsonText
    */
    public function setPopupText($jsonText)
    {
    $this->getSession()->getDriver()->wdSession->postAlert_text($jsonText);
    }
    }