summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php4
-rwxr-xr-xtests/FunctionalTests/tickets/tests/Ticket656TestCase.php9
-rwxr-xr-xtests/FunctionalTests/validators/tests/DatePickerTestCase.php2
-rwxr-xr-xtests/FunctionalTests/validators/tests/RequiredFieldTestCase.php2
-rw-r--r--tests/test_tools/PradoGenericSelenium2Test.php49
-rw-r--r--tests/test_tools/PradoGenericSeleniumTest.php25
-rw-r--r--tests/test_tools/phpunit_bootstrap.php3
7 files changed, 60 insertions, 34 deletions
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php
index c8fcfa57..880c46fe 100755
--- a/tests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php
+++ b/tests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php
@@ -1,13 +1,13 @@
<?php
-class ActiveButtonTestCase extends PradoGenericSeleniumTest
+class ActiveButtonTestCase extends PradoGenericSelenium2Test
{
function test()
{
$this->open("active-controls/index.php?page=ActiveButtonTest");
$this->verifyTextPresent("TActiveButton Functional Test");
$this->assertText("label1", "Label 1");
- $this->click("button2");
+ $this->clickOnElement("button2");
$this->pause(800);
$this->assertText("label1", "Button 1 was clicked using callback!");
}
diff --git a/tests/FunctionalTests/tickets/tests/Ticket656TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket656TestCase.php
index ff167b0e..9fe238b9 100755
--- a/tests/FunctionalTests/tickets/tests/Ticket656TestCase.php
+++ b/tests/FunctionalTests/tickets/tests/Ticket656TestCase.php
@@ -6,19 +6,20 @@ class Ticket656TestCase extends PradoGenericSeleniumTest
$base = 'ctl0_Content_';
$this->open('tickets/index.php?page=Ticket656');
$this->assertTitle("Verifying Ticket 656");
-
+
// First test, current date
$this->click($base."btnUpdate");
$this->pause(800);
$this->assertText($base."lblStatus",date("d-m-Y"));
-
+
// Then, set another date
+ $year=date('Y')-2;
$this->select($base."datePicker_day",20);
$this->select($base."datePicker_month", 10);
- $this->select($base."datePicker_year", 2008);
+ $this->select($base."datePicker_year", $year);
$this->click($base."btnUpdate");
$this->pause(800);
- $this->assertText($base."lblStatus",date("d-m-Y", mktime(0,0,0,10,20,2008)));
+ $this->assertText($base."lblStatus",date("d-m-Y", mktime(0,0,0,10,20,$year)));
}
} \ No newline at end of file
diff --git a/tests/FunctionalTests/validators/tests/DatePickerTestCase.php b/tests/FunctionalTests/validators/tests/DatePickerTestCase.php
index ab37ec06..bbefd2a7 100755
--- a/tests/FunctionalTests/validators/tests/DatePickerTestCase.php
+++ b/tests/FunctionalTests/validators/tests/DatePickerTestCase.php
@@ -28,8 +28,6 @@ class DatePickerTestCase extends PradoGenericSeleniumTest
$this->assertNotVisible("{$base}validator6", "");
$this->assertVisible("{$base}validator8", "");
- $this->clickAndWait("{$base}submit1");
-
$this->type("{$base}picker1", "13/4/$year");
$this->select("{$base}picker2_month", "label=9");
$this->select("{$base}picker2_day", "label=10");
diff --git a/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php b/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php
index f8b54eb0..8ee278f8 100755
--- a/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php
+++ b/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php
@@ -48,7 +48,7 @@ class RequiredFieldTestCase extends PradoGenericSeleniumTest
$this->type("{$base}text1", "Hello");
$this->click("{$base}check1");
- $this->click("{$base}submit2");
+ $this->clickAndWait("{$base}submit2");
$this->assertNotVisible("{$base}validator5");
$this->assertNotVisible("{$base}validator6");
diff --git a/tests/test_tools/PradoGenericSelenium2Test.php b/tests/test_tools/PradoGenericSelenium2Test.php
new file mode 100644
index 00000000..66350e11
--- /dev/null
+++ b/tests/test_tools/PradoGenericSelenium2Test.php
@@ -0,0 +1,49 @@
+<?php
+require_once 'PHPUnit/Extensions/Selenium2TestCase.php';
+
+// TODO: stub
+class PradoGenericSelenium2Test extends PHPUnit_Extensions_Selenium2TestCase
+{
+ static $browser='chrome';
+ static $baseurl='http://127.0.0.1/prado-3.2/tests/FunctionalTests/';
+ static $timeout=5; //seconds
+ static $wait=1000; //msecs
+
+ protected function setUp()
+ {
+ $this->setBrowser(static::$browser);
+ $this->setBrowserUrl(static::$baseurl);
+ $this->setSeleniumServerRequestsTimeout(static::$timeout);
+ }
+
+ public function setUpPage()
+ {
+ $this->timeouts()->implicitWait(static::$wait);
+ }
+
+ protected function open($url)
+ {
+ $this->url($url);
+ }
+
+ protected function tearDown()
+ {
+ }
+
+ protected function verifyTextPresent($txt)
+ {
+ $this->assertContains($txt, $this->source());
+ }
+
+ protected function assertText($id, $txt)
+ {
+ $element = $this->byId($id);
+ $this->assertEquals($txt, $element->text());
+ }
+
+ protected function pause($msec)
+ {
+ usleep($msec*1000);
+ }
+
+} \ No newline at end of file
diff --git a/tests/test_tools/PradoGenericSeleniumTest.php b/tests/test_tools/PradoGenericSeleniumTest.php
index 2c9ceb21..9a60f95a 100644
--- a/tests/test_tools/PradoGenericSeleniumTest.php
+++ b/tests/test_tools/PradoGenericSeleniumTest.php
@@ -1,7 +1,6 @@
<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
-require_once 'PHPUnit/Extensions/Selenium2TestCase.php';
-
+
class PradoGenericSeleniumTest extends PHPUnit_Extensions_SeleniumTestCase
{
static $browser='*googlechrome';
@@ -17,26 +16,4 @@ class PradoGenericSeleniumTest extends PHPUnit_Extensions_SeleniumTestCase
protected function tearDown()
{
}
-}
-
-// TODO: stub
-class PradoGenericSelenium2Test extends PHPUnit_Extensions_Selenium2TestCase
-{
- static $browser='chrome';
- static $baseurl='http://127.0.0.1/prado-3.2/tests/FunctionalTests/';
-
- protected function setUp()
- {
- $this->setBrowser(static::$browser);
- $this->setBrowserUrl(static::$baseurl);
- }
-
- protected function open($url)
- {
- $this->setBrowserUrl(static::$baseurl.$url);
- }
-
- protected function tearDown()
- {
- }
} \ No newline at end of file
diff --git a/tests/test_tools/phpunit_bootstrap.php b/tests/test_tools/phpunit_bootstrap.php
index 1154e5fc..23e25a1c 100644
--- a/tests/test_tools/phpunit_bootstrap.php
+++ b/tests/test_tools/phpunit_bootstrap.php
@@ -22,4 +22,5 @@ if (!@include_once VENDOR_DIR.'/autoload.php') {
require_once(PRADO_FRAMEWORK_DIR.'/prado.php');
// for FunctionalTests
-require_once(__DIR__.'/PradoGenericSeleniumTest.php'); \ No newline at end of file
+require_once(__DIR__.'/PradoGenericSeleniumTest.php');
+require_once(__DIR__.'/PradoGenericSelenium2Test.php'); \ No newline at end of file