Organize a little the test to avoid timing bugs.

This commit is contained in:
Sébastien Lucas 2013-12-12 21:53:45 +01:00
parent 0130e33c82
commit 42eb4c2a70

View file

@ -140,6 +140,12 @@ class Cops extends Sauce\Sausage\WebDriverTestCase
public function testFilter() public function testFilter()
{ {
$driver = $this;
$title_test = function($value) use ($driver) {
$text = $driver->byXPath('//h1')->text ();
return $text == $value;
};
// Click on the wrench to enable tag filtering // Click on the wrench to enable tag filtering
$this->byClassName ("icon-wrench")->click (); $this->byClassName ("icon-wrench")->click ();
@ -148,11 +154,7 @@ class Cops extends Sauce\Sausage\WebDriverTestCase
// Go back to home screen // Go back to home screen
$this->byClassName ("icon-home")->click (); $this->byClassName ("icon-home")->click ();
$driver = $this; $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]);
$title_test = function($value) use ($driver) {
$text = $driver->byXPath('//h1')->text ();
return $text == $value;
};
// Go on the recent page // Go on the recent page
$author = $this->byXPath ('//h2[contains(text(), "Recent")]'); $author = $this->byXPath ('//h2[contains(text(), "Recent")]');