Created
July 24, 2012 21:55
-
-
Save swestcott/3172927 to your computer and use it in GitHub Desktop.
Behat Multi Session - Use 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 | |
/** | |
* @When /^"([^"]*)" posts a message$/ | |
*/ | |
public function postsAMessage($user) | |
{ | |
// Ensure message is unique | |
$this->message = 'Selenium Test ' . microtime(true); | |
$this->getSession($user)->getPage()->fillField("chat", $this->message); | |
$this->getSession($user)->executeScript( | |
"$('form').submit();" | |
); | |
$this->assertSession($user)->pageTextContains($this->message); | |
} | |
/** | |
* @Then /^"([^"]*)" should see that message$/ | |
*/ | |
public function shouldSeeThatMessage($user) | |
{ | |
$this->getSession($user)->wait(self::MAX_WAIT, | |
"$('.them:contains(\"" . $this->message . "\")').size() == 1" | |
); | |
$this->assertSession($user)->pageTextContains($this->message); | |
$node = $this->getSession($user)->getPage()->find("css", ".them"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment