diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2014-03-05 23:02:18 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2014-03-05 23:02:18 +0100 |
commit | 4ce02f6973aa40c313364b5ff7990f2244309790 (patch) | |
tree | 4e55faa0ff1ae31adcd3845cc94fe384fafa29ee /tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php | |
parent | 82774aa0a41562a325f31c901584ec01c8238573 (diff) |
Started cleaning tests' selenium2 compatibility layer
Diffstat (limited to 'tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php')
-rwxr-xr-x | tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php | 68 |
1 files changed, 37 insertions, 31 deletions
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()); } } |