From 4ce02f6973aa40c313364b5ff7990f2244309790 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 --- .../quickstart/Controls/DataGrid3TestCase.php | 56 ++++++++++++---------- 1 file changed, 31 insertions(+), 25 deletions(-) (limited to 'tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php') 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()); } } -- cgit v1.2.3