Created
July 24, 2012 21:42
-
-
Save swestcott/3172857 to your computer and use it in GitHub Desktop.
Behat Multi Session - Enter Chat Room
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @Given /^"([^"]*)" enters the chat room$/ | |
*/ | |
public function entersTheChatRoom($user) | |
{ | |
if(is_null($this->defaultDriver)) { | |
$this->defaultDriver = $this->getSession()->getDriver(); | |
} | |
$newDriver = clone $this->defaultDriver; | |
$newDriver->setWebDriver(new \WebDriver\WebDriver( | |
$this->params['wd_host'] | |
)); | |
$this->getMink()->registerSession($user, new \Behat\Mink\Session($newDriver)); | |
$this->getSession($user)->restart(); | |
$this->getSession($user)->visit($this->locatePath( | |
"WebSockets/ChatDemo/wsdemo.html" | |
)); | |
$this->getSession($user)->wait(self::MAX_WAIT, | |
"document.getElementById('status').innerHTML == 'Socket open'" | |
); | |
$this->assertSession($user)->pageTextContains("Socket open"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment