From 315064cf9714cd1ae38ed5766a4f00299bd8be08 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 24 Sep 2013 15:10:25 +0200 Subject: Ported some failing functional tests to phpunit+selenium --- .../tests/ActiveDatePickerTestCase.php | 48 +++++++++++----------- .../tests/ActiveDropDownListTestCase.php | 2 +- .../tests/ActiveListBoxMasterTestCase.php | 12 +++--- .../tests/ActiveListBoxTestCase.php | 12 +++--- tests/test_tools/PradoGenericSeleniumTest.php | 30 +++++++++++++- tests/unit/Caching/temp/.gitignore | 2 + 6 files changed, 67 insertions(+), 39 deletions(-) (limited to 'tests') diff --git a/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php index 769dd356..be0a6fb4 100755 --- a/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php @@ -39,39 +39,39 @@ class ActiveDatePickerTestCase extends PradoGenericSeleniumTest $this->click("todayButton"); $this->pause(800); - $this->verifySelected("datepicker_month", date('m')); + $this->assertSelected("datepicker_month", date('m')); $this->verifyText("status", date('m-d-Y')); $this->click("increaseButton"); $this->pause(800); $dateToCheck=strtotime('+ 1 day'); - $this->verifySelected("datepicker_month", date('m', $dateToCheck)); - $this->verifySelected("datepicker_day", date('d', $dateToCheck)); - $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->assertSelected("datepicker_month", date('m', $dateToCheck)); + $this->assertSelected("datepicker_day", date('d', $dateToCheck)); + $this->assertSelected("datepicker_year", date('Y', $dateToCheck)); $this->verifyText("status", date('m-d-Y', $dateToCheck)); $this->click("increaseButton"); $this->pause(800); $dateToCheck=strtotime('+ 2 day'); - $this->verifySelected("datepicker_month", date('m', $dateToCheck)); - $this->verifySelected("datepicker_day", date('d', $dateToCheck)); - $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->assertSelected("datepicker_month", date('m', $dateToCheck)); + $this->assertSelected("datepicker_day", date('d', $dateToCheck)); + $this->assertSelected("datepicker_year", date('Y', $dateToCheck)); $this->verifyText("status", date('m-d-Y', $dateToCheck)); $this->click("todayButton"); $this->pause(800); $dateToCheck=time(); - $this->verifySelected("datepicker_month", date('m', $dateToCheck)); - $this->verifySelected("datepicker_day", date('d', $dateToCheck)); - $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->assertSelected("datepicker_month", date('m', $dateToCheck)); + $this->assertSelected("datepicker_day", date('d', $dateToCheck)); + $this->assertSelected("datepicker_year", date('Y', $dateToCheck)); $this->verifyText("status", date('m-d-Y', $dateToCheck)); $this->click("decreaseButton"); $this->pause(800); $dateToCheck=strtotime('- 1 day'); - $this->verifySelected("datepicker_month", date('m', $dateToCheck)); - $this->verifySelected("datepicker_day", date('d', $dateToCheck)); - $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->assertSelected("datepicker_month", date('m', $dateToCheck)); + $this->assertSelected("datepicker_day", date('d', $dateToCheck)); + $this->assertSelected("datepicker_year", date('Y', $dateToCheck)); $this->verifyText("status", date('m-d-Y', $dateToCheck)); $this->click("datepickerbutton"); @@ -79,17 +79,17 @@ class ActiveDatePickerTestCase extends PradoGenericSeleniumTest $this->click("css=input.todayButton"); $this->pause(800); $dateToCheck=time(); - $this->verifySelected("datepicker_month", date('m', $dateToCheck)); - $this->verifySelected("datepicker_day", date('d', $dateToCheck)); - $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->assertSelected("datepicker_month", date('m', $dateToCheck)); + $this->assertSelected("datepicker_day", date('d', $dateToCheck)); + $this->assertSelected("datepicker_year", date('Y', $dateToCheck)); $this->verifyText("status", date('m-d-Y', $dateToCheck)); $this->click("css=input.nextMonthButton"); $this->pause(800); $dateToCheck=strtotime('+ 1 month'); - $this->verifySelected("datepicker_month", date('m', $dateToCheck)); - $this->verifySelected("datepicker_day", date('d', $dateToCheck)); - $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->assertSelected("datepicker_month", date('m', $dateToCheck)); + $this->assertSelected("datepicker_day", date('d', $dateToCheck)); + $this->assertSelected("datepicker_year", date('Y', $dateToCheck)); $this->verifyText("status", date('m-d-Y', $dateToCheck)); $this->click('ctl1'); @@ -97,9 +97,9 @@ class ActiveDatePickerTestCase extends PradoGenericSeleniumTest $this->verifyText("status2", ""); $dateToCheck=time(); - $this->verifySelected("datepicker2_month", date('m', $dateToCheck)); - $this->verifySelected("datepicker2_day", date('d', $dateToCheck)); - $this->verifySelected("datepicker2_year", date('Y', $dateToCheck)); + $this->assertSelected("datepicker2_month", date('m', $dateToCheck)); + $this->assertSelected("datepicker2_day", date('d', $dateToCheck)); + $this->assertSelected("datepicker2_year", date('Y', $dateToCheck)); $this->select("datepicker2_year", date('Y')+1); $this->pause(800); $dateToCheck=mktime(0,0,0,(int)date('m'),(int)date('d'), date('Y')+1); @@ -108,8 +108,8 @@ class ActiveDatePickerTestCase extends PradoGenericSeleniumTest $this->verifyText("status3", ""); $dateToCheck=time(); - $this->verifySelected("datepicker3_month", date('F', $dateToCheck)); - $this->verifySelected("datepicker3_year", date('Y', $dateToCheck)); + $this->assertSelected("datepicker3_month", date('F', $dateToCheck)); + $this->assertSelected("datepicker3_year", date('Y', $dateToCheck)); $this->select("datepicker3_year", date('Y')+1); $this->pause(800); $dateToCheck=mktime(0,0,0,(int)date('m'),(int)date('d'), date('Y')+1); diff --git a/tests/FunctionalTests/active-controls/tests/ActiveDropDownListTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveDropDownListTestCase.php index d365c784..a54cbd75 100755 --- a/tests/FunctionalTests/active-controls/tests/ActiveDropDownListTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveDropDownListTestCase.php @@ -15,7 +15,7 @@ class ActiveDropDownListTestCase extends PradoGenericSeleniumTest $this->click("button2"); $this->pause(800); - $this->assertEmptySelection("list1"); + $this->assertSelectedIndex("list1", 0); $this->click("button3"); $this->pause(800); diff --git a/tests/FunctionalTests/active-controls/tests/ActiveListBoxMasterTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveListBoxMasterTestCase.php index 555d9b25..911e3cc7 100755 --- a/tests/FunctionalTests/active-controls/tests/ActiveListBoxMasterTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveListBoxMasterTestCase.php @@ -13,29 +13,29 @@ class ActiveListBoxMasterTestCase extends PradoGenericSeleniumTest $this->click($base."button1"); $this->pause(800); - $this->assertSelectedIndexes($base.'list1', '1,2,3'); + $this->assertEquals($this->getSelectedLabels($base.'list1'), array('item 2', 'item 3', 'item 4')); $this->click($base.'button3'); $this->pause(800); - $this->assertSelectedIndexes($base.'list1', '0'); + $this->assertEquals($this->getSelectedLabels($base.'list1'), array('item 1')); $this->click($base.'button4'); $this->pause(800); - $this->assertSelectedIndexes($base.'list1', '4'); + $this->assertEquals($this->getSelectedLabels($base.'list1'), array('item 5')); $this->click($base.'button5'); $this->pause(800); - $this->assertSelectedIndexes($base.'list1', '1,4'); + $this->assertEquals($this->getSelectedLabels($base.'list1'), array('item 2', 'item 5')); $this->click($base.'button2'); $this->pause(800); - $this->assertEmptySelection($base."list1"); + $this->assertNotSomethingSelected($base."list1"); $this->click($base.'button6'); $this->pause(800); $this->click($base."button1"); $this->pause(800); - $this->assertSelectedIndexes($base.'list1', '1,2,3'); + $this->assertEquals($this->getSelectedLabels($base.'list1'), array('item 2', 'item 3', 'item 4')); $this->select($base."list1", "item 1"); $this->pause(800); diff --git a/tests/FunctionalTests/active-controls/tests/ActiveListBoxTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveListBoxTestCase.php index 9976211b..d45cb42c 100755 --- a/tests/FunctionalTests/active-controls/tests/ActiveListBoxTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveListBoxTestCase.php @@ -11,29 +11,29 @@ class ActiveListBoxTestCase extends PradoGenericSeleniumTest $this->click("button1"); $this->pause(800); - $this->assertSelectedIndexes('list1', '1,2,3'); + $this->assertEquals($this->getSelectedLabels('list1'), array('item 2', 'item 3', 'item 4')); $this->click('button3'); $this->pause(800); - $this->assertSelectedIndexes('list1', '0'); + $this->assertEquals($this->getSelectedLabels('list1'), array('item 1')); $this->click('button4'); $this->pause(800); - $this->assertSelectedIndexes('list1', '4'); + $this->assertEquals($this->getSelectedLabels('list1'), array('item 5')); $this->click('button5'); $this->pause(800); - $this->assertSelectedIndexes('list1', '1,4'); + $this->assertEquals($this->getSelectedLabels('list1'), array('item 2', 'item 5')); $this->click('button2'); $this->pause(800); - $this->assertEmptySelection("list1"); + $this->assertNotSomethingSelected("list1"); $this->click('button6'); $this->pause(800); $this->click("button1"); $this->pause(800); - $this->assertSelectedIndexes('list1', '1,2,3'); + $this->assertEquals($this->getSelectedLabels('list1'), array('item 2', 'item 3', 'item 4')); $this->select("list1", "item 1"); $this->pause(800); diff --git a/tests/test_tools/PradoGenericSeleniumTest.php b/tests/test_tools/PradoGenericSeleniumTest.php index 547ff2f0..922b9d87 100644 --- a/tests/test_tools/PradoGenericSeleniumTest.php +++ b/tests/test_tools/PradoGenericSeleniumTest.php @@ -1,12 +1,38 @@ setBrowser(static::$browser); + $this->setBrowserUrl(static::$baseurl); + } + + 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('*googlechrome'); - $this->setBrowserUrl('http://127.0.0.1/prado-3.2/tests/FunctionalTests/'); + $this->setBrowser(static::$browser); + $this->setBrowserUrl(static::$baseurl); + } + + protected function open($url) + { + $this->setBrowserUrl(static::$baseurl.$url); } protected function tearDown() diff --git a/tests/unit/Caching/temp/.gitignore b/tests/unit/Caching/temp/.gitignore index e69de29b..d6b7ef32 100644 --- a/tests/unit/Caching/temp/.gitignore +++ b/tests/unit/Caching/temp/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore -- cgit v1.2.3