From 94e34ad61868dc6a28de6f1a708d63ae0b6b4cf9 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 25 Mar 2014 22:41:33 +0100 Subject: More selenium2 tests porting (cherry picked from commit 68bbb645ba5be61c2e3024ac3943c7346b30f1f2) Conflicts: tests/FunctionalTests/tickets/tests/Ticket587TestCase.php tests/FunctionalTests/tickets/tests/Ticket719TestCase.php --- tests/test_tools/PradoGenericSelenium2Test.php | 44 ++++++-------------------- 1 file changed, 10 insertions(+), 34 deletions(-) mode change 100644 => 100755 tests/test_tools/PradoGenericSelenium2Test.php (limited to 'tests/test_tools') diff --git a/tests/test_tools/PradoGenericSelenium2Test.php b/tests/test_tools/PradoGenericSelenium2Test.php old mode 100644 new mode 100755 index c81f6e9a..23dfeb61 --- a/tests/test_tools/PradoGenericSelenium2Test.php +++ b/tests/test_tools/PradoGenericSelenium2Test.php @@ -64,15 +64,8 @@ class PradoGenericSelenium2Test extends PHPUnit_Extensions_Selenium2TestCase protected function getElement($id) { - if(strpos($id, 'xpath=')===0) - { - return $this->byXPath(substr($id, 6)); - } elseif(strpos($id, 'css=')===0) { - return $this->byCssSelector(substr($id, 4)); - } elseif(strpos($id, 'id=')===0) { + if(strpos($id, 'id=')===0) { return $this->byId(substr($id, 3)); - } elseif(strpos($id, 'link=')===0) { - return $this->byLinkText(substr($id, 5)); } elseif(strpos($id, 'name=')===0) { return $this->byName(substr($id, 5)); } elseif(strpos($id, '//')===0) { @@ -121,6 +114,15 @@ class PradoGenericSelenium2Test extends PHPUnit_Extensions_Selenium2TestCase } protected function type($id, $txt='') + { + $element = $this->getElement($id); + $element->clear(); + $element->value($txt); + // trigger onblur() event + $this->byCssSelector('body')->click(); + } + + protected function typeSpecial($id, $txt='') { $element = $this->getElement($id); // clear the textbox without using clear() that triggers onchange() @@ -148,24 +150,6 @@ class PradoGenericSelenium2Test extends PHPUnit_Extensions_Selenium2TestCase $this->byCssSelector('body')->click(); } - protected function mouseOver($id) - { - $this->moveto(array( - 'element' => $this->getElement($id), -// 'xoffset' => 1, -// 'yoffset' => 1, - )); - } - - protected function mouseOut($id) - { - $this->moveto(array( - 'element' => $this->getElement('css=body'), -// 'xoffset' => 0, -// 'yoffset' => 0, - )); - } - protected function select($id, $value) { $select = parent::select($this->getElement($id)); @@ -227,14 +211,6 @@ class PradoGenericSelenium2Test extends PHPUnit_Extensions_Selenium2TestCase $this->assertSame($index, parent::select($this->getElement($id))->selectedValue()); } - protected function runScript($script) - { - $this->execute(array( - 'script' => $script, - 'args' => array() - )); - } - protected function assertAlertNotPresent() { try { -- cgit v1.2.3