diff options
Diffstat (limited to 'tests/FunctionalTests/quickstart')
43 files changed, 930 insertions, 920 deletions
diff --git a/tests/FunctionalTests/quickstart/ActiveControls/ActiveButtonTestCase.php b/tests/FunctionalTests/quickstart/ActiveControls/ActiveButtonTestCase.php index 03861440..9d816978 100755 --- a/tests/FunctionalTests/quickstart/ActiveControls/ActiveButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/ActiveControls/ActiveButtonTestCase.php @@ -1,36 +1,36 @@ <?php //$Id: ActiveButtonTestCase.php 3187 2012-07-12 11:21:01Z ctrlaltca $ -class QuickstartActiveButtonTestCase extends PradoGenericSeleniumTest +class QuickstartActiveButtonTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=ActiveControls.Samples.TActiveButton.Home&notheme=true&lang=en"); + $this->url("../../demos/quickstart/index.php?page=ActiveControls.Samples.TActiveButton.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); - $this->assertTextPresent('TActiveButton Samples (AJAX)'); + $this->assertContains('TActiveButton Samples (AJAX)', $this->source()); // a click button - $this->verifyElementNotPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); - $this->click("//input[@type='submit' and @value='click me']", ""); + $this->assertElementNotPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); + $this->byXPath("//input[@type='submit' and @value='click me']")->click(); $this->pause(800); - $this->verifyElementPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); + $this->assertElementPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); // a command button - $this->verifyElementNotPresent("//input[@type='submit' and @value=\"Name: test, Param: value using callback\"]"); - $this->click("//input[@type='submit' and @value='click me']", ""); + $this->assertElementNotPresent("//input[@type='submit' and @value=\"Name: test, Param: value using callback\"]"); + $this->byXPath("//input[@type='submit' and @value='click me']")->click(); $this->pause(800); - $this->verifyElementPresent("//input[@type='submit' and @value=\"Name: test, Param: value using callback\"]"); + $this->assertElementPresent("//input[@type='submit' and @value=\"Name: test, Param: value using callback\"]"); // a button causing validation - $this->verifyNotVisible('ctl0_body_ctl2'); - $this->click("//input[@type='submit' and @value='submit']", ""); + $this->assertNotVisible('ctl0_body_ctl2'); + $this->byXPath("//input[@type='submit' and @value='submit']")->click(); $this->pause(800); - $this->verifyVisible('ctl0_body_ctl2'); + $this->assertVisible('ctl0_body_ctl2'); $this->type("ctl0\$body\$TextBox", "test"); - $this->click("//input[@type='submit' and @value='submit']", ""); + $this->byXPath("//input[@type='submit' and @value='submit']")->click(); $this->pause(800); - $this->verifyNotVisible('ctl0_body_ctl2'); - $this->verifyElementPresent("//input[@type='submit' and @value=\"I'm clicked using callback\"]", ""); + $this->assertNotVisible('ctl0_body_ctl2'); + $this->assertElementPresent("//input[@type='submit' and @value=\"I'm clicked using callback\"]", ""); } } diff --git a/tests/FunctionalTests/quickstart/ActiveControls/ActiveCheckBoxTestCase.php b/tests/FunctionalTests/quickstart/ActiveControls/ActiveCheckBoxTestCase.php index 257917ec..9e537abd 100755 --- a/tests/FunctionalTests/quickstart/ActiveControls/ActiveCheckBoxTestCase.php +++ b/tests/FunctionalTests/quickstart/ActiveControls/ActiveCheckBoxTestCase.php @@ -1,58 +1,57 @@ <?php //$Id: ActiveCheckBoxTestCase.php 3187 2012-07-12 11:21:01Z ctrlaltca $ -class QuickstartActiveCheckBoxTestCase extends PradoGenericSeleniumTest +class QuickstartActiveCheckBoxTestCase extends PradoGenericSelenium2Test { function test () { - $this->setSpeed(500); - $this->open("../../demos/quickstart/index.php?page=ActiveControls.Samples.TActiveCheckBox.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=ActiveControls.Samples.TActiveCheckBox.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); - $this->assertTextPresent('TActiveCheckBox Samples (AJAX)'); + $this->assertContains('TActiveCheckBox Samples (AJAX)', $this->source()); // an auto postback checkbox - $this->verifyTextNotPresent("ctl0_body_ctl0 clicked using callback"); - $this->click("//input[@name='ctl0\$body\$ctl0']"); + $this->assertNotContains("ctl0_body_ctl0 clicked using callback", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$ctl0']")->click(); $this->pause(800); - $this->assertChecked("//input[@name='ctl0\$body\$ctl0']"); - $this->verifyTextPresent("ctl0_body_ctl0 clicked using callback"); - $this->click("//input[@name='ctl0\$body\$ctl0']"); + $this->assertTrue($this->byXPath("//input[@name='ctl0\$body\$ctl0']")->selected()); + $this->assertContains("ctl0_body_ctl0 clicked using callback", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$ctl0']")->click(); $this->pause(800); - $this->verifyTextPresent("ctl0_body_ctl0 clicked using callback"); - $this->assertNotChecked("//input[@name='ctl0\$body\$ctl0']"); + $this->assertContains("ctl0_body_ctl0 clicked using callback", $this->source()); + $this->assertFalse($this->byXPath("//input[@name='ctl0\$body\$ctl0']")->selected()); // a checkbox causing validation on a textbox - $this->verifyNotVisible('ctl0_body_ctl1'); - $this->click("//input[@name='ctl0\$body\$ctl2']"); - $this->verifyVisible('ctl0_body_ctl1'); - $this->click("//input[@name='ctl0\$body\$ctl2']", ""); - $this->verifyVisible('ctl0_body_ctl3'); + $this->assertNotVisible('ctl0_body_ctl1'); + $this->byXPath("//input[@name='ctl0\$body\$ctl2']")->click(); + $this->assertVisible('ctl0_body_ctl1'); + $this->byXPath("//input[@name='ctl0\$body\$ctl2']")->click(); + $this->assertVisible('ctl0_body_ctl3'); $this->type("ctl0\$body\$TextBox", "test"); - $this->click("//input[@name='ctl0\$body\$ctl2']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl2']")->click(); $this->pause(800); - $this->verifyNotVisible('ctl0_body_ctl1'); - $this->assertTextPresent("ctl0_body_ctl2 clicked using callback"); + $this->assertNotVisible('ctl0_body_ctl1'); + $this->assertContains("ctl0_body_ctl2 clicked using callback", $this->source()); // a checkbox validated by a required field validator - $this->assertNotChecked("//input[@name='ctl0\$body\$CheckBox']"); - $this->verifyNotVisible('ctl0_body_ctl4'); - $this->click("//input[@type='submit' and @value='Submit']", ""); - $this->verifyVisible('ctl0_body_ctl4'); - $this->click("//input[@name='ctl0\$body\$CheckBox']", ""); - $this->assertChecked("//input[@name='ctl0\$body\$CheckBox']"); - $this->click("//input[@type='submit' and @value='Submit']", ""); - $this->verifyNotVisible('ctl0_body_ctl4'); - $this->assertTextPresent("ctl0_body_CheckBox clicked"); + $this->assertFalse($this->byXPath("//input[@name='ctl0\$body\$CheckBox']")->selected()); + $this->assertNotVisible('ctl0_body_ctl4'); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertVisible('ctl0_body_ctl4'); + $this->byXPath("//input[@name='ctl0\$body\$CheckBox']")->click(); + $this->assertTrue($this->byXPath("//input[@name='ctl0\$body\$CheckBox']")->selected()); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->pause(800); + $this->assertNotVisible('ctl0_body_ctl4'); + $this->assertContains("ctl0_body_CheckBox clicked", $this->source()); // a checkbox validated by a required field validator using AutoPostBack - $this->assertChecked("//input[@name='ctl0\$body\$CheckBox2']"); - $this->verifyNotVisible('ctl0_body_ctl5'); - $this->click("//input[@name='ctl0\$body\$CheckBox2']", ""); - $this->verifyVisible('ctl0_body_ctl5'); - $this->assertChecked("//input[@name='ctl0\$body\$CheckBox2']"); - $this->setSpeed(0); + $this->assertTrue($this->byXPath("//input[@name='ctl0\$body\$CheckBox2']")->selected()); + $this->assertNotVisible('ctl0_body_ctl5'); + $this->byXPath("//input[@name='ctl0\$body\$CheckBox2']")->click(); + $this->assertVisible('ctl0_body_ctl5'); + $this->assertTrue($this->byXPath("//input[@name='ctl0\$body\$CheckBox2']")->selected()); } } diff --git a/tests/FunctionalTests/quickstart/ActiveControls/ActiveCustomValidatorTestCase.php b/tests/FunctionalTests/quickstart/ActiveControls/ActiveCustomValidatorTestCase.php index 967842b0..7cb29382 100755 --- a/tests/FunctionalTests/quickstart/ActiveControls/ActiveCustomValidatorTestCase.php +++ b/tests/FunctionalTests/quickstart/ActiveControls/ActiveCustomValidatorTestCase.php @@ -1,19 +1,19 @@ <?php //$Id: ActiveButtonTestCase.php 1405 2006-09-10 01:03:56Z wei $ -class QuickstartActiveCustomValidatorTestCase extends PradoGenericSeleniumTest +class QuickstartActiveCustomValidatorTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=ActiveControls.Samples.TActiveCustomValidator.Home&notheme=true&lang=en"); + $this->url("../../demos/quickstart/index.php?page=ActiveControls.Samples.TActiveCustomValidator.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); - $this->assertTextPresent('TActiveCustomValidator Samples (AJAX)'); + $this->assertContains('TActiveCustomValidator Samples (AJAX)', $this->source()); $base = 'ctl0_body_'; $this->assertNotVisible($base.'validator1'); - $this->click($base.'button1'); + $this->byId($base.'button1')->click(); $this->pause(800); $this->assertVisible($base.'validator1'); @@ -25,7 +25,7 @@ class QuickstartActiveCustomValidatorTestCase extends PradoGenericSeleniumTest $this->pause(800); $this->assertVisible($base.'validator1'); - $this->click($base.'button1'); + $this->byId($base.'button1')->click(); $this->pause(800); $this->assertNotVisible($base.'validator1'); } diff --git a/tests/FunctionalTests/quickstart/Advanced/I18N.php b/tests/FunctionalTests/quickstart/Advanced/I18N.php index 726501ce..ccb8c961 100755 --- a/tests/FunctionalTests/quickstart/Advanced/I18N.php +++ b/tests/FunctionalTests/quickstart/Advanced/I18N.php @@ -1,52 +1,52 @@ <?php //New Test -class QuickstartI18NTestCase extends PradoGenericSeleniumTest +class QuickstartI18NTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?notheme=true&page=Advanced.Samples.I18N.Home&lang=en&notheme=true", ""); - $this->verifyTextPresent("Internationlization in PRADO", ""); - $this->verifyTextPresent("46.412,42 €", ""); - $this->verifyTextPresent("$12.40", ""); - $this->verifyTextPresent("€100.00", ""); - $this->verifyTextPresent("December 6, 2004", ""); - $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=zh&notheme=true", ""); - $this->verifyTextPresent("PRADO 国际化", ""); - $this->verifyTextPresent("2004 十二月", ""); - $this->verifyTextPresent("US$ 12.40", ""); - $this->verifyTextPresent("46.412,42 €", ""); - $this->verifyTextPresent("€100.00 ", ""); - $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=zh_TW&notheme=true", ""); - $this->verifyTextPresent("PRADO 國際化", ""); - $this->verifyTextPresent("2004年12月6日", ""); - $this->verifyTextPresent("US$12.40", ""); - $this->verifyTextPresent("46.412,42 €", ""); - $this->verifyTextPresent("€100.00", ""); - $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=de&notheme=true", ""); - $this->verifyTextPresent("Internationalisierung in PRADO", ""); - $this->verifyTextPresent("6. Dezember 2004 ", ""); - $this->verifyTextPresent("$ 12,40", ""); - $this->verifyTextPresent("46.412,42 €", ""); - $this->verifyTextPresent("€100.00", ""); - $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=es&notheme=true", ""); - $this->verifyTextPresent("Internationlization en PRADO", ""); - $this->verifyTextPresent("6 de diciembre de 2004", ""); - $this->verifyTextPresent("US$12.40", ""); - $this->verifyTextPresent("46.412,42 €", ""); - $this->verifyTextPresent("€100.00", ""); - $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=fr&notheme=true", ""); - $this->verifyTextPresent("Internationalisation avec PRADO", ""); - $this->verifyTextPresent("6 décembre 2004", ""); - $this->verifyTextPresent("12,40 $", ""); - $this->verifyTextPresent("46.412,42 €", ""); - $this->verifyTextPresent("€100.00", ""); - $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=pl&notheme=true", ""); - $this->verifyTextPresent("Internacjonalizacja w PRADO", ""); - $this->verifyTextPresent("6 grudnia 2004", ""); - $this->verifyTextPresent("US$ 12,40", ""); - $this->verifyTextPresent("46.412,42 €", ""); - $this->verifyTextPresent("€100.00", ""); + $this->url("../../demos/quickstart/index.php?notheme=true&page=Advanced.Samples.I18N.Home&lang=en&notheme=true"); + $this->assertContains("Internationlization in PRADO", $this->source()); + $this->assertContains("46.412,42 €", $this->source()); + $this->assertContains("$12.40", $this->source()); + $this->assertContains("€100.00", $this->source()); + $this->assertContains("December 6, 2004", $this->source()); + $this->url("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=zh&notheme=true"); + $this->assertContains("PRADO 国际化", $this->source()); + $this->assertContains("2004 十二月", $this->source()); + $this->assertContains("US$ 12.40", $this->source()); + $this->assertContains("46.412,42 €", $this->source()); + $this->assertContains("€100.00 ", $this->source()); + $this->url("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=zh_TW&notheme=true"); + $this->assertContains("PRADO 國際化", $this->source()); + $this->assertContains("2004年12月6日", $this->source()); + $this->assertContains("US$12.40", $this->source()); + $this->assertContains("46.412,42 €", $this->source()); + $this->assertContains("€100.00", $this->source()); + $this->url("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=de&notheme=true"); + $this->assertContains("Internationalisierung in PRADO", $this->source()); + $this->assertContains("6. Dezember 2004 ", $this->source()); + $this->assertContains("$ 12,40", $this->source()); + $this->assertContains("46.412,42 €", $this->source()); + $this->assertContains("€100.00", $this->source()); + $this->url("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=es&notheme=true"); + $this->assertContains("Internationlization en PRADO", $this->source()); + $this->assertContains("6 de diciembre de 2004", $this->source()); + $this->assertContains("US$12.40", $this->source()); + $this->assertContains("46.412,42 €", $this->source()); + $this->assertContains("€100.00", $this->source()); + $this->url("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=fr&notheme=true"); + $this->assertContains("Internationalisation avec PRADO", $this->source()); + $this->assertContains("6 décembre 2004", $this->source()); + $this->assertContains("12,40 $", $this->source()); + $this->assertContains("46.412,42 €", $this->source()); + $this->assertContains("€100.00", $this->source()); + $this->url("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=pl&notheme=true"); + $this->assertContains("Internacjonalizacja w PRADO", $this->source()); + $this->assertContains("6 grudnia 2004", $this->source()); + $this->assertContains("US$ 12,40", $this->source()); + $this->assertContains("46.412,42 €", $this->source()); + $this->assertContains("€100.00", $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php b/tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php index 0b272428..a23f1d1d 100755 --- a/tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php @@ -1,36 +1,36 @@ <?php -class QuickstartBulletedListTestCase extends PradoGenericSeleniumTest +class QuickstartBulletedListTestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TBulletedList.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TBulletedList.Home&notheme=true&lang=en"); // verify if all required texts are present - $this->verifyTextPresent('item 1',''); - $this->verifyTextPresent('item 2',''); - $this->verifyTextPresent('item 3',''); - $this->verifyTextPresent('item 4',''); - $this->verifyTextPresent('google',''); - $this->verifyTextPresent('yahoo',''); - $this->verifyTextPresent('amazon',''); + $this->assertContains('item 1', $this->source()); + $this->assertContains('item 2', $this->source()); + $this->assertContains('item 3', $this->source()); + $this->assertContains('item 4', $this->source()); + $this->assertContains('google', $this->source()); + $this->assertContains('yahoo', $this->source()); + $this->assertContains('amazon', $this->source()); // verify order list starting from 5 - $this->verifyElementPresent("//ol[@start='5']"); + $this->assertElementPresent("//ol[@start='5']"); // unable to verify styles // verify hyperlink list - $this->verifyElementPresent("//a[@href='http://www.google.com/']"); - $this->verifyElementPresent("//a[@href='http://www.yahoo.com/']"); - $this->verifyElementPresent("//a[@href='http://www.amazon.com/']"); + $this->assertElementPresent("//a[@href='http://www.google.com/']"); + $this->assertElementPresent("//a[@href='http://www.yahoo.com/']"); + $this->assertElementPresent("//a[@href='http://www.amazon.com/']"); // verify linkbutton list - $this->clickAndWait("id=ctl0_body_ctl40", ""); - $this->verifyTextPresent("You clicked google : http://www.google.com/.", ""); - $this->clickAndWait("id=ctl0_body_ctl41", ""); - $this->verifyTextPresent("You clicked yahoo : http://www.yahoo.com/.", ""); - $this->clickAndWait("id=ctl0_body_ctl42", ""); - $this->verifyTextPresent("You clicked amazon : http://www.amazon.com/.", ""); + $this->byId("ctl0_body_ctl40")->click(); + $this->assertContains("You clicked google : http://www.google.com/.", $this->source()); + $this->byId("ctl0_body_ctl41")->click(); + $this->assertContains("You clicked yahoo : http://www.yahoo.com/.", $this->source()); + $this->byId("ctl0_body_ctl42")->click(); + $this->assertContains("You clicked amazon : http://www.amazon.com/.", $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php b/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php index ad84e1d0..f5a4a979 100755 --- a/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php @@ -1,33 +1,33 @@ <?php -class QuickstartButtonTestCase extends PradoGenericSeleniumTest +class QuickstartButtonTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TButton.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TButton.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // a regular button - $this->clickAndWait("//input[@type='submit' and @value='text']", ""); + $this->byXPath("//input[@type='submit' and @value='text']")->click(); // a click button - $this->verifyElementNotPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); - $this->clickAndWait("//input[@type='submit' and @value='click me']", ""); - $this->verifyElementPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); + $this->assertElementNotPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); + $this->byXPath("//input[@type='submit' and @value='click me']")->click(); + $this->assertElementPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); // a command button - $this->verifyElementNotPresent("//input[@type='submit' and @value=\"Name: test, Param: value\"]"); - $this->clickAndWait("//input[@type='submit' and @value='click me']", ""); - $this->verifyElementPresent("//input[@type='submit' and @value=\"Name: test, Param: value\"]"); + $this->assertElementNotPresent("//input[@type='submit' and @value=\"Name: test, Param: value\"]"); + $this->byXPath("//input[@type='submit' and @value='click me']")->click(); + $this->assertElementPresent("//input[@type='submit' and @value=\"Name: test, Param: value\"]"); // a button causing validation - $this->verifyNotVisible('ctl0_body_ctl3'); - $this->click("//input[@type='submit' and @value='submit']", ""); + $this->assertNotVisible('ctl0_body_ctl3'); + $this->byXPath("//input[@type='submit' and @value='submit']")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl3'); + $this->assertVisible('ctl0_body_ctl3'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@type='submit' and @value='submit']", ""); - $this->verifyNotVisible('ctl0_body_ctl3'); + $this->byXPath("//input[@type='submit' and @value='submit']")->click(); + $this->assertNotVisible('ctl0_body_ctl3'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php b/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php index 242bc815..781701cf 100755 --- a/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php @@ -1,17 +1,17 @@ <?php //New Test -class QuickstartCheckBoxListTestCase extends PradoGenericSeleniumTest +class QuickstartCheckBoxListTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TCheckBoxList.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TCheckBoxList.Home&notheme=true&lang=en"); // Check box list with default settings: - $this->click("//input[@name='ctl0\$body\$ctl0\$c0' and @value='value 1']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl0\$c0' and @value='value 1']")->click(); // Check box list with customized cellpadding, cellspacing, color and text alignment: - $this->click("//input[@name='ctl0\$body\$ctl1\$c1' and @value='value 2']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl1\$c1' and @value='value 2']")->click(); // *** Currently unable to test the following cases: // Check box list with vertical (default) repeat direction @@ -20,33 +20,33 @@ class QuickstartCheckBoxListTestCase extends PradoGenericSeleniumTest // Check box list with flow layout and horizontal repeat direction: // Check box list's behavior upon postback - $this->click("//input[@name='ctl0\$body\$CheckBoxList\$c2' and @value='value 3']", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->verifyTextPresent("Your selection is: (Index: 1, Value: value 2, Text: item 2)(Index: 2, Value: value 3, Text: item 3)(Index: 4, Value: value 5, Text: item 5)", ""); + $this->byXPath("//input[@name='ctl0\$body\$CheckBoxList\$c2' and @value='value 3']")->click(); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertContains("Your selection is: (Index: 1, Value: value 2, Text: item 2)(Index: 2, Value: value 3, Text: item 3)(Index: 4, Value: value 5, Text: item 5)", $this->source()); // Auto postback check box list - $this->clickAndWait("//input[@name='ctl0\$body\$ctl7\$c1' and @value='value 2']", ""); - $this->verifyTextPresent("Your selection is: (Index: 4, Value: value 5, Text: item 5)", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl7\$c1' and @value='value 2']")->click(); + $this->assertContains("Your selection is: (Index: 4, Value: value 5, Text: item 5)", $this->source()); // Databind to an integer-indexed array - $this->clickAndWait("//input[@name='ctl0\$body\$DBCheckBoxList1\$c1' and @value='1']", ""); - $this->verifyTextPresent("Your selection is: (Index: 1, Value: 1, Text: item 2)", ""); + $this->byXPath("//input[@name='ctl0\$body\$DBCheckBoxList1\$c1' and @value='1']")->click(); + $this->assertContains("Your selection is: (Index: 1, Value: 1, Text: item 2)", $this->source()); // Databind to an associative array: - $this->clickAndWait("//input[@name='ctl0\$body\$DBCheckBoxList2\$c1' and @value='key 2']", ""); - $this->verifyTextPresent("Your selection is: (Index: 1, Value: key 2, Text: item 2)", ""); + $this->byXPath("//input[@name='ctl0\$body\$DBCheckBoxList2\$c1' and @value='key 2']")->click(); + $this->assertContains("Your selection is: (Index: 1, Value: key 2, Text: item 2)", $this->source()); // Databind with DataTextField and DataValueField specified - $this->clickAndWait("//input[@name='ctl0\$body\$DBCheckBoxList3\$c2' and @value='003']", ""); - $this->verifyTextPresent("Your selection is: (Index: 2, Value: 003, Text: Cary)", ""); + $this->byXPath("//input[@name='ctl0\$body\$DBCheckBoxList3\$c2' and @value='003']")->click(); + $this->assertContains("Your selection is: (Index: 2, Value: 003, Text: Cary)", $this->source()); // CheckBox list causing validation - $this->verifyNotVisible('ctl0_body_ctl8'); - $this->click("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']", ""); + $this->assertNotVisible('ctl0_body_ctl8'); + $this->byXPath("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl8'); + $this->assertVisible('ctl0_body_ctl8'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']", ""); - $this->verifyNotVisible('ctl0_body_ctl8'); + $this->byXPath("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']")->click(); + $this->assertNotVisible('ctl0_body_ctl8'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php b/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php index 57b50dd9..ca89b3a0 100755 --- a/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php @@ -1,53 +1,53 @@ <?php -class QuickstartCheckBoxTestCase extends PradoGenericSeleniumTest +class QuickstartCheckBoxTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TCheckBox.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TCheckBox.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // a regular checkbox - $this->click("//input[@name='ctl0\$body\$ctl0']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl0']")->click(); // a checkbox with customized value - $this->click("//input[@name='ctl0\$body\$ctl1' and @value='value']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl1' and @value='value']")->click(); // an auto postback checkbox - $this->verifyTextNotPresent("I'm clicked"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl2']", ""); - $this->verifyTextPresent("I'm clicked"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl2']", ""); - $this->verifyTextPresent("I'm clicked"); + $this->assertNotContains("I'm clicked", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$ctl2']")->click(); + $this->assertContains("I'm clicked", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$ctl2']")->click(); + $this->assertContains("I'm clicked", $this->source()); // a checkbox causing validation on a textbox - $this->verifyNotVisible('ctl0_body_ctl3'); - $this->click("//input[@name='ctl0\$body\$ctl4']", ""); + $this->assertNotVisible('ctl0_body_ctl3'); + $this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl3'); - $this->click("//input[@name='ctl0\$body\$ctl4']", ""); + $this->assertVisible('ctl0_body_ctl3'); + $this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl3'); + $this->assertVisible('ctl0_body_ctl3'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl4']", ""); - $this->verifyNotVisible('ctl0_body_ctl3'); + $this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click(); + $this->assertNotVisible('ctl0_body_ctl3'); // a checkbox validated by a required field validator - $this->verifyNotVisible('ctl0_body_ctl6'); - $this->click("//input[@type='submit' and @value='Submit']", ""); + $this->assertNotVisible('ctl0_body_ctl6'); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl6'); - $this->click("//input[@name='ctl0\$body\$CheckBox']", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->verifyNotVisible('ctl0_body_ctl6'); + $this->assertVisible('ctl0_body_ctl6'); + $this->byXPath("//input[@name='ctl0\$body\$CheckBox']")->click(); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertNotVisible('ctl0_body_ctl6'); // a checkbox validated by a required field validator using AutoPostBack - $this->verifyNotVisible('ctl0_body_ctl7'); - $this->click("//input[@name='ctl0\$body\$CheckBox2']", ""); + $this->assertNotVisible('ctl0_body_ctl7'); + $this->byXPath("//input[@name='ctl0\$body\$CheckBox2']")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl7'); -// $this->clickAndWait("//input[@name='ctl0\$body\$CheckBox2' and @value='ctl0\$body\$CheckBox2']", ""); -// $this->verifyNotVisible('ctl0_body_ctl7'); + $this->assertVisible('ctl0_body_ctl7'); +// $this->byXPath("//input[@name='ctl0\$body\$CheckBox2' and @value='ctl0\$body\$CheckBox2']")->click(); +// $this->assertNotVisible('ctl0_body_ctl7'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php index 57ee92ae..4f4ca60a 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php @@ -1,29 +1,29 @@ <?php -class QuickstartDataGrid1TestCase extends PradoGenericSeleniumTest +class QuickstartDataGrid1TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample1&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample1&notheme=true&lang=en"); // verify if all required texts are present - $this->verifyTextPresent('id',''); - $this->verifyTextPresent('name',''); - $this->verifyTextPresent('quantity',''); - $this->verifyTextPresent('price',''); - $this->verifyTextPresent('imported',''); - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('Motherboard',''); - $this->verifyTextPresent('100',''); - $this->verifyTextPresent('true',''); - $this->verifyTextPresent('ITN019',''); - $this->verifyTextPresent('Speaker',''); - $this->verifyTextPresent('35',''); - $this->verifyTextPresent('65',''); - $this->verifyTextPresent('false',''); + $this->assertContains('id', $this->source()); + $this->assertContains('name', $this->source()); + $this->assertContains('quantity', $this->source()); + $this->assertContains('price', $this->source()); + $this->assertContains('imported', $this->source()); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('Motherboard', $this->source()); + $this->assertContains('100', $this->source()); + $this->assertContains('true', $this->source()); + $this->assertContains('ITN019', $this->source()); + $this->assertContains('Speaker', $this->source()); + $this->assertContains('35', $this->source()); + $this->assertContains('65', $this->source()); + $this->assertContains('false', $this->source()); // verify specific table tags - $this->verifyElementPresent("ctl0_body_DataGrid"); - $this->verifyAttribute("ctl0_body_DataGrid@cellpadding","2"); + $this->assertElementPresent("ctl0_body_DataGrid"); + $this->assertAttribute("ctl0_body_DataGrid@cellpadding","2"); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php index 7efd69cc..548b04e3 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php @@ -1,49 +1,49 @@ <?php -class QuickstartDataGrid2TestCase extends PradoGenericSeleniumTest +class QuickstartDataGrid2TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample2&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample2&notheme=true&lang=en"); // verify if all required texts are present - $this->verifyTextPresent('Book Title',''); - $this->verifyTextPresent('Publisher',''); - $this->verifyTextPresent('Price',''); - $this->verifyTextPresent('In-stock',''); - $this->verifyTextPresent('Rating',''); + $this->assertContains('Book Title', $this->source()); + $this->assertContains('Publisher', $this->source()); + $this->assertContains('Price', $this->source()); + $this->assertContains('In-stock', $this->source()); + $this->assertContains('Rating', $this->source()); // verify book titles - $this->verifyElementPresent("//a[@href='http://www.amazon.com/gp/product/0596007124' and text()='Head First Design Patterns']",''); - $this->verifyElementPresent("//a[@href='http://www.amazon.com/gp/product/0321278658' and text()='Extreme Programming Explained : Embrace Change']",''); + $this->assertElementPresent("//a[@href='http://www.amazon.com/gp/product/0596007124' and text()='Head First Design Patterns']",''); + $this->assertElementPresent("//a[@href='http://www.amazon.com/gp/product/0321278658' and text()='Extreme Programming Explained : Embrace Change']",''); // verify publishers - $this->verifyTextPresent("O'Reilly Media, Inc.",''); - $this->verifyTextPresent("Addison-Wesley Professional",''); + $this->assertContains("O'Reilly Media, Inc.", $this->source()); + $this->assertContains("Addison-Wesley Professional", $this->source()); // verify prices - $this->verifyTextPresent("\$37.49",''); - $this->verifyTextPresent("\$38.49",''); + $this->assertContains("\$37.49", $this->source()); + $this->assertContains("\$38.49", $this->source()); // verify in-stock - $this->verifyAttribute('ctl0_body_DataGrid_ctl1_ctl5@checked','regexp:true|checked'); - $this->verifyAttribute('ctl0_body_DataGrid_ctl1_ctl5@disabled','regexp:true|disabled'); - $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl5@checked','regexp:true|checked'); - $this->assertEquals($this->getEval('this.browserbot.findElement("ctl0_body_DataGrid_ctl6_ctl5").hasAttribute("checked")'), 'false'); - $this->verifyAttribute('ctl0_body_DataGrid_ctl6_ctl5@disabled','regexp:true|disabled'); + $this->assertAttribute('ctl0_body_DataGrid_ctl1_ctl5@checked','regexp:true|checked'); + $this->assertAttribute('ctl0_body_DataGrid_ctl1_ctl5@disabled','regexp:true|disabled'); + $this->assertAttribute('ctl0_body_DataGrid_ctl2_ctl5@checked','regexp:true|checked'); + $this->assertAttribute('ctl0_body_DataGrid_ctl6_ctl5@checked',null); + $this->assertAttribute('ctl0_body_DataGrid_ctl6_ctl5@disabled','regexp:true|disabled'); // verify ratings - //$this->verifyElementPresent("//img[@src='images/star5.gif']",''); - //$this->verifyElementPresent("//img[@src='images/star2.gif']",''); + //$this->assertElementPresent("//img[@src='images/star5.gif']",''); + //$this->assertElementPresent("//img[@src='images/star2.gif']",''); // verify toggle column visibility - $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Book Title']", ""); - $this->verifyTextNotPresent('Head First Design Patterns',''); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']", ""); - $this->verifyElementNotPresent('ctl0_body_DataGrid_ctl1_ctl5',''); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']", ""); - $this->verifyElementPresent('ctl0_body_DataGrid_ctl1_ctl5',''); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Book Title']", ""); - $this->verifyTextPresent('Head First Design Patterns',''); + $this->byXPath("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Book Title']")->click(); + $this->assertNotContains('Head First Design Patterns', $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']")->click(); + $this->assertElementNotPresent('ctl0_body_DataGrid_ctl1_ctl5',''); + $this->byXPath("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']")->click(); + $this->assertElementPresent('ctl0_body_DataGrid_ctl1_ctl5',''); + $this->byXPath("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Book Title']")->click(); + $this->assertContains('Head First Design Patterns', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php index 2cdace20..e87b9072 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php @@ -1,50 +1,56 @@ <?php -class QuickstartDataGrid3TestCase extends PradoGenericSeleniumTest +class QuickstartDataGrid3TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample3&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample3&notheme=true&lang=en"); // verify the 2nd row of data - $this->verifyTextPresent("Design Patterns: Elements of Reusable Object-Oriented Software", ""); - $this->verifyTextPresent("Addison-Wesley Professional", ""); - $this->verifyTextPresent("$47.04", ""); - $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl4@checked','regexp:true|checked'); - $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl4@disabled','regexp:true|disabled'); - //$this->verifyElementPresent("//img[@src='images/star5.gif']",''); + $this->assertContains("Design Patterns: Elements of Reusable Object-Oriented Software", $this->source()); + $this->assertContains("Addison-Wesley Professional", $this->source()); + $this->assertContains("$47.04", $this->source()); + $this->assertAttribute('ctl0_body_DataGrid_ctl2_ctl4@checked','regexp:true|checked'); + $this->assertAttribute('ctl0_body_DataGrid_ctl2_ctl4@disabled','regexp:true|disabled'); + //$this->assertElementPresent("//img[@src='images/star5.gif']",''); // edit the 2nd row - $this->clickAndWait("id=ctl0_body_DataGrid_ctl2_ctl7", ""); + $this->byId("ctl0_body_DataGrid_ctl2_ctl7")->click(); $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl1", "Design Pattern: Elements of Reusable Object-Oriented Software"); $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl3", "Addison Wesley Professional"); $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl5", "\$57.04"); - $this->click("//input[@name='ctl0\$body\$DataGrid\$ctl2\$ctl7']", ""); - $this->select("ctl0\$body\$DataGrid\$ctl2\$ctl9", "label=1"); - $this->clickAndWait("link=Save", ""); + $this->byXPath("//input[@name='ctl0\$body\$DataGrid\$ctl2\$ctl7']")->click(); + $this->select("ctl0\$body\$DataGrid\$ctl2\$ctl9", "1"); + $this->byLinkText("Save")->click(); // verify the 2nd row is saved - $this->verifyTextPresent("Design Pattern: Elements of Reusable Object-Oriented Software", ""); - $this->verifyTextPresent("Addison Wesley Professional", ""); - $this->verifyTextPresent("$57.04", ""); - $this->assertEquals($this->getEval('this.browserbot.findElement("ctl0_body_DataGrid_ctl2_ctl4").hasAttribute("checked")'), 'false'); - $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl4@disabled','regexp:true|disabled'); - //$this->verifyElementPresent("//img[@src='images/star1.gif']",''); + $this->assertContains("Design Pattern: Elements of Reusable Object-Oriented Software", $this->source()); + $this->assertContains("Addison Wesley Professional", $this->source()); + $this->assertContains("$57.04", $this->source()); + $this->assertAttribute("ctl0_body_DataGrid_ctl2_ctl4@checked", null); + $this->assertAttribute('ctl0_body_DataGrid_ctl2_ctl4@disabled','regexp:true|disabled'); + //$this->assertElementPresent("//img[@src='images/star1.gif']",''); // verify cancel editting the 3rd row - $this->clickAndWait("id=ctl0_body_DataGrid_ctl3_ctl7", ""); - $this->clickAndWait("link=Cancel", ""); - $this->verifyTextPresent("Design Patterns Explained : A New Perspective on Object-Oriented Design", ""); + $this->byId("ctl0_body_DataGrid_ctl3_ctl7")->click(); + $this->byLinkText("Cancel")->click(); + $this->assertContains("Design Patterns Explained : A New Perspective on Object-Oriented Design", $this->source()); // verify deleting - $this->clickAndWait("id=ctl0_body_DataGrid_ctl3_ctl9", ""); - $this->verifyConfirmation("Are you sure?"); - $this->verifyTextNotPresent("Design Patterns Explained : A New Perspective on Object-Oriented Design", ""); - - $this->verifyTextPresent("Extreme Programming Explained : Embrace Change",''); - $this->chooseCancelOnNextConfirmation(); - $this->click("id=ctl0_body_DataGrid_ctl6_ctl9", ""); - $this->verifyConfirmation("Are you sure?"); - $this->verifyTextPresent("Extreme Programming Explained : Embrace Change",''); + $this->byId("ctl0_body_DataGrid_ctl3_ctl9")->click(); + + $this->assertEquals("Are you sure?", $this->alertText()); + $this->acceptAlert(); + + $this->pause(500); + $this->assertNotContains("Design Patterns Explained : A New Perspective on Object-Oriented Design", $this->source()); + + $this->assertContains("Extreme Programming Explained : Embrace Change", $this->source()); + $this->byId("ctl0_body_DataGrid_ctl6_ctl9")->click(); + + $this->assertEquals("Are you sure?", $this->alertText()); + $this->dismissAlert(); + + $this->assertContains("Extreme Programming Explained : Embrace Change", $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid4TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid4TestCase.php index 702b997e..f67f5634 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid4TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid4TestCase.php @@ -1,28 +1,28 @@ <?php -class QuickstartDataGrid4TestCase extends PradoGenericSeleniumTest +class QuickstartDataGrid4TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample4&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample4&notheme=true&lang=en"); // verify the 2nd row of data - $this->verifyTextPresent("Design Patterns: Elements of Reusable Object-Oriented Software", ""); - $this->verifyTextPresent("Addison-Wesley Professional", ""); - $this->verifyTextPresent("$47.04", ""); - $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl5@checked','regexp:true|checked'); - $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl5@disabled','regexp:true|disabled'); + $this->assertContains("Design Patterns: Elements of Reusable Object-Oriented Software", $this->source()); + $this->assertContains("Addison-Wesley Professional", $this->source()); + $this->assertContains("$47.04", $this->source()); + $this->assertAttribute('ctl0_body_DataGrid_ctl2_ctl5@checked','regexp:true|checked'); + $this->assertAttribute('ctl0_body_DataGrid_ctl2_ctl5@disabled','regexp:true|disabled'); // verify sorting - $this->clickAndWait("link=Book Title", ""); - $this->assertEquals($this->getEval('this.browserbot.findElement("ctl0_body_DataGrid_ctl1_ctl5").hasAttribute("checked")'), 'false'); - $this->clickAndWait("link=Publisher", ""); - $this->assertEquals($this->getEval('this.browserbot.findElement("ctl0_body_DataGrid_ctl6_ctl5").hasAttribute("checked")'), 'false'); - $this->clickAndWait("link=Price", ""); - $this->assertEquals($this->getEval('this.browserbot.findElement("ctl0_body_DataGrid_ctl2_ctl5").hasAttribute("checked")'), 'false'); - $this->clickAndWait("link=In-stock", ""); - $this->assertEquals($this->getEval('this.browserbot.findElement("ctl0_body_DataGrid_ctl1_ctl5").hasAttribute("checked")'), 'false'); - $this->clickAndWait("link=Rating", ""); - $this->assertEquals($this->getEval('this.browserbot.findElement("ctl0_body_DataGrid_ctl4_ctl5").hasAttribute("checked")'), 'false'); + $this->byLinkText("Book Title")->click(); + $this->assertAttribute('ctl0_body_DataGrid_ctl1_ctl5@checked', null); + $this->byLinkText("Publisher")->click(); + $this->assertAttribute('ctl0_body_DataGrid_ctl6_ctl5@checked', null); + $this->byLinkText("Price")->click(); + $this->assertAttribute('ctl0_body_DataGrid_ctl2_ctl5@checked', null); + $this->byLinkText("In-stock")->click(); + $this->assertAttribute('ctl0_body_DataGrid_ctl1_ctl5@checked', null); + $this->byLinkText("Rating")->click(); + $this->assertAttribute('ctl0_body_DataGrid_ctl4_ctl5@checked', null); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid5TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid5TestCase.php index f854d44c..3df22ff8 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid5TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid5TestCase.php @@ -1,113 +1,113 @@ <?php -class QuickstartDataGrid5TestCase extends PradoGenericSeleniumTest +class QuickstartDataGrid5TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample5&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample5&notheme=true&lang=en"); // verify if all required texts are present // verify column headers - $this->verifyTextPresent('id',''); - $this->verifyTextPresent('name',''); - $this->verifyTextPresent('quantity',''); - $this->verifyTextPresent('price',''); - $this->verifyTextPresent('imported',''); + $this->assertContains('id', $this->source()); + $this->assertContains('name', $this->source()); + $this->assertContains('quantity', $this->source()); + $this->assertContains('price', $this->source()); + $this->assertContains('imported', $this->source()); - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('ITN002',''); - $this->verifyTextPresent('ITN003',''); - $this->verifyTextPresent('ITN004',''); - $this->verifyTextPresent('ITN005',''); - $this->verifyTextNotPresent('ITN006',''); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('ITN002', $this->source()); + $this->assertContains('ITN003', $this->source()); + $this->assertContains('ITN004', $this->source()); + $this->assertContains('ITN005', $this->source()); + $this->assertNotContains('ITN006', $this->source()); // verify paging - $this->clickAndWait("link=2", ""); - $this->verifyTextPresent('ITN006',''); - $this->verifyTextPresent('ITN007',''); - $this->verifyTextPresent('ITN008',''); - $this->verifyTextPresent('ITN009',''); - $this->verifyTextPresent('ITN010',''); - $this->verifyTextNotPresent('ITN011',''); - $this->verifyTextNotPresent('ITN005',''); + $this->byLinkText("2")->click(); + $this->assertContains('ITN006', $this->source()); + $this->assertContains('ITN007', $this->source()); + $this->assertContains('ITN008', $this->source()); + $this->assertContains('ITN009', $this->source()); + $this->assertContains('ITN010', $this->source()); + $this->assertNotContains('ITN011', $this->source()); + $this->assertNotContains('ITN005', $this->source()); - $this->clickAndWait("link=4", ""); - $this->verifyTextPresent('ITN016',''); - $this->verifyTextPresent('ITN017',''); - $this->verifyTextPresent('ITN018',''); - $this->verifyTextPresent('ITN019',''); - $this->verifyTextNotPresent('ITN015',''); + $this->byLinkText("4")->click(); + $this->assertContains('ITN016', $this->source()); + $this->assertContains('ITN017', $this->source()); + $this->assertContains('ITN018', $this->source()); + $this->assertContains('ITN019', $this->source()); + $this->assertNotContains('ITN015', $this->source()); - $this->clickAndWait("link=1", ""); - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('ITN002',''); - $this->verifyTextPresent('ITN003',''); - $this->verifyTextPresent('ITN004',''); - $this->verifyTextPresent('ITN005',''); - $this->verifyTextNotPresent('ITN006',''); + $this->byLinkText("1")->click(); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('ITN002', $this->source()); + $this->assertContains('ITN003', $this->source()); + $this->assertContains('ITN004', $this->source()); + $this->assertContains('ITN005', $this->source()); + $this->assertNotContains('ITN006', $this->source()); // show top pager - $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Top']", ""); - $this->clickAndWait("id=ctl0_body_DataGrid_ctl8_ctl3", ""); - $this->clickAndWait("link=1", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Top']")->click(); + $this->byId("ctl0_body_DataGrid_ctl8_ctl3")->click(); + $this->byLinkText("1")->click(); // hide top pager - $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Top']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Top']")->click(); // change next prev caption $this->type("ctl0\$body\$NextPageText", "Next Page"); $this->type("ctl0\$body\$PrevPageText", "Prev Page"); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); // verify next prev paging - $this->verifyTextPresent('ITN001',''); - $this->verifyTextNotPresent('ITN006',''); - $this->clickAndWait("link=Next Page", ""); - $this->verifyTextNotPresent('ITN005',''); - $this->verifyTextPresent('ITN006',''); - $this->verifyTextNotPresent('ITN011',''); - $this->clickAndWait("link=Next Page", ""); - $this->verifyTextNotPresent('ITN010',''); - $this->verifyTextPresent('ITN011',''); - $this->verifyTextNotPresent('ITN016',''); - $this->clickAndWait("link=Next Page", ""); - $this->verifyTextNotPresent('ITN015',''); - $this->verifyTextPresent('ITN016',''); - $this->clickAndWait("link=Prev Page", ""); - $this->verifyTextNotPresent('ITN010',''); - $this->verifyTextPresent('ITN011',''); - $this->verifyTextNotPresent('ITN016',''); - $this->clickAndWait("link=Prev Page", ""); - $this->verifyTextNotPresent('ITN005',''); - $this->verifyTextPresent('ITN006',''); - $this->verifyTextNotPresent('ITN011',''); - $this->clickAndWait("link=Prev Page", ""); - $this->verifyTextPresent('ITN001',''); - $this->verifyTextNotPresent('ITN006',''); + $this->assertContains('ITN001', $this->source()); + $this->assertNotContains('ITN006', $this->source()); + $this->byLinkText("Next Page")->click(); + $this->assertNotContains('ITN005', $this->source()); + $this->assertContains('ITN006', $this->source()); + $this->assertNotContains('ITN011', $this->source()); + $this->byLinkText("Next Page")->click(); + $this->assertNotContains('ITN010', $this->source()); + $this->assertContains('ITN011', $this->source()); + $this->assertNotContains('ITN016', $this->source()); + $this->byLinkText("Next Page")->click(); + $this->assertNotContains('ITN015', $this->source()); + $this->assertContains('ITN016', $this->source()); + $this->byLinkText("Prev Page")->click(); + $this->assertNotContains('ITN010', $this->source()); + $this->assertContains('ITN011', $this->source()); + $this->assertNotContains('ITN016', $this->source()); + $this->byLinkText("Prev Page")->click(); + $this->assertNotContains('ITN005', $this->source()); + $this->assertContains('ITN006', $this->source()); + $this->assertNotContains('ITN011', $this->source()); + $this->byLinkText("Prev Page")->click(); + $this->assertContains('ITN001', $this->source()); + $this->assertNotContains('ITN006', $this->source()); // change button count $this->type("ctl0\$body\$PageButtonCount", "2"); - $this->clickAndWait("name=ctl0\$body\$ctl6", ""); - $this->clickAndWait("link=Next Page", ""); - $this->verifyTextNotPresent('ITN010',''); - $this->verifyTextPresent('ITN011',''); - $this->verifyTextNotPresent('ITN016',''); - $this->clickAndWait("link=4", ""); - $this->verifyTextNotPresent('ITN015',''); - $this->verifyTextPresent('ITN016',''); - $this->clickAndWait("link=Prev Page", ""); - $this->verifyTextNotPresent('ITN005',''); - $this->verifyTextPresent('ITN006',''); - $this->verifyTextNotPresent('ITN011',''); + $this->byName("ctl0\$body\$ctl6")->click(); + $this->byLinkText("Next Page")->click(); + $this->assertNotContains('ITN010', $this->source()); + $this->assertContains('ITN011', $this->source()); + $this->assertNotContains('ITN016', $this->source()); + $this->byLinkText("4")->click(); + $this->assertNotContains('ITN015', $this->source()); + $this->assertContains('ITN016', $this->source()); + $this->byLinkText("Prev Page")->click(); + $this->assertNotContains('ITN005', $this->source()); + $this->assertContains('ITN006', $this->source()); + $this->assertNotContains('ITN011', $this->source()); $this->type("ctl0\$body\$PageButtonCount", "10"); - $this->clickAndWait("name=ctl0\$body\$ctl6", ""); + $this->byName("ctl0\$body\$ctl6")->click(); $this->type("ctl0\$body\$PageSize", "2"); - $this->clickAndWait("name=ctl0\$body\$ctl8", ""); - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('ITN002',''); - $this->verifyTextNotPresent('ITN003',''); - $this->clickAndWait("link=10", ""); - $this->verifyTextPresent('ITN019',''); - $this->verifyTextNotPresent('ITN018',''); + $this->byName("ctl0\$body\$ctl8")->click(); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('ITN002', $this->source()); + $this->assertNotContains('ITN003', $this->source()); + $this->byLinkText("10")->click(); + $this->assertContains('ITN019', $this->source()); + $this->assertNotContains('ITN018', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid6TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid6TestCase.php index c6fba20f..54af86a8 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid6TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid6TestCase.php @@ -1,48 +1,48 @@ <?php -class QuickstartDataGrid6TestCase extends PradoGenericSeleniumTest +class QuickstartDataGrid6TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample6&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample6&notheme=true&lang=en"); // verify column headers - $this->verifyTextPresent('id',''); - $this->verifyTextPresent('name',''); - $this->verifyTextPresent('quantity',''); - $this->verifyTextPresent('price',''); - $this->verifyTextPresent('imported',''); + $this->assertContains('id', $this->source()); + $this->assertContains('name', $this->source()); + $this->assertContains('quantity', $this->source()); + $this->assertContains('price', $this->source()); + $this->assertContains('imported', $this->source()); - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('ITN002',''); - $this->verifyTextPresent('ITN003',''); - $this->verifyTextPresent('ITN004',''); - $this->verifyTextPresent('ITN005',''); - $this->verifyTextNotPresent('ITN006',''); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('ITN002', $this->source()); + $this->assertContains('ITN003', $this->source()); + $this->assertContains('ITN004', $this->source()); + $this->assertContains('ITN005', $this->source()); + $this->assertNotContains('ITN006', $this->source()); // verify paging - $this->clickAndWait("link=2", ""); - $this->verifyTextPresent('ITN006',''); - $this->verifyTextPresent('ITN007',''); - $this->verifyTextPresent('ITN008',''); - $this->verifyTextPresent('ITN009',''); - $this->verifyTextPresent('ITN010',''); - $this->verifyTextNotPresent('ITN011',''); - $this->verifyTextNotPresent('ITN005',''); + $this->byLinkText("2")->click(); + $this->assertContains('ITN006', $this->source()); + $this->assertContains('ITN007', $this->source()); + $this->assertContains('ITN008', $this->source()); + $this->assertContains('ITN009', $this->source()); + $this->assertContains('ITN010', $this->source()); + $this->assertNotContains('ITN011', $this->source()); + $this->assertNotContains('ITN005', $this->source()); - $this->clickAndWait("link=4", ""); - $this->verifyTextPresent('ITN016',''); - $this->verifyTextPresent('ITN017',''); - $this->verifyTextPresent('ITN018',''); - $this->verifyTextPresent('ITN019',''); - $this->verifyTextNotPresent('ITN015',''); + $this->byLinkText("4")->click(); + $this->assertContains('ITN016', $this->source()); + $this->assertContains('ITN017', $this->source()); + $this->assertContains('ITN018', $this->source()); + $this->assertContains('ITN019', $this->source()); + $this->assertNotContains('ITN015', $this->source()); - $this->clickAndWait("link=1", ""); - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('ITN002',''); - $this->verifyTextPresent('ITN003',''); - $this->verifyTextPresent('ITN004',''); - $this->verifyTextPresent('ITN005',''); - $this->verifyTextNotPresent('ITN006',''); + $this->byLinkText("1")->click(); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('ITN002', $this->source()); + $this->assertContains('ITN003', $this->source()); + $this->assertContains('ITN004', $this->source()); + $this->assertContains('ITN005', $this->source()); + $this->assertNotContains('ITN006', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php index 4ff6478a..436af2ad 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php @@ -1,24 +1,24 @@ <?php -class QuickstartDataList1TestCase extends PradoGenericSeleniumTest +class QuickstartDataList1TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample1&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample1&notheme=true&lang=en"); // verify if all required texts are present - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('$100',''); - $this->verifyTextPresent('Motherboard',''); - $this->verifyTextPresent('ITN018',''); - $this->verifyTextPresent('Surge protector',''); - $this->verifyTextPresent('45',''); - $this->verifyTextPresent('$15',''); - $this->verifyTextPresent('Total 19 products.',''); - $this->verifyTextPresent('Computer Parts',''); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('$100', $this->source()); + $this->assertContains('Motherboard', $this->source()); + $this->assertContains('ITN018', $this->source()); + $this->assertContains('Surge protector', $this->source()); + $this->assertContains('45', $this->source()); + $this->assertContains('$15', $this->source()); + $this->assertContains('Total 19 products.', $this->source()); + $this->assertContains('Computer Parts', $this->source()); // verify specific table tags - $this->verifyElementPresent("ctl0_body_DataList"); - $this->verifyElementPresent("//td[@align='right']"); + $this->assertElementPresent("ctl0_body_DataList"); + $this->assertElementPresent("//td[@align='right']"); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php index 4fb3743e..c21d71f3 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php @@ -1,59 +1,65 @@ <?php -class QuickstartDataList2TestCase extends PradoGenericSeleniumTest +class QuickstartDataList2TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample2&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample2&notheme=true&lang=en"); // verify initial presentation - $this->verifyTextPresent("Motherboard ", ""); - $this->verifyTextPresent("Monitor ", ""); + $this->assertContains("Motherboard", $this->source()); + $this->assertContains("Monitor", $this->source()); // verify selecting an item - $this->clickAndWait("link=ITN003", ""); - $this->verifyTextPresent("Quantity", ""); - $this->verifyTextPresent("Price", ""); - $this->verifyTextPresent("\$80", ""); - $this->clickAndWait("link=ITN005", ""); - $this->verifyTextPresent("\$150", ""); + $this->byLinkText("ITN003")->click(); + $this->assertContains("Quantity", $this->source()); + $this->assertContains("Price", $this->source()); + $this->assertContains("\$80", $this->source()); + $this->byLinkText("ITN005")->click(); + $this->assertContains("\$150", $this->source()); // verify editting an item - $this->clickAndWait("id=ctl0_body_DataList_ctl5_ctl0", ""); + $this->byId("ctl0_body_DataList_ctl5_ctl0")->click(); $this->type("ctl0\$body\$DataList\$ctl5\$ProductQuantity", "11"); $this->type("ctl0\$body\$DataList\$ctl5\$ProductPrice", "140.99"); - $this->click("//input[@name='ctl0\$body\$DataList\$ctl5\$ProductImported']", ""); - $this->clickAndWait("link=Save", ""); + $this->byXPath("//input[@name='ctl0\$body\$DataList\$ctl5\$ProductImported']")->click(); + $this->byLinkText("Save")->click(); // verify item is saved - $this->clickAndWait("link=ITN005", ""); - $this->verifyTextPresent("\$140.99", ""); - $this->verifyTextPresent("11", ""); + $this->byLinkText("ITN005")->click(); + $this->assertContains("\$140.99", $this->source()); + $this->assertContains("11", $this->source()); // verify editting another item - $this->clickAndWait("id=ctl0_body_DataList_ctl3_ctl1", ""); + $this->byId("ctl0_body_DataList_ctl3_ctl1")->click(); $this->type("ctl0\$body\$DataList\$ctl3\$ProductName", "Hard Drive"); $this->type("ctl0\$body\$DataList\$ctl3\$ProductQuantity", "23"); - $this->click("//input[@name='ctl0\$body\$DataList\$ctl3\$ProductImported']", ""); - $this->clickAndWait("link=Cancel", ""); + $this->byXPath("//input[@name='ctl0\$body\$DataList\$ctl3\$ProductImported']")->click(); + $this->byLinkText("Cancel")->click(); // verify item is canceled - $this->clickAndWait("link=ITN003", ""); - $this->verifyTextPresent("2", ""); - $this->verifyTextPresent("Harddrive ", ""); + $this->byLinkText("ITN003")->click(); + $this->assertContains("2", $this->source()); + $this->assertContains("Harddrive", $this->source()); // verify item deletion - $this->clickAndWait("id=ctl0_body_DataList_ctl3_ctl1", ""); - $this->verifyConfirmation("Are you sure?"); - $this->chooseCancelOnNextConfirmation(); - $this->click("id=ctl0_body_DataList_ctl5_ctl2", ""); - $this->verifyConfirmation("Are you sure?"); - $this->verifyTextPresent("Motherboard ", ""); - $this->verifyTextPresent("CPU ", ""); - $this->verifyTextNotPresent("Harddrive",""); - $this->verifyTextPresent("Sound card", ""); - $this->verifyTextPresent("Video card", ""); - $this->verifyTextPresent("Keyboard",""); - $this->verifyTextPresent("Monitor ", ""); + $this->byId("ctl0_body_DataList_ctl3_ctl1")->click(); + + $this->assertEquals("Are you sure?", $this->alertText()); + $this->acceptAlert(); + + $this->pause(300); // wait for reload + $this->byId("ctl0_body_DataList_ctl5_ctl2")->click(); + + $this->assertEquals("Are you sure?", $this->alertText()); + $this->dismissAlert(); + + $this->assertContains("Motherboard", $this->source()); + $this->assertContains("CPU", $this->source()); + $this->assertNotContains("Harddrive", $this->source()); + $this->assertContains("Sound card", $this->source()); + $this->assertContains("Video card", $this->source()); + $this->assertContains("Keyboard", $this->source()); + $this->assertContains("Monitor", $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php b/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php index eae8ab36..cb01e948 100755 --- a/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php @@ -1,65 +1,65 @@ <?php -class QuickstartDropDownListTestCase extends PradoGenericSeleniumTest +class QuickstartDropDownListTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDropDownList.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDropDownList.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // dropdown list with default settings - $this->verifyElementPresent("ctl0\$body\$ctl0"); + $this->assertElementPresent("ctl0\$body\$ctl0"); // dropdown list with initial options - $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl1"), array('item 1', 'item 2', 'item 3', 'item 4')); + $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl1"), array('item 1', 'item 2', 'item 3', 'item 4')); $this->assertSelected("ctl0\$body\$ctl1","item 2"); // dropdown list with customized styles - $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl2"), array('item 1', 'item 2', 'item 3', 'item 4')); + $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl2"), array('item 1', 'item 2', 'item 3', 'item 4')); $this->assertSelected("ctl0\$body\$ctl2","item 2"); // a disabled dropdown list - $this->verifyAttribute("ctl0\$body\$ctl3@disabled","regexp:true|disabled"); + $this->assertAttribute("ctl0\$body\$ctl3@disabled","regexp:true|disabled"); // an auto postback dropdown list - $this->verifyTextNotPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", ""); - $this->selectAndWait("ctl0\$body\$ctl4", "label=item 3"); - $this->verifyTextPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", ""); + $this->assertNotContains("Your selection is: (Index: 2, Value: value 3, Text: item 3)", $this->source()); + $this->selectAndWait("ctl0\$body\$ctl4", "item 3"); + $this->assertContains("Your selection is: (Index: 2, Value: value 3, Text: item 3)", $this->source()); // a single selection list box upon postback - $this->select("ctl0\$body\$DropDownList1", "label=item 4"); - $this->verifyTextNotPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->verifyTextPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", ""); + $this->select("ctl0\$body\$DropDownList1", "item 4"); + $this->assertNotContains("Your selection is: (Index: 3, Value: value 4, Text: item 4)", $this->source()); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertContains("Your selection is: (Index: 3, Value: value 4, Text: item 4)", $this->source()); // Databind to an integer-indexed array - $this->selectAndWait("ctl0\$body\$DBDropDownList1", "label=item 3"); - $this->verifyTextPresent("Your selection is: (Index: 2, Value: 2, Text: item 3)", ""); + $this->selectAndWait("ctl0\$body\$DBDropDownList1", "item 3"); + $this->assertContains("Your selection is: (Index: 2, Value: 2, Text: item 3)", $this->source()); // Databind to an associative array - $this->selectAndWait("ctl0\$body\$DBDropDownList2", "label=item 2"); - $this->verifyTextPresent("Your selection is: (Index: 1, Value: key 2, Text: item 2)", ""); + $this->selectAndWait("ctl0\$body\$DBDropDownList2", "item 2"); + $this->assertContains("Your selection is: (Index: 1, Value: key 2, Text: item 2)", $this->source()); // Databind with DataTextField and DataValueField specified - $this->selectAndWait("ctl0\$body\$DBDropDownList3", "label=Cary"); - $this->verifyTextPresent("Your selection is: (Index: 2, Value: 003, Text: Cary)", ""); + $this->selectAndWait("ctl0\$body\$DBDropDownList3", "Cary"); + $this->assertContains("Your selection is: (Index: 2, Value: 003, Text: Cary)", $this->source()); // dropdown list is being validated - $this->verifyNotVisible('ctl0_body_ctl6'); - $this->click("id=ctl0_body_ctl7", ""); - $this->verifyVisible('ctl0_body_ctl6'); - $this->select("ctl0\$body\$VDropDownList1", "label=item 2"); - $this->clickAndWait("id=ctl0_body_ctl7", ""); - $this->verifyNotVisible('ctl0_body_ctl6'); + $this->assertNotVisible('ctl0_body_ctl6'); + $this->byId("ctl0_body_ctl7")->click(); + $this->assertVisible('ctl0_body_ctl6'); + $this->select("ctl0\$body\$VDropDownList1", "item 2"); + $this->byId("ctl0_body_ctl7")->click(); + $this->assertNotVisible('ctl0_body_ctl6'); // dropdown list causing validation - $this->verifyNotVisible('ctl0_body_ctl8'); - $this->select("ctl0\$body\$VDropDownList2", "label=Disagree"); + $this->assertNotVisible('ctl0_body_ctl8'); + $this->select("ctl0\$body\$VDropDownList2", "Disagree"); $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl8'); + $this->assertVisible('ctl0_body_ctl8'); $this->type("ctl0\$body\$TextBox", "test"); - $this->selectAndWait("ctl0\$body\$VDropDownList2", "label=Agree"); - $this->verifyNotVisible('ctl0_body_ctl8'); + $this->selectAndWait("ctl0\$body\$VDropDownList2", "Agree"); + $this->assertNotVisible('ctl0_body_ctl8'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/ExpressionTestCase.php b/tests/FunctionalTests/quickstart/Controls/ExpressionTestCase.php index 4d47fecd..8c5add48 100755 --- a/tests/FunctionalTests/quickstart/Controls/ExpressionTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ExpressionTestCase.php @@ -1,13 +1,13 @@ <?php -class QuickstartExpressionTestCase extends PradoGenericSeleniumTest +class QuickstartExpressionTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TExpression.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TExpression.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); - $this->verifyTextPresent('PRADO QuickStart Sample'); + $this->assertContains('PRADO QuickStart Sample', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/HtmlAreaTestCase.php b/tests/FunctionalTests/quickstart/Controls/HtmlAreaTestCase.php index caa7a893..53ee6697 100755 --- a/tests/FunctionalTests/quickstart/Controls/HtmlAreaTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/HtmlAreaTestCase.php @@ -1,12 +1,12 @@ <?php -class QuickstartHtmlAreaTestCase extends PradoGenericSeleniumTest +class QuickstartHtmlAreaTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.THtmlArea.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.THtmlArea.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // can't perform any test } diff --git a/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php b/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php index dc0261e7..bc7ef8b8 100755 --- a/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php @@ -1,15 +1,15 @@ <?php -class QuickstartHyperLinkTestCase extends PradoGenericSeleniumTest +class QuickstartHyperLinkTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.THyperLink.Home&notheme=true&lang=en", ""); - $this->verifyTitle("PRADO QuickStart Sample", ""); - $this->verifyElementPresent("//a[@href=\"http://www.pradosoft.com/\" and @target=\"_blank\"]"); - $this->verifyTextPresent("Welcome to", ""); - $this->verifyTextPresent("Body contents", ""); - $this->verifyElementPresent("//a[img/@alt='Hello World']"); - $this->verifyElementPresent("//a[contains(text(),'Body contents')]"); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.THyperLink.Home&notheme=true&lang=en"); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); + $this->assertElementPresent("//a[@href=\"http://www.pradosoft.com/\" and @target=\"_blank\"]"); + $this->assertContains("Welcome to", $this->source()); + $this->assertContains("Body contents", $this->source()); + $this->assertElementPresent("//a[img/@alt='Hello World']"); + $this->assertElementPresent("//a[contains(text(),'Body contents')]"); } } diff --git a/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php b/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php index bf531d72..0f86216e 100755 --- a/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php @@ -1,28 +1,28 @@ <?php -class QuickstartImageButtonTestCase extends PradoGenericSeleniumTest +class QuickstartImageButtonTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TImageButton.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TImageButton.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // a click button - $this->clickAndWait("//input[@type='image' and @alt='hello world']", ""); - $this->verifyTextPresent("You clicked at ",""); + $this->byXPath("//input[@type='image' and @alt='hello world']")->click(); + $this->assertContains("You clicked at ", $this->source()); // a command button - $this->clickAndWait("ctl0\$body\$ctl1", ""); - $this->verifyTextPresent("Command name: test, Command parameter: value",""); + $this->byName("ctl0\$body\$ctl1")->click(); + $this->assertContains("Command name: test, Command parameter: value", $this->source()); // a button causing validation - $this->verifyNotVisible('ctl0_body_ctl2'); - $this->click("id=ctl0_body_ctl3", ""); + $this->assertNotVisible('ctl0_body_ctl2'); + $this->byId("ctl0_body_ctl3")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl2'); + $this->assertVisible('ctl0_body_ctl2'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("id=ctl0_body_ctl3", ""); - $this->verifyNotVisible('ctl0_body_ctl2'); + $this->byId("ctl0_body_ctl3")->click(); + $this->assertNotVisible('ctl0_body_ctl2'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php b/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php index 19e80470..f3bd4775 100755 --- a/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php @@ -1,18 +1,18 @@ <?php //New Test -class QuickstartImageTestCase extends PradoGenericSeleniumTest +class QuickstartImageTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TImage.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TImage.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); - //$this->verifyElementPresent("//img[contains(@src,'/hello_world.gif') and @alt='']"); - $this->verifyElementPresent("//img[contains(@src,'/hello_world.gif') and @alt='Hello World!']"); - $this->verifyTextPresent("Hello World! Hello World! Hello World!", ""); - //$this->verifyElementPresent("//img[contains(@src,'/hello_world.gif') and @align='baseline']"); - //$this->verifyElementPresent("//img[contains(@src,'/hello_world.gif') and contains(@longdesc,'HelloWorld.html')]"); + //$this->assertElementPresent("//img[contains(@src,'/hello_world.gif') and @alt='']"); + $this->assertElementPresent("//img[contains(@src,'/hello_world.gif') and @alt='Hello World!']"); + $this->assertContains("Hello World! Hello World! Hello World!", $this->source()); + //$this->assertElementPresent("//img[contains(@src,'/hello_world.gif') and @align='baseline']"); + //$this->assertElementPresent("//img[contains(@src,'/hello_world.gif') and contains(@longdesc,'HelloWorld.html')]"); } } diff --git a/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php b/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php index 03bba8ed..a9aa0bbe 100755 --- a/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php @@ -1,20 +1,20 @@ <?php //New Test -class QuickstartLabelTestCase extends PradoGenericSeleniumTest +class QuickstartLabelTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TLabel.Home&notheme=true&lang=en", ""); - $this->verifyTitle("PRADO QuickStart Sample", ""); - $this->verifyTextPresent("This is a label with customized color and font.", ""); - $this->verifyTextPresent("This is a form label associated with the TTextBox control below", ""); - $this->verifyTextPresent("This is a label with empty Text property and nonempty body", ""); - $this->verifyTextPresent("This is a disabled label", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TLabel.Home&notheme=true&lang=en"); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); + $this->assertContains("This is a label with customized color and font.", $this->source()); + $this->assertContains("This is a form label associated with the TTextBox control below", $this->source()); + $this->assertContains("This is a label with empty Text property and <b>nonempty body</b>", $this->source()); + $this->assertContains("This is a disabled label", $this->source()); - $this->verifyAttribute("ctl0_body_Label2@disabled","regexp:true|disabled"); + $this->assertAttribute("ctl0_body_Label2@disabled","regexp:true|disabled"); - //$this->verifyAttribute("ctl0_body_Label1@for","ctl0_body_test"); + //$this->assertAttribute("ctl0_body_Label1@for","ctl0_body_test"); $this->type("ctl0\$body\$test", "test"); } diff --git a/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php b/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php index 57e7b975..97b4863d 100755 --- a/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php @@ -1,32 +1,32 @@ <?php -class QuickstartLinkButtonTestCase extends PradoGenericSeleniumTest +class QuickstartLinkButtonTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TLinkButton.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TLinkButton.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // regular buttons - $this->clickAndWait("link=link button", ""); - $this->clickAndWait("//a[contains(text(),'body content')]", ""); + $this->byLinkText("link button")->click(); + $this->byXPath("//a[contains(text(),'body content')]")->click(); // a click button - $this->clickAndWait("link=click me", ""); - $this->clickAndWait("link=I'm clicked", ""); + $this->byLinkText("click me")->click(); + $this->byLinkText("I'm clicked")->click(); // a command button - $this->clickAndWait("link=click me", ""); - $this->clickAndWait("//a[contains(text(),'Name: test, Param: value')]", ""); + $this->byLinkText("click me")->click(); + $this->byXPath("//a[contains(text(),'Name: test, Param: value')]")->click(); // a button causing validation - $this->verifyNotVisible('ctl0_body_ctl4'); - $this->click("link=submit", ""); + $this->assertNotVisible('ctl0_body_ctl4'); + $this->byLinkText("submit")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl4'); + $this->assertVisible('ctl0_body_ctl4'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("link=submit", ""); - $this->verifyNotVisible('ctl0_body_ctl4'); + $this->byLinkText("submit")->click(); + $this->assertNotVisible('ctl0_body_ctl4'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php b/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php index 1cae0d43..11910ba5 100755 --- a/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php @@ -1,82 +1,81 @@ <?php //New Test -class QuickstartListBoxTestCase extends PradoGenericSeleniumTest +class QuickstartListBoxTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TListBox.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TListBox.Home&notheme=true&lang=en"); // a default single selection listbox - $this->verifyAttribute("ctl0\$body\$ctl0@size","4"); + $this->assertAttribute("ctl0\$body\$ctl0@size","4"); // single selection list box with initial options - $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl1"), array('item 1', 'item 2', 'item 3', 'item 4')); + $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl1"), array('item 1', 'item 2', 'item 3', 'item 4')); $this->assertSelected("ctl0\$body\$ctl1","item 2"); // a single selection list box with customized style - $this->verifyAttribute("ctl0\$body\$ctl2@size","3"); - $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl2"), array('item 1', 'item 2', 'item 3', 'item 4')); + $this->assertAttribute("ctl0\$body\$ctl2@size","3"); + $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl2"), array('item 1', 'item 2', 'item 3', 'item 4')); $this->assertSelected("ctl0\$body\$ctl2","item 2"); // a disabled list box - $this->verifyAttribute("ctl0\$body\$ctl3@disabled","regexp:true|disabled"); + $this->assertAttribute("ctl0\$body\$ctl3@disabled","regexp:true|disabled"); // an auto postback single selection list box - $this->verifyTextNotPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", ""); - $this->selectAndWait("ctl0\$body\$ctl4", "label=item 3"); - $this->verifyTextPresent("exact:Your selection is: (Index: 2, Value: value 3, Text: item 3)", ""); + $this->assertNotContains("Your selection is: (Index: 2, Value: value 3, Text: item 3)", $this->source()); + $this->selectAndWait("ctl0\$body\$ctl4", "item 3"); + $this->assertContains("Your selection is: (Index: 2, Value: value 3, Text: item 3)", $this->source()); // a single selection list box upon postback - $this->select("ctl0\$body\$ListBox1", "label=item 4"); - $this->verifyTextNotPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->verifyTextPresent("exact:Your selection is: (Index: 3, Value: value 4, Text: item 4)", ""); + $this->select("ctl0\$body\$ListBox1", "item 4"); + $this->assertNotContains("Your selection is: (Index: 3, Value: value 4, Text: item 4)", $this->source()); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertContains("Your selection is: (Index: 3, Value: value 4, Text: item 4)", $this->source()); // a multiple selection list box - $this->verifyAttribute("ctl0\$body\$ctl6[]@size","4"); - $this->verifyAttribute("ctl0\$body\$ctl6[]@multiple","regexp:true|multiple"); + $this->assertAttribute("ctl0\$body\$ctl6[]@size","4"); + $this->assertAttribute("ctl0\$body\$ctl6[]@multiple","regexp:true|multiple"); // a multiple selection list box with initial options - $this->verifyAttribute("ctl0\$body\$ctl7[]@multiple","regexp:true|multiple"); + $this->assertAttribute("ctl0\$body\$ctl7[]@multiple","regexp:true|multiple"); $this->assertEquals($this->getSelectOptions("ctl0\$body\$ctl7[]"), array('item 1', 'item 2', 'item 3', 'item 4')); // multiselection list box's behavior upon postback - $this->addSelection("ctl0\$body\$ListBox2[]", "label=item 3"); - $this->clickAndWait("name=ctl0\$body\$ctl8", ""); - $this->verifyText("ctl0_body_MultiSelectionResult2","exact:Your selection is: (Index: 1, Value: value 2, Text: item 2)(Index: 2, Value: value 3, Text: item 3)(Index: 3, Value: value 4, Text: item 4)"); + $this->addSelection("ctl0\$body\$ListBox2[]", "item 3"); + $this->byName("ctl0\$body\$ctl8")->click(); + $this->assertText("ctl0_body_MultiSelectionResult2","Your selection is: (Index: 1, Value: value 2, Text: item 2)(Index: 2, Value: value 3, Text: item 3)(Index: 3, Value: value 4, Text: item 4)"); // Auto postback multiselection list box - $this->addSelection("ctl0\$body\$ctl9[]", "label=item 1"); - $this->waitForPageToLoad(1000); - $this->verifyText("ctl0_body_MultiSelectionResult","exact:Your selection is: (Index: 0, Value: value 1, Text: item 1)(Index: 1, Value: value 2, Text: item 2)(Index: 3, Value: value 4, Text: item 4)"); + $this->addSelection("ctl0\$body\$ctl9[]", "item 1"); + $this->assertText("ctl0_body_MultiSelectionResult","Your selection is: (Index: 0, Value: value 1, Text: item 1)(Index: 1, Value: value 2, Text: item 2)(Index: 3, Value: value 4, Text: item 4)"); // Databind to an integer-indexed array - $this->selectAndWait("ctl0\$body\$DBListBox1[]", "label=item 3"); - $this->verifyTextPresent("exact:Your selection is: (Index: 2, Value: 2, Text: item 3)", ""); + $this->selectAndWait("ctl0\$body\$DBListBox1[]", "item 3"); + $this->assertContains("Your selection is: (Index: 2, Value: 2, Text: item 3)", $this->source()); // Databind to an associative array - $this->selectAndWait("ctl0\$body\$DBListBox2[]", "label=item 2"); - $this->verifyTextPresent("exact:Your selection is: (Index: 1, Value: key 2, Text: item 2)", ""); + $this->selectAndWait("ctl0\$body\$DBListBox2[]", "item 2"); + $this->assertContains("Your selection is: (Index: 1, Value: key 2, Text: item 2)", $this->source()); // Databind with DataTextField and DataValueField specified - $this->selectAndWait("ctl0\$body\$DBListBox3[]", "label=Cary"); - $this->verifyTextPresent("exact:Your selection is: (Index: 2, Value: 003, Text: Cary)", ""); + $this->selectAndWait("ctl0\$body\$DBListBox3[]", "Cary"); + $this->assertContains("Your selection is: (Index: 2, Value: 003, Text: Cary)", $this->source()); // List box is being validated - $this->verifyNotVisible('ctl0_body_ctl10'); - $this->click("id=ctl0_body_ctl11", ""); - $this->verifyVisible('ctl0_body_ctl10'); - $this->select("ctl0\$body\$VListBox1", "label=item 2"); - $this->clickAndWait("id=ctl0_body_ctl11", ""); - $this->verifyNotVisible('ctl0_body_ctl10'); + $this->assertNotVisible('ctl0_body_ctl10'); + $this->byId("ctl0_body_ctl11")->click(); + $this->assertVisible('ctl0_body_ctl10'); + $this->select("ctl0\$body\$VListBox1", "item 2"); + $this->byId("ctl0_body_ctl11")->click(); + $this->assertNotVisible('ctl0_body_ctl10'); // List box causing validation - $this->verifyNotVisible('ctl0_body_ctl12'); - $this->select("ctl0\$body\$VListBox2", "label=Agree"); - $this->verifyVisible('ctl0_body_ctl12'); + $this->assertNotVisible('ctl0_body_ctl12'); + $this->select("ctl0\$body\$VListBox2", "Agree"); + $this->assertVisible('ctl0_body_ctl12'); $this->type("ctl0\$body\$TextBox", "test"); - $this->selectAndWait("ctl0\$body\$VListBox2", "label=Disagree"); - $this->verifyNotVisible('ctl0_body_ctl12'); + $this->selectAndWait("ctl0\$body\$VListBox2", "Disagree"); + $this->assertNotVisible('ctl0_body_ctl12'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/MultiViewTestCase.php b/tests/FunctionalTests/quickstart/Controls/MultiViewTestCase.php index 2b47456e..d7a5ebec 100755 --- a/tests/FunctionalTests/quickstart/Controls/MultiViewTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/MultiViewTestCase.php @@ -1,35 +1,35 @@ <?php -class QuickstartMultiViewTestCase extends PradoGenericSeleniumTest +class QuickstartMultiViewTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TMultiView.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TMultiView.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // view 1 : type in a string - $this->verifyElementNotPresent('ctl0_body_Result1'); - $this->verifyElementNotPresent('ctl0_body_Result2'); + $this->assertElementNotPresent('ctl0_body_Result1'); + $this->assertElementNotPresent('ctl0_body_Result2'); $this->type('ctl0_body_Memo','test'); - $this->clickAndWait('ctl0$body$ctl0'); // view 2 to select the dropdown - $this->clickAndWait('ctl0$body$ctl4'); + $this->byName('ctl0$body$ctl0')->click(); // view 2 to select the dropdown + $this->byName('ctl0$body$ctl4')->click(); // view 3 : check if the output is updated - $this->verifyTextPresent('Your text input is: test'); - $this->verifyTextPresent('Your color choice is: Red'); - $this->clickAndWait('ctl0$body$ctl7'); + $this->assertContains('Your text input is: test', $this->source()); + $this->assertContains('Your color choice is: Red', $this->source()); + $this->byName('ctl0$body$ctl7')->click(); // view 2 : update dropdownlist - $this->verifyElementNotPresent('ctl0_body_Result1'); - $this->verifyElementNotPresent('ctl0_body_Result2'); - $this->select('ctl0$body$DropDownList', "label=Blue"); - $this->clickAndWait('ctl0$body$ctl4'); + $this->assertElementNotPresent('ctl0_body_Result1'); + $this->assertElementNotPresent('ctl0_body_Result2'); + $this->select('ctl0$body$DropDownList', "Blue"); + $this->byName('ctl0$body$ctl4')->click(); // view 3 : check if the output is updated - $this->verifyTextPresent('Your text input is: test'); - $this->verifyTextPresent('Your color choice is: Blue'); - $this->clickAndWait('ctl0$body$ctl7'); + $this->assertContains('Your text input is: test', $this->source()); + $this->assertContains('Your color choice is: Blue', $this->source()); + $this->byName('ctl0$body$ctl7')->click(); // view 2 : check if dropdownlist maintains state $this->assertSelected('ctl0$body$DropDownList', "Blue"); diff --git a/tests/FunctionalTests/quickstart/Controls/PagerTestCase.php b/tests/FunctionalTests/quickstart/Controls/PagerTestCase.php index a1fefed6..7e4a6627 100755 --- a/tests/FunctionalTests/quickstart/Controls/PagerTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/PagerTestCase.php @@ -1,56 +1,56 @@ <?php -class QuickstartPagerTestCase extends PradoGenericSeleniumTest +class QuickstartPagerTestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TPager.Sample1&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TPager.Sample1&notheme=true&lang=en"); // verify datalist content - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('ITN002',''); - $this->verifyTextNotPresent('ITN003',''); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('ITN002', $this->source()); + $this->assertNotContains('ITN003', $this->source()); // verify numeric paging - $this->clickAndWait("ctl0_body_Pager_ctl1", ""); // 2nd page - $this->verifyTextPresent('ITN003',''); - $this->verifyTextPresent('ITN004',''); - $this->verifyTextNotPresent('ITN002',''); - $this->verifyTextNotPresent('ITN005',''); - $this->clickAndWait("ctl0_body_Pager_ctl3", ""); // 4rd page - $this->verifyTextPresent('ITN007',''); - $this->verifyTextPresent('ITN008',''); - $this->verifyTextNotPresent('ITN006',''); - $this->verifyTextNotPresent('ITN009',''); - $this->clickAndWait("ctl0_body_Pager_ctl6", ""); // last page - $this->verifyTextPresent('ITN019',''); - $this->verifyTextNotPresent('ITN018',''); - $this->verifyTextNotPresent('ITN001',''); + $this->byId("ctl0_body_Pager_ctl1")->click(); // 2nd page + $this->assertContains('ITN003', $this->source()); + $this->assertContains('ITN004', $this->source()); + $this->assertNotContains('ITN002', $this->source()); + $this->assertNotContains('ITN005', $this->source()); + $this->byId("ctl0_body_Pager_ctl3")->click(); // 4rd page + $this->assertContains('ITN007', $this->source()); + $this->assertContains('ITN008', $this->source()); + $this->assertNotContains('ITN006', $this->source()); + $this->assertNotContains('ITN009', $this->source()); + $this->byId("ctl0_body_Pager_ctl6")->click(); // last page + $this->assertContains('ITN019', $this->source()); + $this->assertNotContains('ITN018', $this->source()); + $this->assertNotContains('ITN001', $this->source()); // verify next-prev paging - $this->clickAndWait("ctl0_body_Pager2_ctl1", ""); // prev page - $this->verifyTextPresent('ITN017',''); - $this->verifyTextPresent('ITN018',''); - $this->verifyTextNotPresent('ITN019',''); - $this->verifyTextNotPresent('ITN016',''); - $this->clickAndWait("ctl0_body_Pager2_ctl0", ""); // first page - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('ITN002',''); - $this->verifyTextNotPresent('ITN003',''); - $this->clickAndWait("ctl0_body_Pager2_ctl2", ""); // next page - $this->verifyTextPresent('ITN003',''); - $this->verifyTextPresent('ITN004',''); - $this->verifyTextNotPresent('ITN002',''); - $this->verifyTextNotPresent('ITN005',''); + $this->byId("ctl0_body_Pager2_ctl1")->click(); // prev page + $this->assertContains('ITN017', $this->source()); + $this->assertContains('ITN018', $this->source()); + $this->assertNotContains('ITN019', $this->source()); + $this->assertNotContains('ITN016', $this->source()); + $this->byId("ctl0_body_Pager2_ctl0")->click(); // first page + $this->assertContains('ITN001', $this->source()); + $this->assertContains('ITN002', $this->source()); + $this->assertNotContains('ITN003', $this->source()); + $this->byId("ctl0_body_Pager2_ctl2")->click(); // next page + $this->assertContains('ITN003', $this->source()); + $this->assertContains('ITN004', $this->source()); + $this->assertNotContains('ITN002', $this->source()); + $this->assertNotContains('ITN005', $this->source()); $this->assertSelected("ctl0_body_Pager3_ctl0","2"); - $this->selectAndWait("ctl0_body_Pager3_ctl0", "label=5"); - $this->verifyTextPresent('ITN009',''); - $this->verifyTextPresent('ITN010',''); - $this->verifyTextNotPresent('ITN008',''); - $this->verifyTextNotPresent('ITN011',''); - $this->selectAndWait("ctl0_body_Pager3_ctl0", "label=10"); - $this->verifyTextPresent('ITN019',''); - $this->verifyTextNotPresent('ITN018',''); + $this->selectAndWait("ctl0_body_Pager3_ctl0", "5"); + $this->assertContains('ITN009', $this->source()); + $this->assertContains('ITN010', $this->source()); + $this->assertNotContains('ITN008', $this->source()); + $this->assertNotContains('ITN011', $this->source()); + $this->selectAndWait("ctl0_body_Pager3_ctl0", "10"); + $this->assertContains('ITN019', $this->source()); + $this->assertNotContains('ITN018', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php b/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php index 3def308b..0d3e2797 100755 --- a/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php @@ -1,16 +1,16 @@ <?php -class QuickstartPanelTestCase extends PradoGenericSeleniumTest +class QuickstartPanelTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TPanel.Home&notheme=true&lang=en", ""); - $this->verifyTextPresent("This is panel content with", ""); - $this->verifyElementPresent("//span[text()='label']"); - $this->verifyTextPresent("grouping text", ""); - $this->click("//input[@name='ctl0\$body\$ctl17']", ""); - $this->verifyTextNotPresent("You have clicked on 'button2'."); - $this->clickAndWait("//input[@type='submit' and @value='button2']", ""); - $this->verifyTextPresent("You have clicked on 'button2'."); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TPanel.Home&notheme=true&lang=en"); + $this->assertContains("This is panel content with", $this->source()); + $this->assertElementPresent("//span[text()='label']"); + $this->assertContains("grouping text", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$ctl17']")->click(); + $this->assertNotContains("You have clicked on 'button2'.", $this->source()); + $this->byXPath("//input[@type='submit' and @value='button2']")->click(); + $this->assertContains("You have clicked on 'button2'.", $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/RadioButtonListTestCase.php b/tests/FunctionalTests/quickstart/Controls/RadioButtonListTestCase.php index 659f20ff..6242cebe 100755 --- a/tests/FunctionalTests/quickstart/Controls/RadioButtonListTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/RadioButtonListTestCase.php @@ -1,17 +1,17 @@ <?php //New Test -class QuickstartRadioButtonListTestCase extends PradoGenericSeleniumTest +class QuickstartRadioButtonListTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TRadioButtonList.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TRadioButtonList.Home&notheme=true&lang=en"); // RadioButton list with default settings: - $this->click("//input[@name='ctl0\$body\$ctl0' and @value='value 3']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl0' and @value='value 3']")->click(); // RadioButton list with customized cellpadding, cellspacing, color and text alignment: - $this->click("//input[@name='ctl0\$body\$ctl1' and @value='value 1']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl1' and @value='value 1']")->click(); // *** Currently unable to test the following cases: // RadioButton list with vertical (default) repeat direction @@ -20,33 +20,33 @@ class QuickstartRadioButtonListTestCase extends PradoGenericSeleniumTest // RadioButton list with flow layout and horizontal repeat direction: // RadioButton list's behavior upon postback - $this->click("//input[@name='ctl0\$body\$RadioButtonList' and @value='value 3']", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->verifyTextPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", ""); + $this->byXPath("//input[@name='ctl0\$body\$RadioButtonList' and @value='value 3']")->click(); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertContains("Your selection is: (Index: 2, Value: value 3, Text: item 3)", $this->source()); // Auto postback check box list - $this->clickAndWait("//input[@name='ctl0\$body\$ctl7' and @value='value 5']", ""); - $this->verifyTextPresent("Your selection is: (Index: 4, Value: value 5, Text: item 5)", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl7' and @value='value 5']")->click(); + $this->assertContains("Your selection is: (Index: 4, Value: value 5, Text: item 5)", $this->source()); // Databind to an integer-indexed array - $this->clickAndWait("//input[@name='ctl0\$body\$DBRadioButtonList1' and @value='0']", ""); - $this->verifyTextPresent("Your selection is: (Index: 0, Value: 0, Text: item 1)", ""); + $this->byXPath("//input[@name='ctl0\$body\$DBRadioButtonList1' and @value='0']")->click(); + $this->assertContains("Your selection is: (Index: 0, Value: 0, Text: item 1)", $this->source()); // Databind to an associative array: - $this->clickAndWait("//input[@name='ctl0\$body\$DBRadioButtonList2' and @value='key 2']", ""); - $this->verifyTextPresent("Your selection is: (Index: 1, Value: key 2, Text: item 2)", ""); + $this->byXPath("//input[@name='ctl0\$body\$DBRadioButtonList2' and @value='key 2']")->click(); + $this->assertContains("Your selection is: (Index: 1, Value: key 2, Text: item 2)", $this->source()); // Databind with DataTextField and DataValueField specified - $this->clickAndWait("//input[@name='ctl0\$body\$DBRadioButtonList3' and @value='003']", ""); - $this->verifyTextPresent("Your selection is: (Index: 2, Value: 003, Text: Cary)", ""); + $this->byXPath("//input[@name='ctl0\$body\$DBRadioButtonList3' and @value='003']")->click(); + $this->assertContains("Your selection is: (Index: 2, Value: 003, Text: Cary)", $this->source()); // RadioButton list causing validation - $this->verifyNotVisible('ctl0_body_ctl8'); - $this->click("//input[@name='ctl0\$body\$ctl9' and @value='Agree']", ""); + $this->assertNotVisible('ctl0_body_ctl8'); + $this->byXPath("//input[@name='ctl0\$body\$ctl9' and @value='Agree']")->click(); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl8'); + $this->assertVisible('ctl0_body_ctl8'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl9' and @value='Disagree']", ""); - $this->verifyNotVisible('ctl0_body_ctl8'); + $this->byXPath("//input[@name='ctl0\$body\$ctl9' and @value='Disagree']")->click(); + $this->assertNotVisible('ctl0_body_ctl8'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php b/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php index 22031235..214b1596 100755 --- a/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php @@ -1,56 +1,56 @@ <?php -class QuickstartRadioButtonTestCase extends PradoGenericSeleniumTest +class QuickstartRadioButtonTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TRadioButton.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TRadioButton.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // a regular radiobutton - $this->click("//input[@name='ctl0\$body\$ctl0' and @value='ctl0\$body\$ctl0']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl0' and @value='ctl0\$body\$ctl0']")->click(); // a radiobutton with customized value - $this->click("//input[@name='ctl0\$body\$ctl1' and @value='value']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl1' and @value='value']")->click(); // an auto postback radiobutton - $this->verifyTextNotPresent("I'm clicked"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']", ""); - $this->verifyTextPresent("I'm clicked"); - $this->click("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']", ""); - $this->verifyTextPresent("I'm clicked"); + $this->assertNotContains("I'm clicked", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']")->click(); + $this->assertContains("I'm clicked", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']")->click(); + $this->assertContains("I'm clicked", $this->source()); // a radiobutton causing validation on a textbox - $this->verifyNotVisible('ctl0_body_ctl3'); - $this->click("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", ""); + $this->assertNotVisible('ctl0_body_ctl3'); + $this->byXPath("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']")->click(); $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl3'); - $this->click("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", ""); + $this->assertVisible('ctl0_body_ctl3'); + $this->byXPath("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']")->click(); $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl3'); + $this->assertVisible('ctl0_body_ctl3'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", ""); - $this->verifyNotVisible('ctl0_body_ctl3'); + $this->byXPath("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']")->click(); + $this->assertNotVisible('ctl0_body_ctl3'); // a radiobutton validated by a required field validator - $this->verifyNotVisible('ctl0_body_ctl6'); - $this->click("//input[@type='submit' and @value='Submit']", ""); + $this->assertNotVisible('ctl0_body_ctl6'); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl6'); - $this->click("//input[@name='ctl0\$body\$RadioButton' and @value='ctl0\$body\$RadioButton']", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->verifyNotVisible('ctl0_body_ctl6'); + $this->assertVisible('ctl0_body_ctl6'); + $this->byXPath("//input[@name='ctl0\$body\$RadioButton' and @value='ctl0\$body\$RadioButton']")->click(); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertNotVisible('ctl0_body_ctl6'); // a radiobutton group - $this->clickAndWait("name=ctl0\$body\$ctl7", ""); - $this->verifyTextPresent("Your selection is empty"); - $this->click("//input[@name='ctl0\$body\$RadioGroup' and @value='ctl0\$body\$Radio2']", ""); - $this->clickAndWait("name=ctl0\$body\$ctl7", ""); - $this->verifyTextPresent("Your selection is 2"); - $this->click("//input[@name='ctl0\$body\$RadioGroup' and @value='ctl0\$body\$Radio3']", ""); - $this->click("//input[@name='ctl0\$body\$Radio4' and @value='ctl0\$body\$Radio4']", ""); - $this->clickAndWait("name=ctl0\$body\$ctl7", ""); - $this->verifyTextPresent("Your selection is 34"); + $this->byName("ctl0\$body\$ctl7")->click(); + $this->assertContains("Your selection is empty", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$RadioGroup' and @value='ctl0\$body\$Radio2']")->click(); + $this->byName("ctl0\$body\$ctl7")->click(); + $this->assertContains("Your selection is 2", $this->source()); + $this->byXPath("//input[@name='ctl0\$body\$RadioGroup' and @value='ctl0\$body\$Radio3']")->click(); + $this->byXPath("//input[@name='ctl0\$body\$Radio4' and @value='ctl0\$body\$Radio4']")->click(); + $this->byName("ctl0\$body\$ctl7")->click(); + $this->assertContains("Your selection is 34", $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/Repeater1TestCase.php b/tests/FunctionalTests/quickstart/Controls/Repeater1TestCase.php index 948055e1..4d7db9b3 100755 --- a/tests/FunctionalTests/quickstart/Controls/Repeater1TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Repeater1TestCase.php @@ -1,27 +1,27 @@ <?php -class QuickstartRepeater1TestCase extends PradoGenericSeleniumTest +class QuickstartRepeater1TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TRepeater.Sample1&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TRepeater.Sample1&notheme=true&lang=en"); // verify if all required texts are present - $this->verifyTextPresent('ID',''); - $this->verifyTextPresent('Name',''); - $this->verifyTextPresent('Quantity',''); - $this->verifyTextPresent('Price',''); - $this->verifyTextPresent('Imported',''); - $this->verifyTextPresent('ITN001',''); - $this->verifyTextPresent('Motherboard',''); - $this->verifyTextPresent('Yes',''); - $this->verifyTextPresent('ITN019',''); - $this->verifyTextPresent('Speaker',''); - $this->verifyTextPresent('No',''); - $this->verifyTextPresent('Computer Parts Inventory',''); + $this->assertContains('ID', $this->source()); + $this->assertContains('Name', $this->source()); + $this->assertContains('Quantity', $this->source()); + $this->assertContains('Price', $this->source()); + $this->assertContains('Imported', $this->source()); + $this->assertContains('ITN001', $this->source()); + $this->assertContains('Motherboard', $this->source()); + $this->assertContains('Yes', $this->source()); + $this->assertContains('ITN019', $this->source()); + $this->assertContains('Speaker', $this->source()); + $this->assertContains('No', $this->source()); + $this->assertContains('Computer Parts Inventory', $this->source()); // verify specific table tags - $this->verifyElementPresent("//td[@colspan='5']"); - $this->verifyElementPresent("//table[@cellpadding='2']"); + $this->assertElementPresent("//td[@colspan='5']"); + $this->assertElementPresent("//table[@cellpadding='2']"); } } diff --git a/tests/FunctionalTests/quickstart/Controls/Repeater2TestCase.php b/tests/FunctionalTests/quickstart/Controls/Repeater2TestCase.php index 7d989fd0..8eb8c863 100755 --- a/tests/FunctionalTests/quickstart/Controls/Repeater2TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Repeater2TestCase.php @@ -1,35 +1,35 @@ <?php -class QuickstartRepeater2TestCase extends PradoGenericSeleniumTest +class QuickstartRepeater2TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TRepeater.Sample2&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TRepeater.Sample2&notheme=true&lang=en"); // verify if all required texts are present - $this->verifyTextPresent('North',''); - $this->verifyTextPresent('John',''); - $this->verifyTextPresent('Developer',''); - $this->verifyTextPresent('South',''); - $this->verifyTextPresent('Carter',''); - $this->verifyTextPresent('Program Manager',''); + $this->assertContains('North', $this->source()); + $this->assertContains('John', $this->source()); + $this->assertContains('Developer', $this->source()); + $this->assertContains('South', $this->source()); + $this->assertContains('Carter', $this->source()); + $this->assertContains('Program Manager', $this->source()); // verify specific table tags - $this->verifyElementPresent("//table[@cellspacing='1']"); - $this->verifyElementPresent("//td[@id='ctl0_body_Repeater_ctl1_Cell' and contains(text(),'North')]",""); - $this->verifyElementPresent("//td[@id='ctl0_body_Repeater_ctl1_Cell']",""); - $this->verifyElementPresent("//td[@id='ctl0_body_Repeater_ctl2_Cell']",""); - $this->verifyElementPresent("//td[@id='ctl0_body_Repeater_ctl3_Cell']",""); - $this->verifyElementPresent("//td[@id='ctl0_body_Repeater_ctl4_Cell']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl1_Repeater2_ctl1_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl1_Repeater2_ctl2_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl1_Repeater2_ctl3_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl2_Repeater2_ctl1_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl2_Repeater2_ctl2_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl2_Repeater2_ctl3_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl3_Repeater2_ctl1_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl3_Repeater2_ctl2_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl4_Repeater2_ctl1_Row']",""); - $this->verifyElementPresent("//tr[@id='ctl0_body_Repeater_ctl4_Repeater2_ctl2_Row']",""); + $this->assertElementPresent("//table[@cellspacing='1']"); + $this->assertElementPresent("//td[@id='ctl0_body_Repeater_ctl1_Cell' and contains(text(),'North')]",""); + $this->assertElementPresent("//td[@id='ctl0_body_Repeater_ctl1_Cell']",""); + $this->assertElementPresent("//td[@id='ctl0_body_Repeater_ctl2_Cell']",""); + $this->assertElementPresent("//td[@id='ctl0_body_Repeater_ctl3_Cell']",""); + $this->assertElementPresent("//td[@id='ctl0_body_Repeater_ctl4_Cell']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl1_Repeater2_ctl1_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl1_Repeater2_ctl2_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl1_Repeater2_ctl3_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl2_Repeater2_ctl1_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl2_Repeater2_ctl2_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl2_Repeater2_ctl3_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl3_Repeater2_ctl1_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl3_Repeater2_ctl2_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl4_Repeater2_ctl1_Row']",""); + $this->assertElementPresent("//tr[@id='ctl0_body_Repeater_ctl4_Repeater2_ctl2_Row']",""); } } diff --git a/tests/FunctionalTests/quickstart/Controls/Repeater3TestCase.php b/tests/FunctionalTests/quickstart/Controls/Repeater3TestCase.php index a5031af5..3572a36f 100755 --- a/tests/FunctionalTests/quickstart/Controls/Repeater3TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Repeater3TestCase.php @@ -1,35 +1,35 @@ <?php -class QuickstartRepeater3TestCase extends PradoGenericSeleniumTest +class QuickstartRepeater3TestCase extends PradoGenericSelenium2Test { function test() { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TRepeater.Sample3&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TRepeater.Sample3&notheme=true&lang=en"); // verify product name is required - $this->verifyNotVisible('ctl0_body_Repeater_ctl0_ctl0'); + $this->assertNotVisible('ctl0_body_Repeater_ctl0_ctl0'); $this->type("ctl0_body_Repeater_ctl0_ProductName", ""); - $this->click("//input[@type='submit' and @value='Save']", ""); - $this->verifyVisible('ctl0_body_Repeater_ctl0_ctl0'); + $this->byXPath("//input[@type='submit' and @value='Save']")->click(); + $this->assertVisible('ctl0_body_Repeater_ctl0_ctl0'); // verify product price is of proper format - $this->verifyNotVisible('ctl0_body_Repeater_ctl0_ctl1'); + $this->assertNotVisible('ctl0_body_Repeater_ctl0_ctl1'); $this->type("ctl0_body_Repeater_ctl0_ProductPrice", "abc"); - $this->click("//input[@type='submit' and @value='Save']", ""); - $this->verifyVisible('ctl0_body_Repeater_ctl0_ctl1'); + $this->byXPath("//input[@type='submit' and @value='Save']")->click(); + $this->assertVisible('ctl0_body_Repeater_ctl0_ctl1'); // perform postback - $this->click("ctl0_body_Repeater_ctl0_ProductImported",''); + $this->byId("ctl0_body_Repeater_ctl0_ProductImported",'')->click(); $this->type("ctl0_body_Repeater_ctl0_ProductName", "Mother Board"); $this->type("ctl0_body_Repeater_ctl0_ProductPrice", "99.01"); - $this->select("ctl0_body_Repeater_ctl3_ProductCategory", "label=Accessories"); - $this->clickAndWait("//input[@type='submit' and @value='Save']", ""); - $this->verifyNotVisible('ctl0_body_Repeater_ctl0_ctl0'); - $this->verifyNotVisible('ctl0_body_Repeater_ctl0_ctl1'); + $this->select("ctl0_body_Repeater_ctl3_ProductCategory", "Accessories"); + $this->byXPath("//input[@type='submit' and @value='Save']")->click(); + $this->assertNotVisible('ctl0_body_Repeater_ctl0_ctl0'); + $this->assertNotVisible('ctl0_body_Repeater_ctl0_ctl1'); // verify postback results - $this->verifyElementPresent("//td[text()='Mother Board']",''); - $this->verifyElementNotPresent("//td[text()='Input Devices']",''); - $this->verifyElementPresent("//td[text()='99.01']",''); + $this->assertElementPresent("//td[text()='Mother Board']",''); + $this->assertElementNotPresent("//td[text()='Input Devices']",''); + $this->assertElementPresent("//td[text()='99.01']",''); } } diff --git a/tests/FunctionalTests/quickstart/Controls/StatementsTestCase.php b/tests/FunctionalTests/quickstart/Controls/StatementsTestCase.php index a7c4c579..df0e6f89 100755 --- a/tests/FunctionalTests/quickstart/Controls/StatementsTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/StatementsTestCase.php @@ -1,13 +1,13 @@ <?php -class QuickstartStatementsTestCase extends PradoGenericSeleniumTest +class QuickstartStatementsTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TStatements.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TStatements.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); - $this->verifyTextPresent('UniqueID is \'ctl0$body$ctl0\''); + $this->assertContains('UniqueID is \'ctl0$body$ctl0\'', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/TabPanelTestCase.php b/tests/FunctionalTests/quickstart/Controls/TabPanelTestCase.php index d01e824d..13392ca5 100755 --- a/tests/FunctionalTests/quickstart/Controls/TabPanelTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/TabPanelTestCase.php @@ -1,47 +1,47 @@ <?php -class QuickstartTabPanelTestCase extends PradoGenericSeleniumTest +class QuickstartTabPanelTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TTabPanel.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TTabPanel.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // verify initial visibility - $this->verifyNotVisible('ctl0_body_View1'); // view 1 - $this->verifyVisible('ctl0_body_View2'); // view 2 - $this->verifyNotVisible('ctl0_body_ctl2'); // view 3 + $this->assertNotVisible('ctl0_body_View1'); // view 1 + $this->assertVisible('ctl0_body_View2'); // view 2 + $this->assertNotVisible('ctl0_body_ctl2'); // view 3 // switching to the first view - $this->click('ctl0_body_View1_0'); + $this->byId('ctl0_body_View1_0')->click(); $this->pause(500); - $this->verifyVisible('ctl0_body_View1'); // view 1 - $this->verifyNotVisible('ctl0_body_View2'); // view 2 - $this->verifyNotVisible('ctl0_body_ctl2'); // view 3 - $this->verifyNotVisible('ctl0_body_View11'); // view 11 - $this->verifyVisible('ctl0_body_View21'); // view 21 + $this->assertVisible('ctl0_body_View1'); // view 1 + $this->assertNotVisible('ctl0_body_View2'); // view 2 + $this->assertNotVisible('ctl0_body_ctl2'); // view 3 + $this->assertNotVisible('ctl0_body_View11'); // view 11 + $this->assertVisible('ctl0_body_View21'); // view 21 // switching to View11 - $this->click('ctl0_body_View11_0'); + $this->byId('ctl0_body_View11_0')->click(); $this->pause(500); - $this->verifyVisible('ctl0_body_View1'); // view 1 - $this->verifyNotVisible('ctl0_body_View2'); // view 2 - $this->verifyNotVisible('ctl0_body_ctl2'); // view 3 - $this->verifyVisible('ctl0_body_View11'); // view 11 - $this->verifyNotVisible('ctl0_body_View21'); // view 21 + $this->assertVisible('ctl0_body_View1'); // view 1 + $this->assertNotVisible('ctl0_body_View2'); // view 2 + $this->assertNotVisible('ctl0_body_ctl2'); // view 3 + $this->assertVisible('ctl0_body_View11'); // view 11 + $this->assertNotVisible('ctl0_body_View21'); // view 21 // switching to the third view - $this->click('ctl0_body_ctl2_0'); + $this->byId('ctl0_body_ctl2_0')->click(); $this->pause(500); - $this->verifyNotVisible('ctl0_body_View1'); // view 1 - $this->verifyNotVisible('ctl0_body_View2'); // view 2 - $this->verifyVisible('ctl0_body_ctl2'); // view 3 + $this->assertNotVisible('ctl0_body_View1'); // view 1 + $this->assertNotVisible('ctl0_body_View2'); // view 2 + $this->assertVisible('ctl0_body_ctl2'); // view 3 // submit: check if the visibility is kept - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->verifyNotVisible('ctl0_body_View1'); // view 1 - $this->verifyNotVisible('ctl0_body_View2'); // view 2 - $this->verifyVisible('ctl0_body_ctl2'); // view 3 + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertNotVisible('ctl0_body_View1'); // view 1 + $this->assertNotVisible('ctl0_body_View2'); // view 2 + $this->assertVisible('ctl0_body_ctl2'); // view 3 } } diff --git a/tests/FunctionalTests/quickstart/Controls/TableTestCase.php b/tests/FunctionalTests/quickstart/Controls/TableTestCase.php index 128f4b22..aafd6f80 100755 --- a/tests/FunctionalTests/quickstart/Controls/TableTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/TableTestCase.php @@ -1,18 +1,18 @@ <?php -class QuickstartTableTestCase extends PradoGenericSeleniumTest +class QuickstartTableTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TTable.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TTable.Home&notheme=true&lang=en"); - $this->verifyElementPresent("//table[@rules='all' and @border='1']"); - $this->verifyElementPresent("//table/caption[@align='bottom' and text()='This is table caption']"); - $this->verifyElementPresent("//th[text()='header cell 2']"); - $this->verifyElementPresent("//tr[@align='right']/td[text()='text']"); - $this->verifyElementPresent("//td[@align='center' and contains(text(),'cell 5')]"); + $this->assertElementPresent("//table[@rules='all' and @border='1']"); + $this->assertElementPresent("//table/caption[@align='bottom' and text()='This is table caption']"); + $this->assertElementPresent("//th[text()='header cell 2']"); + $this->assertElementPresent("//tr[@align='right']/td[text()='text']"); + $this->assertElementPresent("//td[@align='center' and contains(text(),'cell 5')]"); - $this->verifyElementPresent("//th[text()='Header 1']"); - $this->verifyElementPresent("//td[text()='Cell 1']"); + $this->assertElementPresent("//th[text()='Header 1']"); + $this->assertElementPresent("//td[text()='Cell 1']"); } } diff --git a/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php b/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php index a3464702..3865e33d 100755 --- a/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php @@ -1,58 +1,58 @@ <?php -class QuickstartTextBoxTestCase extends PradoGenericSeleniumTest +class QuickstartTextBoxTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TTextBox.Home&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TTextBox.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // a normal textbox $this->type("ctl0\$body\$ctl0", "test"); // textbox with maxlength set - $this->verifyAttribute("ctl0\$body\$ctl1@size","4"); - $this->verifyAttribute("ctl0\$body\$ctl1@maxlength","6"); + $this->assertAttribute("ctl0\$body\$ctl1@size","4"); + $this->assertAttribute("ctl0\$body\$ctl1@maxlength","6"); $this->type("ctl0\$body\$ctl1", "textte"); // vCard textboxes - $this->verifyAttribute("ctl0\$body\$ctl2@vcard_name","vCard.FirstName"); + $this->assertAttribute("ctl0\$body\$ctl2@vcard_name","vCard.FirstName"); $this->type("ctl0\$body\$ctl2", "first"); - $this->verifyAttribute("ctl0\$body\$ctl3@vcard_name","vCard.LastName"); + $this->assertAttribute("ctl0\$body\$ctl3@vcard_name","vCard.LastName"); $this->type("ctl0\$body\$ctl3", "last"); // a disabled textbox - $this->verifyAttribute("ctl0\$body\$ctl4@disabled","regexp:true|disabled"); + $this->assertAttribute("ctl0\$body\$ctl4@disabled","regexp:true|disabled"); // a read-only textbox - $this->verifyAttribute("ctl0\$body\$ctl5@readonly","regexp:true|readonly"); + $this->assertAttribute("ctl0\$body\$ctl5@readonly","regexp:true|readonly"); // auto postback textbox, CausesValidation=false - $this->verifyValue("ctl0\$body\$ctl6", "change me"); - $this->typeAndWait("ctl0\$body\$ctl6", "change mes"); - $this->verifyValue("ctl0\$body\$ctl6", "text changed"); + $this->assertValue("ctl0\$body\$ctl6", "change me"); + $this->typeSpecial("ctl0\$body\$ctl6", "change mes"); + $this->assertValue("ctl0\$body\$ctl6", "text changed"); // auto postback textbox, CausesValidation=true - $this->verifyNotVisible('ctl0_body_ctl7'); - $this->type("ctl0\$body\$TextBox3", "test"); + $this->assertNotVisible('ctl0_body_ctl7'); + $this->typeSpecial("ctl0\$body\$TextBox3", "test"); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl7'); - $this->typeAndWait("ctl0\$body\$TextBox3", "non test"); - $this->verifyNotVisible('ctl0_body_ctl7'); + $this->assertVisible('ctl0_body_ctl7'); + $this->typeSpecial("ctl0\$body\$TextBox3", "non test"); + $this->assertNotVisible('ctl0_body_ctl7'); // submitting textbox with a button $this->type("ctl0\$body\$TextBox1", "texttext"); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->verifyValue("ctl0\$body\$TextBox1", "You just entered 'texttext'."); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); + $this->assertValue("ctl0\$body\$TextBox1", "You just entered 'texttext'."); // SafeText - $this->verifyText("ctl0_body_Output","test"); - $this->typeAndWait("ctl0\$body\$TextBox2","<a href=javascript:xxx>malicious code</a>"); - $this->verifyText("ctl0_body_Output","malicious code"); + $this->assertText("ctl0_body_Output","test"); + $this->typeSpecial("ctl0\$body\$TextBox2","<a href=javascript:xxx>malicious code</a>"); + $this->assertText("ctl0_body_Output","malicious code"); // password - $this->verifyAttribute("ctl0\$body\$ctl9@type","password"); + $this->assertAttribute("ctl0\$body\$ctl9@type","password"); // ------------------multiline textbox---------------------- @@ -64,28 +64,28 @@ End of message "); // a disabled multiline textbox - $this->verifyAttribute("ctl0\$body\$ctl12@disabled","regexp:true|disabled"); + $this->assertAttribute("ctl0\$body\$ctl12@disabled","regexp:true|disabled"); // a read-only multiline textbox - $this->verifyAttribute("ctl0\$body\$ctl13@readonly","regexp:true|readonly"); - $this->verifyAttribute("ctl0\$body\$ctl13@wrap","off"); + $this->assertAttribute("ctl0\$body\$ctl13@readonly","regexp:true|readonly"); + $this->assertAttribute("ctl0\$body\$ctl13@wrap","off"); // auto postback textbox - $this->verifyValue("ctl0\$body\$ctl14", "change me"); - $this->typeAndWait("ctl0\$body\$ctl14", "change mes"); - $this->verifyValue("ctl0\$body\$ctl14", "text changed"); - $this->verifyValue("ctl0\$body\$ctl10", "This is a\nmultiline\ntextbox."); - $this->verifyValue("ctl0\$body\$ctl11", "This is a multiline text box. + $this->assertValue("ctl0\$body\$ctl14", "change me"); + $this->typeSpecial("ctl0\$body\$ctl14", "change mes"); + $this->assertValue("ctl0\$body\$ctl14", "text changed"); + $this->assertValue("ctl0\$body\$ctl10", "This is a\nmultiline\ntextbox."); + $this->assertValue("ctl0\$body\$ctl11", "This is a multiline text box. In HTML, it is displayed as a textarea. End of message "); // textbox associated with a validator - $this->verifyNotVisible('ctl0_body_ctl15'); - $this->type("ctl0\$body\$MultiTextBox3", "demo"); + $this->assertNotVisible('ctl0_body_ctl15'); + $this->typeSpecial("ctl0\$body\$MultiTextBox3", "demo"); // $this->pause(1000); - $this->verifyVisible('ctl0_body_ctl15'); - $this->typeAndWait("ctl0\$body\$MultiTextBox3", "non demo"); - $this->verifyNotVisible('ctl0_body_ctl15'); + $this->assertVisible('ctl0_body_ctl15'); + $this->typeSpecial("ctl0\$body\$MultiTextBox3", "non demo"); + $this->assertNotVisible('ctl0_body_ctl15'); } } diff --git a/tests/FunctionalTests/quickstart/Controls/Wizard1TestCase.php b/tests/FunctionalTests/quickstart/Controls/Wizard1TestCase.php index 5e7018c4..7ac55349 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard1TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard1TestCase.php @@ -1,24 +1,24 @@ <?php -class QuickstartWizard1TestCase extends PradoGenericSeleniumTest +class QuickstartWizard1TestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample1&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample1&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // step 1 - $this->verifyTextPresent('Wizard Step 1'); - $this->verifyTextNotPresent('Wizard Step 2'); - $this->verifyVisible('ctl0_body_Wizard1_SideBarList_ctl0_SideBarButton'); - $this->verifyAttribute('ctl0_body_Wizard1_SideBarList_ctl1_SideBarButton@disabled','regexp:true|disabled'); - $this->select('ctl0$body$Wizard1$DropDownList1', "label=Purple"); - $this->clickAndWait('ctl0$body$Wizard1$ctl6$ctl1'); + $this->assertContains('Wizard Step 1', $this->source()); + $this->assertNotContains('Wizard Step 2', $this->source()); + $this->assertVisible('ctl0_body_Wizard1_SideBarList_ctl0_SideBarButton'); + $this->assertAttribute('ctl0_body_Wizard1_SideBarList_ctl1_SideBarButton@disabled','regexp:true|disabled'); + $this->select('ctl0$body$Wizard1$DropDownList1', "Purple"); + $this->byName('ctl0$body$Wizard1$ctl6$ctl1')->click(); // step 2 - $this->verifyTextPresent('Your favorite color is: Purple'); - $this->verifyTextNotPresent('Wizard Step 1'); - $this->verifyTextPresent('Wizard Step 2'); + $this->assertContains('Your favorite color is: Purple', $this->source()); + $this->assertNotContains('Wizard Step 1', $this->source()); + $this->assertContains('Wizard Step 2', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/Wizard2TestCase.php b/tests/FunctionalTests/quickstart/Controls/Wizard2TestCase.php index a77280ff..85ef8655 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard2TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard2TestCase.php @@ -1,24 +1,24 @@ <?php -class QuickstartWizard2TestCase extends PradoGenericSeleniumTest +class QuickstartWizard2TestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample2&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample2&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // step 1 - $this->verifyTextPresent('Please let us know your preference'); - $this->verifyTextNotPresent('Thank you for your answer'); - $this->verifyVisible('ctl0_body_Wizard1_SideBarList_ctl0_SideBarButton'); - $this->verifyAttribute('ctl0_body_Wizard1_SideBarList_ctl1_SideBarButton@disabled','regexp:true|disabled'); - $this->select('ctl0$body$Wizard1$DropDownList1', "label=Blue"); - $this->clickAndWait('ctl0$body$Wizard1$ctl6$ctl1'); + $this->assertContains('Please let us know your preference', $this->source()); + $this->assertNotContains('Thank you for your answer', $this->source()); + $this->assertVisible('ctl0_body_Wizard1_SideBarList_ctl0_SideBarButton'); + $this->assertAttribute('ctl0_body_Wizard1_SideBarList_ctl1_SideBarButton@disabled','regexp:true|disabled'); + $this->select('ctl0$body$Wizard1$DropDownList1', "Blue"); + $this->byName('ctl0$body$Wizard1$ctl6$ctl1')->click(); // step 2 - $this->verifyTextPresent('Your favorite color is: Blue'); - $this->verifyTextNotPresent('Please let us know your preference'); - $this->verifyTextPresent('Thank you for your answer'); + $this->assertContains('Your favorite color is: Blue', $this->source()); + $this->assertNotContains('Please let us know your preference', $this->source()); + $this->assertContains('Thank you for your answer', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/Wizard3TestCase.php b/tests/FunctionalTests/quickstart/Controls/Wizard3TestCase.php index ec0efe90..2568f233 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard3TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard3TestCase.php @@ -1,44 +1,44 @@ <?php -class QuickstartWizard3TestCase extends PradoGenericSeleniumTest +class QuickstartWizard3TestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample3&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample3&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // step 1 - $this->verifyTextPresent('A Mini Survey'); - $this->verifyTextPresent('PRADO QuickStart Sample'); - $this->click('ctl0_body_Wizard3_StudentCheckBox'); - $this->clickAndWait('ctl0$body$Wizard3$ctl4$ctl0'); + $this->assertContains('A Mini Survey', $this->source()); + $this->assertContains('PRADO QuickStart Sample', $this->source()); + $this->byId('ctl0_body_Wizard3_StudentCheckBox')->click(); + $this->byName('ctl0$body$Wizard3$ctl4$ctl0')->click(); // step 2 - $this->select('ctl0$body$Wizard3$DropDownList11', "label=Chemistry"); - $this->clickAndWait('ctl0$body$Wizard3$ctl5$ctl1'); + $this->select('ctl0$body$Wizard3$DropDownList11', "Chemistry"); + $this->byName('ctl0$body$Wizard3$ctl5$ctl1')->click(); // step 3 - $this->select('ctl0$body$Wizard3$DropDownList22', "label=Tennis"); - $this->clickAndWait('ctl0$body$Wizard3$ctl6$ctl1'); + $this->select('ctl0$body$Wizard3$DropDownList22', "Tennis"); + $this->byName('ctl0$body$Wizard3$ctl6$ctl1')->click(); // step 4 - $this->verifyTextPresent('You are a college student'); - $this->verifyTextPresent('You are in major: Chemistry'); - $this->verifyTextPresent('Your favorite sport is: Tennis'); + $this->assertContains('You are a college student', $this->source()); + $this->assertContains('You are in major: Chemistry', $this->source()); + $this->assertContains('Your favorite sport is: Tennis', $this->source()); // run the example again. this time we skip the page asking about major - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample3&notheme=true", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample3&notheme=true"); // step 1 - $this->clickAndWait('ctl0$body$Wizard3$ctl4$ctl0'); + $this->byName('ctl0$body$Wizard3$ctl4$ctl0')->click(); // step 3 - $this->select('ctl0$body$Wizard3$DropDownList22', "label=Baseball"); - $this->clickAndWait('ctl0$body$Wizard3$ctl6$ctl1'); + $this->select('ctl0$body$Wizard3$DropDownList22', "Baseball"); + $this->byName('ctl0$body$Wizard3$ctl6$ctl1')->click(); // step 4 - $this->verifyTextNotPresent('You are a college student'); - $this->verifyTextPresent('Your favorite sport is: Baseball'); + $this->assertNotContains('You are a college student', $this->source()); + $this->assertContains('Your favorite sport is: Baseball', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/Wizard4TestCase.php b/tests/FunctionalTests/quickstart/Controls/Wizard4TestCase.php index f2b8ad6e..41d3463e 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard4TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard4TestCase.php @@ -1,42 +1,42 @@ <?php -class QuickstartWizard4TestCase extends PradoGenericSeleniumTest +class QuickstartWizard4TestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample4&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample4&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // step 1 - $this->verifyTextPresent('Step 1 of 3'); - $this->select('ctl0_body_Wizard1_DropDownList1', "label=Cyan"); - $this->clickAndWait('ctl0_body_Wizard1_SideBarList_ctl2_SideBarButton'); + $this->assertContains('Step 1 of 3', $this->source()); + $this->select('ctl0_body_Wizard1_DropDownList1', "Cyan"); + $this->byId('ctl0_body_Wizard1_SideBarList_ctl2_SideBarButton')->click(); // step 3 - $this->verifyTextPresent('Step 3 of 3'); - $this->verifyTextPresent('Thank you for completing this survey.'); - $this->clickAndWait('ctl0_body_Wizard1_SideBarList_ctl0_SideBarButton'); + $this->assertContains('Step 3 of 3', $this->source()); + $this->assertContains('Thank you for completing this survey.', $this->source()); + $this->byId('ctl0_body_Wizard1_SideBarList_ctl0_SideBarButton')->click(); // step 1 $this->assertSelected('ctl0_body_Wizard1_DropDownList1', "Cyan"); - $this->select('ctl0_body_Wizard1_DropDownList1', "label=Black"); - $this->clickAndWait('ctl0_body_Wizard1_ctl4_ctl0'); + $this->select('ctl0_body_Wizard1_DropDownList1', "Black"); + $this->byId('ctl0_body_Wizard1_ctl4_ctl0')->click(); // step 2 - $this->verifyTextPresent('Step 2 of 3'); - $this->verifyTextPresent('Your favorite color is: Black'); - $this->clickAndWait('ctl0_body_Wizard1_ctl5_ctl0'); + $this->assertContains('Step 2 of 3', $this->source()); + $this->assertContains('Your favorite color is: Black', $this->source()); + $this->byId('ctl0_body_Wizard1_ctl5_ctl0')->click(); // step 1 - $this->verifyTextPresent('Step 1 of 3'); + $this->assertContains('Step 1 of 3', $this->source()); $this->assertSelected('ctl0_body_Wizard1_DropDownList1', "Black"); - $this->clickAndWait('ctl0_body_Wizard1_ctl4_ctl0'); + $this->byId('ctl0_body_Wizard1_ctl4_ctl0')->click(); // step 2 - $this->clickAndWait('ctl0_body_Wizard1_ctl5_ctl1'); + $this->byId('ctl0_body_Wizard1_ctl5_ctl1')->click(); // step 3 - $this->verifyTextPresent('Step 3 of 3'); + $this->assertContains('Step 3 of 3', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Controls/Wizard5TestCase.php b/tests/FunctionalTests/quickstart/Controls/Wizard5TestCase.php index eb5edb3b..4c41a074 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard5TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard5TestCase.php @@ -1,35 +1,35 @@ <?php -class QuickstartWizard5TestCase extends PradoGenericSeleniumTest +class QuickstartWizard5TestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample5&notheme=true&lang=en", ""); + $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TWizard.Sample5&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); // step 1 - $this->verifyTextPresent('Please let us know your preference'); - $this->verifyVisible('ctl0_body_Wizard1_SideBarList_ctl0_SideBarButton'); - $this->verifyVisible('ctl0_body_Wizard1_SideBarList_ctl1_SideBarButton'); - $this->verifyAttribute('ctl0_body_Wizard1_SideBarList_ctl2_SideBarButton@disabled','regexp:true|disabled'); - $this->select('ctl0_body_Wizard1_DropDownList1', "label=Cyan"); - $this->clickAndWait('ctl0$body$Wizard1$ctl4$ctl0'); + $this->assertContains('Please let us know your preference', $this->source()); + $this->assertVisible('ctl0_body_Wizard1_SideBarList_ctl0_SideBarButton'); + $this->assertVisible('ctl0_body_Wizard1_SideBarList_ctl1_SideBarButton'); + $this->assertAttribute('ctl0_body_Wizard1_SideBarList_ctl2_SideBarButton@disabled','regexp:true|disabled'); + $this->select('ctl0_body_Wizard1_DropDownList1', "Cyan"); + $this->byName('ctl0$body$Wizard1$ctl4$ctl0')->click(); // step 2 - $this->select('ctl0_body_Wizard1_Step2_DropDownList2','label=Football'); - $this->clickAndWait('ctl0$body$Wizard1$ctl6$ctl0'); + $this->select('ctl0_body_Wizard1_Step2_DropDownList2','Football'); + $this->byName('ctl0$body$Wizard1$ctl6$ctl0')->click(); // step 1 $this->assertSelected('ctl0_body_Wizard1_DropDownList1','Cyan'); - $this->clickAndWait('ctl0_body_Wizard1_SideBarList_ctl1_SideBarButton'); + $this->byId('ctl0_body_Wizard1_SideBarList_ctl1_SideBarButton')->click(); // step 2 $this->assertSelected('ctl0_body_Wizard1_Step2_DropDownList2','Football'); - $this->clickAndWait('ctl0$body$Wizard1$ctl6$ctl1'); + $this->byName('ctl0$body$Wizard1$ctl6$ctl1')->click(); // step 3 - $this->verifyTextPresent('Your favorite color is: Cyan'); - $this->verifyTextPresent('Your favorite sport is: Football'); + $this->assertContains('Your favorite color is: Cyan', $this->source()); + $this->assertContains('Your favorite sport is: Football', $this->source()); } } diff --git a/tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php b/tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php index 3d531b47..8f5557ca 100755 --- a/tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php +++ b/tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php @@ -1,32 +1,32 @@ <?php -class QuickstartHangmanTestCase extends PradoGenericSeleniumTest +class QuickstartHangmanTestCase extends PradoGenericSelenium2Test { function test () { - $this->open("../../demos/quickstart/index.php?page=Fundamentals.Samples.Hangman.Home&notheme=true&lang=en", ""); - $this->verifyTitle("Hangman Game", ""); - $this->verifyTextPresent("Medium game; you are allowed 5 misses.", ""); - $this->clickAndWait("//input[@type='submit' and @value='Play!']", ""); - $this->verifyTextPresent("You must choose a difficulty level", ""); - $this->clickAndWait("//input[@type='submit' and @value='Play!']", ""); - $this->click("//input[@name='ctl0\$body\$LevelSelection' and @value='3']", ""); - $this->clickAndWait("//input[@type='submit' and @value='Play!']", ""); - $this->verifyTextPresent("Please make a guess", ""); - $this->verifyTextPresent("maximum of 3", ""); - $this->clickAndWait("link=B", ""); - $this->clickAndWait("link=F", ""); - $this->clickAndWait("link=Give up?", ""); - $this->verifyTextPresent("You Lose", ""); - $this->clickAndWait("link=Start Again", ""); - $this->clickAndWait("//input[@type='submit' and @value='Play!']", ""); - $this->verifyTextPresent("Please make a guess", ""); - $this->verifyTextPresent("maximum of 3", ""); - $this->clickAndWait("link=Give up?", ""); - $this->verifyTextPresent("You Lose", ""); - $this->clickAndWait("link=Start Again", ""); - $this->click("//input[@name='ctl0\$body\$LevelSelection' and @value='5']", ""); - $this->clickAndWait("//input[@type='submit' and @value='Play!']", ""); - $this->verifyTextPresent("maximum of 5", ""); + $this->url("../../demos/quickstart/index.php?page=Fundamentals.Samples.Hangman.Home&notheme=true&lang=en"); + $this->assertEquals("Hangman Game", $this->title()); + $this->assertContains("Medium game; you are allowed 5 misses.", $this->source()); + $this->byXPath("//input[@type='submit' and @value='Play!']")->click(); + $this->assertContains("You must choose a difficulty level", $this->source()); + $this->byXPath("//input[@type='submit' and @value='Play!']")->click(); + $this->byXPath("//input[@name='ctl0\$body\$LevelSelection' and @value='3']")->click(); + $this->byXPath("//input[@type='submit' and @value='Play!']")->click(); + $this->assertContains("Please make a guess", $this->source()); + $this->assertContains("maximum of 3", $this->source()); + $this->byLinkText("B")->click(); + $this->byLinkText("F")->click(); + $this->byLinkText("Give up?")->click(); + $this->assertContains("You Lose", $this->source()); + $this->byLinkText("Start Again")->click(); + $this->byXPath("//input[@type='submit' and @value='Play!']")->click(); + $this->assertContains("Please make a guess", $this->source()); + $this->assertContains("maximum of 3", $this->source()); + $this->byLinkText("Give up?")->click(); + $this->assertContains("You Lose", $this->source()); + $this->byLinkText("Start Again")->click(); + $this->byXPath("//input[@name='ctl0\$body\$LevelSelection' and @value='5']")->click(); + $this->byXPath("//input[@type='submit' and @value='Play!']")->click(); + $this->assertContains("maximum of 5", $this->source()); } } |