From 94e54d3023ed89281f89125f3ad0553afb9312cb Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 5 Mar 2014 23:02:18 +0100 Subject: Started cleaning tests' selenium2 compatibility layer (cherry picked from commit 4ce02f6973aa40c313364b5ff7990f2244309790) Conflicts: tests/FunctionalTests/tickets/tests/Ticket220TestCase.php tests/FunctionalTests/tickets/tests/Ticket719TestCase.php tests/FunctionalTests/tickets/tests/Ticket769TestCase.php tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php tests/FunctionalTests/validators/tests/DatePickerTestCase.php --- .../quickstart/Controls/BulletedListTestCase.php | 26 ++-- .../quickstart/Controls/ButtonTestCase.php | 12 +- .../quickstart/Controls/CheckBoxListTestCase.php | 30 ++-- .../quickstart/Controls/CheckBoxTestCase.php | 32 ++-- .../quickstart/Controls/DataGrid1TestCase.php | 30 ++-- .../quickstart/Controls/DataGrid2TestCase.php | 40 ++--- .../quickstart/Controls/DataGrid3TestCase.php | 56 +++---- .../quickstart/Controls/DataGrid4TestCase.php | 30 ++-- .../quickstart/Controls/DataGrid5TestCase.php | 162 ++++++++++----------- .../quickstart/Controls/DataGrid6TestCase.php | 64 ++++---- .../quickstart/Controls/DataList1TestCase.php | 18 +-- .../quickstart/Controls/DataList2TestCase.php | 68 +++++---- .../quickstart/Controls/DropDownListTestCase.php | 40 ++--- .../quickstart/Controls/ExpressionTestCase.php | 4 +- .../quickstart/Controls/HtmlAreaTestCase.php | 2 +- .../quickstart/Controls/HyperLinkTestCase.php | 6 +- .../quickstart/Controls/ImageButtonTestCase.php | 14 +- .../quickstart/Controls/ImageTestCase.php | 4 +- .../quickstart/Controls/LabelTestCase.php | 14 +- .../quickstart/Controls/LinkButtonTestCase.php | 18 +-- .../quickstart/Controls/ListBoxTestCase.php | 54 +++---- .../quickstart/Controls/MultiViewTestCase.php | 22 +-- .../quickstart/Controls/PagerTestCase.php | 78 +++++----- .../quickstart/Controls/PanelTestCase.php | 12 +- .../Controls/RadioButtonListTestCase.php | 30 ++-- .../quickstart/Controls/RadioButtonTestCase.php | 46 +++--- .../quickstart/Controls/Repeater1TestCase.php | 24 +-- .../quickstart/Controls/Repeater2TestCase.php | 12 +- .../quickstart/Controls/Repeater3TestCase.php | 10 +- .../quickstart/Controls/StatementsTestCase.php | 4 +- .../quickstart/Controls/TabPanelTestCase.php | 10 +- .../quickstart/Controls/TextBoxTestCase.php | 24 +-- .../quickstart/Controls/Wizard1TestCase.php | 18 +-- .../quickstart/Controls/Wizard2TestCase.php | 18 +-- .../quickstart/Controls/Wizard3TestCase.php | 34 ++--- .../quickstart/Controls/Wizard4TestCase.php | 32 ++-- .../quickstart/Controls/Wizard5TestCase.php | 22 +-- 37 files changed, 566 insertions(+), 554 deletions(-) (limited to 'tests/FunctionalTests/quickstart/Controls') diff --git a/tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php b/tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php index f5b58b48..a23f1d1d 100755 --- a/tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php @@ -7,13 +7,13 @@ class QuickstartBulletedListTestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TBulletedList.Home&notheme=true&lang=en"); // verify if all required texts are present - $this->assertTextPresent('item 1',''); - $this->assertTextPresent('item 2',''); - $this->assertTextPresent('item 3',''); - $this->assertTextPresent('item 4',''); - $this->assertTextPresent('google',''); - $this->assertTextPresent('yahoo',''); - $this->assertTextPresent('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->assertElementPresent("//ol[@start='5']"); @@ -26,11 +26,11 @@ class QuickstartBulletedListTestCase extends PradoGenericSelenium2Test $this->assertElementPresent("//a[@href='http://www.amazon.com/']"); // verify linkbutton list - $this->clickAndWait("id=ctl0_body_ctl40", ""); - $this->assertTextPresent("You clicked google : http://www.google.com/.", ""); - $this->clickAndWait("id=ctl0_body_ctl41", ""); - $this->assertTextPresent("You clicked yahoo : http://www.yahoo.com/.", ""); - $this->clickAndWait("id=ctl0_body_ctl42", ""); - $this->assertTextPresent("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 f228de83..f5a4a979 100755 --- a/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php @@ -6,28 +6,28 @@ class QuickstartButtonTestCase extends PradoGenericSelenium2Test { $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->assertElementNotPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); - $this->clickAndWait("//input[@type='submit' and @value='click me']", ""); + $this->byXPath("//input[@type='submit' and @value='click me']")->click(); $this->assertElementPresent("//input[@type='submit' and @value=\"I'm clicked\"]"); // a command button $this->assertElementNotPresent("//input[@type='submit' and @value=\"Name: test, Param: value\"]"); - $this->clickAndWait("//input[@type='submit' and @value='click me']", ""); + $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->assertNotVisible('ctl0_body_ctl3'); - $this->click("//input[@type='submit' and @value='submit']", ""); + $this->byXPath("//input[@type='submit' and @value='submit']")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl3'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@type='submit' and @value='submit']", ""); + $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 6ab6329b..781701cf 100755 --- a/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php @@ -8,10 +8,10 @@ class QuickstartCheckBoxListTestCase extends PradoGenericSelenium2Test $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 PradoGenericSelenium2Test // 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->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertNotVisible('ctl0_body_ctl8'); - $this->click("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl8'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl9\$c0' and @value='Agree']", ""); + $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 1bacecb0..ca89b3a0 100755 --- a/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php @@ -6,48 +6,48 @@ class QuickstartCheckBoxTestCase extends PradoGenericSelenium2Test { $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->assertTextNotPresent("I'm clicked"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl2']", ""); - $this->assertTextPresent("I'm clicked"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl2']", ""); - $this->assertTextPresent("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->assertNotVisible('ctl0_body_ctl3'); - $this->click("//input[@name='ctl0\$body\$ctl4']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl3'); - $this->click("//input[@name='ctl0\$body\$ctl4']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl3'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl4']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click(); $this->assertNotVisible('ctl0_body_ctl3'); // a checkbox validated by a required field validator $this->assertNotVisible('ctl0_body_ctl6'); - $this->click("//input[@type='submit' and @value='Submit']", ""); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl6'); - $this->click("//input[@name='ctl0\$body\$CheckBox']", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); + $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->assertNotVisible('ctl0_body_ctl7'); - $this->click("//input[@name='ctl0\$body\$CheckBox2']", ""); + $this->byXPath("//input[@name='ctl0\$body\$CheckBox2']")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl7'); -// $this->clickAndWait("//input[@name='ctl0\$body\$CheckBox2' and @value='ctl0\$body\$CheckBox2']", ""); +// $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 efe2829d..4f4ca60a 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php @@ -7,23 +7,23 @@ class QuickstartDataGrid1TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample1&notheme=true&lang=en"); // verify if all required texts are present - $this->assertTextPresent('id',''); - $this->assertTextPresent('name',''); - $this->assertTextPresent('quantity',''); - $this->assertTextPresent('price',''); - $this->assertTextPresent('imported',''); - $this->assertTextPresent('ITN001',''); - $this->assertTextPresent('Motherboard',''); - $this->assertTextPresent('100',''); - $this->assertTextPresent('true',''); - $this->assertTextPresent('ITN019',''); - $this->assertTextPresent('Speaker',''); - $this->assertTextPresent('35',''); - $this->assertTextPresent('65',''); - $this->assertTextPresent('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->assertElementPresent("ctl0_body_DataGrid"); - $this->verifyAttribute("ctl0_body_DataGrid@cellpadding","2"); + $this->assertAttribute("ctl0_body_DataGrid@cellpadding","2"); } } diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php index 15a4c510..548b04e3 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php @@ -7,43 +7,43 @@ class QuickstartDataGrid2TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample2&notheme=true&lang=en"); // verify if all required texts are present - $this->assertTextPresent('Book Title',''); - $this->assertTextPresent('Publisher',''); - $this->assertTextPresent('Price',''); - $this->assertTextPresent('In-stock',''); - $this->assertTextPresent('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->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->assertTextPresent("O'Reilly Media, Inc.",''); - $this->assertTextPresent("Addison-Wesley Professional",''); + $this->assertContains("O'Reilly Media, Inc.", $this->source()); + $this->assertContains("Addison-Wesley Professional", $this->source()); // verify prices - $this->assertTextPresent("\$37.49",''); - $this->assertTextPresent("\$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->verifyAttribute('ctl0_body_DataGrid_ctl6_ctl5@checked',null); - $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->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->assertTextNotPresent('Head First Design Patterns',''); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']", ""); + $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->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']")->click(); $this->assertElementPresent('ctl0_body_DataGrid_ctl1_ctl5',''); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Book Title']", ""); - $this->assertTextPresent('Head First Design Patterns',''); + $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 0b24e2f5..f0e88996 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php @@ -7,43 +7,49 @@ class QuickstartDataGrid3TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample3&notheme=true&lang=en"); // verify the 2nd row of data - $this->assertTextPresent("Design Patterns: Elements of Reusable Object-Oriented Software", ""); - $this->assertTextPresent("Addison-Wesley Professional", ""); - $this->assertTextPresent("$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->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->assertTextPresent("Design Pattern: Elements of Reusable Object-Oriented Software", ""); - $this->assertTextPresent("Addison Wesley Professional", ""); - $this->assertTextPresent("$57.04", ""); - $this->verifyAttribute("ctl0_body_DataGrid_ctl2_ctl4@checked", null); - $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl4@disabled','regexp:true|disabled'); + $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->assertTextPresent("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->assertTextNotPresent("Design Patterns Explained : A New Perspective on Object-Oriented Design", ""); - - $this->assertTextPresent("Extreme Programming Explained : Embrace Change",''); - $this->click("id=ctl0_body_DataGrid_ctl6_ctl9", ""); - $this->verifyConfirmationDismiss("Are you sure?"); - $this->assertTextPresent("Extreme Programming Explained : Embrace Change",''); + $this->byId("ctl0_body_DataGrid_ctl3_ctl9")->click(); + + $this->assertEquals("Are you sure?", $this->alertText()); + $this->acceptAlert(); + + $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 f78e52c4..f67f5634 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid4TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid4TestCase.php @@ -7,22 +7,22 @@ class QuickstartDataGrid4TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample4&notheme=true&lang=en"); // verify the 2nd row of data - $this->assertTextPresent("Design Patterns: Elements of Reusable Object-Oriented Software", ""); - $this->assertTextPresent("Addison-Wesley Professional", ""); - $this->assertTextPresent("$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->verifyAttribute('ctl0_body_DataGrid_ctl1_ctl5@checked', null); - $this->clickAndWait("link=Publisher", ""); - $this->verifyAttribute('ctl0_body_DataGrid_ctl6_ctl5@checked', null); - $this->clickAndWait("link=Price", ""); - $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl5@checked', null); - $this->clickAndWait("link=In-stock", ""); - $this->verifyAttribute('ctl0_body_DataGrid_ctl1_ctl5@checked', null); - $this->clickAndWait("link=Rating", ""); - $this->verifyAttribute('ctl0_body_DataGrid_ctl4_ctl5@checked', null); + $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 4ff65a64..3df22ff8 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid5TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid5TestCase.php @@ -8,106 +8,106 @@ class QuickstartDataGrid5TestCase extends PradoGenericSelenium2Test // verify if all required texts are present // verify column headers - $this->assertTextPresent('id',''); - $this->assertTextPresent('name',''); - $this->assertTextPresent('quantity',''); - $this->assertTextPresent('price',''); - $this->assertTextPresent('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->assertTextPresent('ITN001',''); - $this->assertTextPresent('ITN002',''); - $this->assertTextPresent('ITN003',''); - $this->assertTextPresent('ITN004',''); - $this->assertTextPresent('ITN005',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN006',''); - $this->assertTextPresent('ITN007',''); - $this->assertTextPresent('ITN008',''); - $this->assertTextPresent('ITN009',''); - $this->assertTextPresent('ITN010',''); - $this->assertTextNotPresent('ITN011',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN016',''); - $this->assertTextPresent('ITN017',''); - $this->assertTextPresent('ITN018',''); - $this->assertTextPresent('ITN019',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN001',''); - $this->assertTextPresent('ITN002',''); - $this->assertTextPresent('ITN003',''); - $this->assertTextPresent('ITN004',''); - $this->assertTextPresent('ITN005',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN001',''); - $this->assertTextNotPresent('ITN006',''); - $this->clickAndWait("link=Next Page", ""); - $this->assertTextNotPresent('ITN005',''); - $this->assertTextPresent('ITN006',''); - $this->assertTextNotPresent('ITN011',''); - $this->clickAndWait("link=Next Page", ""); - $this->assertTextNotPresent('ITN010',''); - $this->assertTextPresent('ITN011',''); - $this->assertTextNotPresent('ITN016',''); - $this->clickAndWait("link=Next Page", ""); - $this->assertTextNotPresent('ITN015',''); - $this->assertTextPresent('ITN016',''); - $this->clickAndWait("link=Prev Page", ""); - $this->assertTextNotPresent('ITN010',''); - $this->assertTextPresent('ITN011',''); - $this->assertTextNotPresent('ITN016',''); - $this->clickAndWait("link=Prev Page", ""); - $this->assertTextNotPresent('ITN005',''); - $this->assertTextPresent('ITN006',''); - $this->assertTextNotPresent('ITN011',''); - $this->clickAndWait("link=Prev Page", ""); - $this->assertTextPresent('ITN001',''); - $this->assertTextNotPresent('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->assertTextNotPresent('ITN010',''); - $this->assertTextPresent('ITN011',''); - $this->assertTextNotPresent('ITN016',''); - $this->clickAndWait("link=4", ""); - $this->assertTextNotPresent('ITN015',''); - $this->assertTextPresent('ITN016',''); - $this->clickAndWait("link=Prev Page", ""); - $this->assertTextNotPresent('ITN005',''); - $this->assertTextPresent('ITN006',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN001',''); - $this->assertTextPresent('ITN002',''); - $this->assertTextNotPresent('ITN003',''); - $this->clickAndWait("link=10", ""); - $this->assertTextPresent('ITN019',''); - $this->assertTextNotPresent('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 8d48fd85..54af86a8 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataGrid6TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataGrid6TestCase.php @@ -7,42 +7,42 @@ class QuickstartDataGrid6TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample6&notheme=true&lang=en"); // verify column headers - $this->assertTextPresent('id',''); - $this->assertTextPresent('name',''); - $this->assertTextPresent('quantity',''); - $this->assertTextPresent('price',''); - $this->assertTextPresent('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->assertTextPresent('ITN001',''); - $this->assertTextPresent('ITN002',''); - $this->assertTextPresent('ITN003',''); - $this->assertTextPresent('ITN004',''); - $this->assertTextPresent('ITN005',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN006',''); - $this->assertTextPresent('ITN007',''); - $this->assertTextPresent('ITN008',''); - $this->assertTextPresent('ITN009',''); - $this->assertTextPresent('ITN010',''); - $this->assertTextNotPresent('ITN011',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN016',''); - $this->assertTextPresent('ITN017',''); - $this->assertTextPresent('ITN018',''); - $this->assertTextPresent('ITN019',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN001',''); - $this->assertTextPresent('ITN002',''); - $this->assertTextPresent('ITN003',''); - $this->assertTextPresent('ITN004',''); - $this->assertTextPresent('ITN005',''); - $this->assertTextNotPresent('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 01a3b62a..436af2ad 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php @@ -7,15 +7,15 @@ class QuickstartDataList1TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample1&notheme=true&lang=en"); // verify if all required texts are present - $this->assertTextPresent('ITN001',''); - $this->assertTextPresent('$100',''); - $this->assertTextPresent('Motherboard',''); - $this->assertTextPresent('ITN018',''); - $this->assertTextPresent('Surge protector',''); - $this->assertTextPresent('45',''); - $this->assertTextPresent('$15',''); - $this->assertTextPresent('Total 19 products.',''); - $this->assertTextPresent('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->assertElementPresent("ctl0_body_DataList"); diff --git a/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php index 2957c96f..911fdc93 100755 --- a/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php @@ -7,52 +7,58 @@ class QuickstartDataList2TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample2&notheme=true&lang=en"); // verify initial presentation - $this->assertTextPresent("Motherboard", ""); - $this->assertTextPresent("Monitor", ""); + $this->assertContains("Motherboard", $this->source()); + $this->assertContains("Monitor", $this->source()); // verify selecting an item - $this->clickAndWait("link=ITN003", ""); - $this->assertTextPresent("Quantity", ""); - $this->assertTextPresent("Price", ""); - $this->assertTextPresent("\$80", ""); - $this->clickAndWait("link=ITN005", ""); - $this->assertTextPresent("\$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->assertTextPresent("\$140.99", ""); - $this->assertTextPresent("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->assertTextPresent("2", ""); - $this->assertTextPresent("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->click("id=ctl0_body_DataList_ctl5_ctl2", ""); - $this->verifyConfirmationDismiss("Are you sure?"); - $this->assertTextPresent("Motherboard", ""); - $this->assertTextPresent("CPU", ""); - $this->assertTextNotPresent("Harddrive",""); - $this->assertTextPresent("Sound card", ""); - $this->assertTextPresent("Video card", ""); - $this->assertTextPresent("Keyboard",""); - $this->assertTextPresent("Monitor", ""); + $this->byId("ctl0_body_DataList_ctl3_ctl1")->click(); + + $this->assertEquals("Are you sure?", $this->alertText()); + $this->acceptAlert(); + + $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 1b7aca5e..cb01e948 100755 --- a/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php @@ -6,7 +6,7 @@ class QuickstartDropDownListTestCase extends PradoGenericSelenium2Test { $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->assertElementPresent("ctl0\$body\$ctl0"); @@ -20,46 +20,46 @@ class QuickstartDropDownListTestCase extends PradoGenericSelenium2Test $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->assertTextNotPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", ""); - $this->selectAndWait("ctl0\$body\$ctl4", "label=item 3"); - $this->assertTextPresent("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->assertTextNotPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertNotVisible('ctl0_body_ctl6'); - $this->click("id=ctl0_body_ctl7", ""); + $this->byId("ctl0_body_ctl7")->click(); $this->assertVisible('ctl0_body_ctl6'); - $this->select("ctl0\$body\$VDropDownList1", "label=item 2"); - $this->clickAndWait("id=ctl0_body_ctl7", ""); + $this->select("ctl0\$body\$VDropDownList1", "item 2"); + $this->byId("ctl0_body_ctl7")->click(); $this->assertNotVisible('ctl0_body_ctl6'); // dropdown list causing validation $this->assertNotVisible('ctl0_body_ctl8'); - $this->select("ctl0\$body\$VDropDownList2", "label=Disagree"); + $this->select("ctl0\$body\$VDropDownList2", "Disagree"); $this->pause(1000); $this->assertVisible('ctl0_body_ctl8'); $this->type("ctl0\$body\$TextBox", "test"); - $this->selectAndWait("ctl0\$body\$VDropDownList2", "label=Agree"); + $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 7421bdf6..8c5add48 100755 --- a/tests/FunctionalTests/quickstart/Controls/ExpressionTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ExpressionTestCase.php @@ -6,8 +6,8 @@ class QuickstartExpressionTestCase extends PradoGenericSelenium2Test { $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->assertTextPresent('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 3d7de705..53ee6697 100755 --- a/tests/FunctionalTests/quickstart/Controls/HtmlAreaTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/HtmlAreaTestCase.php @@ -6,7 +6,7 @@ class QuickstartHtmlAreaTestCase extends PradoGenericSelenium2Test { $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 3c80254f..bc7ef8b8 100755 --- a/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php @@ -5,10 +5,10 @@ class QuickstartHyperLinkTestCase extends PradoGenericSelenium2Test function test () { $this->url("../../demos/quickstart/index.php?page=Controls.Samples.THyperLink.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); + $this->assertEquals("PRADO QuickStart Sample", $this->title()); $this->assertElementPresent("//a[@href=\"http://www.pradosoft.com/\" and @target=\"_blank\"]"); - $this->assertTextPresent("Welcome to", ""); - $this->assertTextPresent("Body contents", ""); + $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 4133bcbd..0f86216e 100755 --- a/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php @@ -6,23 +6,23 @@ class QuickstartImageButtonTestCase extends PradoGenericSelenium2Test { $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->assertTextPresent("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->assertTextPresent("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->assertNotVisible('ctl0_body_ctl2'); - $this->click("id=ctl0_body_ctl3", ""); + $this->byId("ctl0_body_ctl3")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl2'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("id=ctl0_body_ctl3", ""); + $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 8dcf7d9a..f3bd4775 100755 --- a/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php @@ -7,11 +7,11 @@ class QuickstartImageTestCase extends PradoGenericSelenium2Test { $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->assertElementPresent("//img[contains(@src,'/hello_world.gif') and @alt='']"); $this->assertElementPresent("//img[contains(@src,'/hello_world.gif') and @alt='Hello World!']"); - $this->assertTextPresent("Hello World! Hello World! 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 96873c00..a9aa0bbe 100755 --- a/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php @@ -6,15 +6,15 @@ class QuickstartLabelTestCase extends PradoGenericSelenium2Test function test () { $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TLabel.Home&notheme=true&lang=en"); - $this->verifyTitle("PRADO QuickStart Sample", ""); - $this->assertTextPresent("This is a label with customized color and font.", ""); - $this->assertTextPresent("This is a form label associated with the TTextBox control below", ""); - $this->assertTextPresent("This is a label with empty Text property and nonempty body", ""); - $this->assertTextPresent("This is a disabled label", ""); + $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 nonempty body", $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 65fd23fb..97b4863d 100755 --- a/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php @@ -6,27 +6,27 @@ class QuickstartLinkButtonTestCase extends PradoGenericSelenium2Test { $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->assertNotVisible('ctl0_body_ctl4'); - $this->click("link=submit", ""); + $this->byLinkText("submit")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl4'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("link=submit", ""); + $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 99bb0509..11910ba5 100755 --- a/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php @@ -8,74 +8,74 @@ class QuickstartListBoxTestCase extends PradoGenericSelenium2Test $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->assertSelected("ctl0\$body\$ctl1","item 2"); // a single selection list box with customized style - $this->verifyAttribute("ctl0\$body\$ctl2@size","3"); + $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->assertTextNotPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", ""); - $this->selectAndWait("ctl0\$body\$ctl4", "label=item 3"); - $this->assertTextPresent("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->assertTextNotPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); - $this->assertTextPresent("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->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->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->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertNotVisible('ctl0_body_ctl10'); - $this->click("id=ctl0_body_ctl11", ""); + $this->byId("ctl0_body_ctl11")->click(); $this->assertVisible('ctl0_body_ctl10'); - $this->select("ctl0\$body\$VListBox1", "label=item 2"); - $this->clickAndWait("id=ctl0_body_ctl11", ""); + $this->select("ctl0\$body\$VListBox1", "item 2"); + $this->byId("ctl0_body_ctl11")->click(); $this->assertNotVisible('ctl0_body_ctl10'); // List box causing validation $this->assertNotVisible('ctl0_body_ctl12'); - $this->select("ctl0\$body\$VListBox2", "label=Agree"); + $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->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 43e0ed8d..d7a5ebec 100755 --- a/tests/FunctionalTests/quickstart/Controls/MultiViewTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/MultiViewTestCase.php @@ -6,30 +6,30 @@ class QuickstartMultiViewTestCase extends PradoGenericSelenium2Test { $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->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->assertTextPresent('Your text input is: test'); - $this->assertTextPresent('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->assertElementNotPresent('ctl0_body_Result1'); $this->assertElementNotPresent('ctl0_body_Result2'); - $this->select('ctl0$body$DropDownList', "label=Blue"); - $this->clickAndWait('ctl0$body$ctl4'); + $this->select('ctl0$body$DropDownList', "Blue"); + $this->byName('ctl0$body$ctl4')->click(); // view 3 : check if the output is updated - $this->assertTextPresent('Your text input is: test'); - $this->assertTextPresent('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 ecbfe82d..7e4a6627 100755 --- a/tests/FunctionalTests/quickstart/Controls/PagerTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/PagerTestCase.php @@ -7,50 +7,50 @@ class QuickstartPagerTestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TPager.Sample1&notheme=true&lang=en"); // verify datalist content - $this->assertTextPresent('ITN001',''); - $this->assertTextPresent('ITN002',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN003',''); - $this->assertTextPresent('ITN004',''); - $this->assertTextNotPresent('ITN002',''); - $this->assertTextNotPresent('ITN005',''); - $this->clickAndWait("ctl0_body_Pager_ctl3", ""); // 4rd page - $this->assertTextPresent('ITN007',''); - $this->assertTextPresent('ITN008',''); - $this->assertTextNotPresent('ITN006',''); - $this->assertTextNotPresent('ITN009',''); - $this->clickAndWait("ctl0_body_Pager_ctl6", ""); // last page - $this->assertTextPresent('ITN019',''); - $this->assertTextNotPresent('ITN018',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN017',''); - $this->assertTextPresent('ITN018',''); - $this->assertTextNotPresent('ITN019',''); - $this->assertTextNotPresent('ITN016',''); - $this->clickAndWait("ctl0_body_Pager2_ctl0", ""); // first page - $this->assertTextPresent('ITN001',''); - $this->assertTextPresent('ITN002',''); - $this->assertTextNotPresent('ITN003',''); - $this->clickAndWait("ctl0_body_Pager2_ctl2", ""); // next page - $this->assertTextPresent('ITN003',''); - $this->assertTextPresent('ITN004',''); - $this->assertTextNotPresent('ITN002',''); - $this->assertTextNotPresent('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->assertTextPresent('ITN009',''); - $this->assertTextPresent('ITN010',''); - $this->assertTextNotPresent('ITN008',''); - $this->assertTextNotPresent('ITN011',''); - $this->selectAndWait("ctl0_body_Pager3_ctl0", "label=10"); - $this->assertTextPresent('ITN019',''); - $this->assertTextNotPresent('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 1360ec2f..0d3e2797 100755 --- a/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php @@ -5,12 +5,12 @@ class QuickstartPanelTestCase extends PradoGenericSelenium2Test function test () { $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TPanel.Home&notheme=true&lang=en"); - $this->assertTextPresent("This is panel content with", ""); + $this->assertContains("This is panel content with", $this->source()); $this->assertElementPresent("//span[text()='label']"); - $this->assertTextPresent("grouping text", ""); - $this->click("//input[@name='ctl0\$body\$ctl17']", ""); - $this->assertTextNotPresent("You have clicked on 'button2'."); - $this->clickAndWait("//input[@type='submit' and @value='button2']", ""); - $this->assertTextPresent("You have clicked on 'button2'."); + $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 a9092225..6242cebe 100755 --- a/tests/FunctionalTests/quickstart/Controls/RadioButtonListTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/RadioButtonListTestCase.php @@ -8,10 +8,10 @@ class QuickstartRadioButtonListTestCase extends PradoGenericSelenium2Test $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 PradoGenericSelenium2Test // 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->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertTextPresent("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->assertNotVisible('ctl0_body_ctl8'); - $this->click("//input[@name='ctl0\$body\$ctl9' and @value='Agree']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl9' and @value='Agree']")->click(); // $this->pause(1000); $this->assertVisible('ctl0_body_ctl8'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl9' and @value='Disagree']", ""); + $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 da58ce3a..214b1596 100755 --- a/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php @@ -6,51 +6,51 @@ class QuickstartRadioButtonTestCase extends PradoGenericSelenium2Test { $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->assertTextNotPresent("I'm clicked"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']", ""); - $this->assertTextPresent("I'm clicked"); - $this->click("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']", ""); - $this->assertTextPresent("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->assertNotVisible('ctl0_body_ctl3'); - $this->click("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']")->click(); $this->pause(1000); $this->assertVisible('ctl0_body_ctl3'); - $this->click("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", ""); + $this->byXPath("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']")->click(); $this->pause(1000); $this->assertVisible('ctl0_body_ctl3'); $this->type("ctl0\$body\$TextBox", "test"); - $this->clickAndWait("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", ""); + $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->assertNotVisible('ctl0_body_ctl6'); - $this->click("//input[@type='submit' and @value='Submit']", ""); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); $this->pause(1000); $this->assertVisible('ctl0_body_ctl6'); - $this->click("//input[@name='ctl0\$body\$RadioButton' and @value='ctl0\$body\$RadioButton']", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); + $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->assertTextPresent("Your selection is empty"); - $this->click("//input[@name='ctl0\$body\$RadioGroup' and @value='ctl0\$body\$Radio2']", ""); - $this->clickAndWait("name=ctl0\$body\$ctl7", ""); - $this->assertTextPresent("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->assertTextPresent("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 983e3b65..4d7db9b3 100755 --- a/tests/FunctionalTests/quickstart/Controls/Repeater1TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Repeater1TestCase.php @@ -7,18 +7,18 @@ class QuickstartRepeater1TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TRepeater.Sample1&notheme=true&lang=en"); // verify if all required texts are present - $this->assertTextPresent('ID',''); - $this->assertTextPresent('Name',''); - $this->assertTextPresent('Quantity',''); - $this->assertTextPresent('Price',''); - $this->assertTextPresent('Imported',''); - $this->assertTextPresent('ITN001',''); - $this->assertTextPresent('Motherboard',''); - $this->assertTextPresent('Yes',''); - $this->assertTextPresent('ITN019',''); - $this->assertTextPresent('Speaker',''); - $this->assertTextPresent('No',''); - $this->assertTextPresent('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->assertElementPresent("//td[@colspan='5']"); diff --git a/tests/FunctionalTests/quickstart/Controls/Repeater2TestCase.php b/tests/FunctionalTests/quickstart/Controls/Repeater2TestCase.php index a36af297..8eb8c863 100755 --- a/tests/FunctionalTests/quickstart/Controls/Repeater2TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Repeater2TestCase.php @@ -7,12 +7,12 @@ class QuickstartRepeater2TestCase extends PradoGenericSelenium2Test $this->url("../../demos/quickstart/index.php?page=Controls.Samples.TRepeater.Sample2&notheme=true&lang=en"); // verify if all required texts are present - $this->assertTextPresent('North',''); - $this->assertTextPresent('John',''); - $this->assertTextPresent('Developer',''); - $this->assertTextPresent('South',''); - $this->assertTextPresent('Carter',''); - $this->assertTextPresent('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->assertElementPresent("//table[@cellspacing='1']"); diff --git a/tests/FunctionalTests/quickstart/Controls/Repeater3TestCase.php b/tests/FunctionalTests/quickstart/Controls/Repeater3TestCase.php index 22a5ab71..3572a36f 100755 --- a/tests/FunctionalTests/quickstart/Controls/Repeater3TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Repeater3TestCase.php @@ -9,21 +9,21 @@ class QuickstartRepeater3TestCase extends PradoGenericSelenium2Test // verify product name is required $this->assertNotVisible('ctl0_body_Repeater_ctl0_ctl0'); $this->type("ctl0_body_Repeater_ctl0_ProductName", ""); - $this->click("//input[@type='submit' and @value='Save']", ""); + $this->byXPath("//input[@type='submit' and @value='Save']")->click(); $this->assertVisible('ctl0_body_Repeater_ctl0_ctl0'); // verify product price is of proper format $this->assertNotVisible('ctl0_body_Repeater_ctl0_ctl1'); $this->type("ctl0_body_Repeater_ctl0_ProductPrice", "abc"); - $this->click("//input[@type='submit' and @value='Save']", ""); + $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->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'); diff --git a/tests/FunctionalTests/quickstart/Controls/StatementsTestCase.php b/tests/FunctionalTests/quickstart/Controls/StatementsTestCase.php index 4085b005..df0e6f89 100755 --- a/tests/FunctionalTests/quickstart/Controls/StatementsTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/StatementsTestCase.php @@ -6,8 +6,8 @@ class QuickstartStatementsTestCase extends PradoGenericSelenium2Test { $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->assertTextPresent('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 3dc54ae2..13392ca5 100755 --- a/tests/FunctionalTests/quickstart/Controls/TabPanelTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/TabPanelTestCase.php @@ -6,7 +6,7 @@ class QuickstartTabPanelTestCase extends PradoGenericSelenium2Test { $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->assertNotVisible('ctl0_body_View1'); // view 1 @@ -14,7 +14,7 @@ class QuickstartTabPanelTestCase extends PradoGenericSelenium2Test $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->assertVisible('ctl0_body_View1'); // view 1 $this->assertNotVisible('ctl0_body_View2'); // view 2 @@ -23,7 +23,7 @@ class QuickstartTabPanelTestCase extends PradoGenericSelenium2Test $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->assertVisible('ctl0_body_View1'); // view 1 $this->assertNotVisible('ctl0_body_View2'); // view 2 @@ -32,14 +32,14 @@ class QuickstartTabPanelTestCase extends PradoGenericSelenium2Test $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->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->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/TextBoxTestCase.php b/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php index 0f512d2c..52095321 100755 --- a/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php @@ -6,27 +6,27 @@ class QuickstartTextBoxTestCase extends PradoGenericSelenium2Test { $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->assertValue("ctl0\$body\$ctl6", "change me"); @@ -43,7 +43,7 @@ class QuickstartTextBoxTestCase extends PradoGenericSelenium2Test // submitting textbox with a button $this->type("ctl0\$body\$TextBox1", "texttext"); - $this->clickAndWait("//input[@type='submit' and @value='Submit']", ""); + $this->byXPath("//input[@type='submit' and @value='Submit']")->click(); $this->assertValue("ctl0\$body\$TextBox1", "You just entered 'texttext'."); // SafeText @@ -52,7 +52,7 @@ class QuickstartTextBoxTestCase extends PradoGenericSelenium2Test $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,11 +64,11 @@ 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->assertValue("ctl0\$body\$ctl14", "change me"); diff --git a/tests/FunctionalTests/quickstart/Controls/Wizard1TestCase.php b/tests/FunctionalTests/quickstart/Controls/Wizard1TestCase.php index 49a92fb7..7ac55349 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard1TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard1TestCase.php @@ -6,19 +6,19 @@ class QuickstartWizard1TestCase extends PradoGenericSelenium2Test { $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->assertTextPresent('Wizard Step 1'); - $this->assertTextNotPresent('Wizard Step 2'); + $this->assertContains('Wizard Step 1', $this->source()); + $this->assertNotContains('Wizard Step 2', $this->source()); $this->assertVisible('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->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->assertTextPresent('Your favorite color is: Purple'); - $this->assertTextNotPresent('Wizard Step 1'); - $this->assertTextPresent('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 23881968..85ef8655 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard2TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard2TestCase.php @@ -6,19 +6,19 @@ class QuickstartWizard2TestCase extends PradoGenericSelenium2Test { $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->assertTextPresent('Please let us know your preference'); - $this->assertTextNotPresent('Thank you for your answer'); + $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->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->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->assertTextPresent('Your favorite color is: Blue'); - $this->assertTextNotPresent('Please let us know your preference'); - $this->assertTextPresent('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 d58ca4fe..2568f233 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard3TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard3TestCase.php @@ -6,39 +6,39 @@ class QuickstartWizard3TestCase extends PradoGenericSelenium2Test { $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->assertTextPresent('A Mini Survey'); - $this->assertTextPresent('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->assertTextPresent('You are a college student'); - $this->assertTextPresent('You are in major: Chemistry'); - $this->assertTextPresent('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->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->assertTextNotPresent('You are a college student'); - $this->assertTextPresent('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 fa565abb..41d3463e 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard4TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard4TestCase.php @@ -6,37 +6,37 @@ class QuickstartWizard4TestCase extends PradoGenericSelenium2Test { $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->assertTextPresent('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->assertTextPresent('Step 3 of 3'); - $this->assertTextPresent('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->assertTextPresent('Step 2 of 3'); - $this->assertTextPresent('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->assertTextPresent('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->assertTextPresent('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 8fbd59c5..4c41a074 100755 --- a/tests/FunctionalTests/quickstart/Controls/Wizard5TestCase.php +++ b/tests/FunctionalTests/quickstart/Controls/Wizard5TestCase.php @@ -6,30 +6,30 @@ class QuickstartWizard5TestCase extends PradoGenericSelenium2Test { $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->assertTextPresent('Please let us know your preference'); + $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->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->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->assertTextPresent('Your favorite color is: Cyan'); - $this->assertTextPresent('Your favorite sport is: Football'); + $this->assertContains('Your favorite color is: Cyan', $this->source()); + $this->assertContains('Your favorite sport is: Football', $this->source()); } } -- cgit v1.2.3