From dc0309caa8a36988d88ba0aeb7fe169adda1f225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 10 Apr 2014 21:52:04 +0200 Subject: [PATCH] Add a test for the search. Will certainly fail with Internet Explorer. --- test/Sauce.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/Sauce.php b/test/Sauce.php index 1a734da..55b44fd 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -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 ("é", "É"); + } }