diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2014-03-25 22:41:33 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2014-03-25 22:41:40 +0100 |
commit | 68bbb645ba5be61c2e3024ac3943c7346b30f1f2 (patch) | |
tree | 0626fcf6341c30465f2b1dcc03db2a65d6939f84 /tests/test_tools | |
parent | 4e15c84379b99434515c119b72a6c8afcbf917dd (diff) |
More selenium2 tests porting
Diffstat (limited to 'tests/test_tools')
-rwxr-xr-x[-rw-r--r--] | tests/test_tools/PradoGenericSelenium2Test.php | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/tests/test_tools/PradoGenericSelenium2Test.php b/tests/test_tools/PradoGenericSelenium2Test.php index c81f6e9a..23dfeb61 100644..100755 --- 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) { @@ -123,6 +116,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() // the idea is to focus the input, move to the end of the text and hit // backspace until the input is empty. @@ -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 { |