Add a test for the search. Will certainly fail with Internet Explorer.

This commit is contained in:
Sébastien Lucas 2014-04-10 21:52:04 +02:00
parent bab1405a22
commit dc0309caa8

View file

@ -189,4 +189,36 @@ class Cops extends Sauce\Sausage\WebDriverTestCase
$filtered = $this->elements ($this->using('css selector')->value('*[class="books"]'));
$this->assertEquals (13, count($filtered));
}
public function normalSearch ($src, $out)
{
$driver = $this;
$title_test = function($value) use ($driver) {
$text = $driver->byXPath('//h1')->text ();
return $text == $value;
};
// Click on the cog to show the search
$cog = $this->byId ("searchImage");
$cog->click ();
sleep (1);
// Focus the input and type
$queryInput = $this->byName ("query");
$queryInput->click ();
$this->keys($src);
$queryInput->submit ();
$this->spinAssert("Home Title", $title_test, [ "SEARCH RESULT FOR *" . $out . "*" ]);
}
public function testSearchWithoutAccentuatedCharacters()
{
$this->normalSearch ("ali", "ALI");
}
public function testSearchWithAccentuatedCharacters()
{
$this->normalSearch ("é", "É");
}
}