summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php
blob: 2957c96f0a6e20869c829ee2c007fead93a3faea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php

class QuickstartDataList2TestCase extends PradoGenericSelenium2Test
{
	function test()
	{
		$this->url("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample2&amp;notheme=true&amp;lang=en");

		// verify initial presentation
		$this->assertTextPresent("Motherboard", "");
		$this->assertTextPresent("Monitor", "");

		// verify selecting an item
		$this->clickAndWait("link=ITN003", "");
		$this->assertTextPresent("Quantity", "");
		$this->assertTextPresent("Price", "");
		$this->assertTextPresent("\$80", "");
		$this->clickAndWait("link=ITN005", "");
		$this->assertTextPresent("\$150", "");

		// verify editting an item
		$this->clickAndWait("id=ctl0_body_DataList_ctl5_ctl0", "");
		$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", "");

		// verify item is saved
		$this->clickAndWait("link=ITN005", "");
		$this->assertTextPresent("\$140.99", "");
		$this->assertTextPresent("11", "");

		// verify editting another item
		$this->clickAndWait("id=ctl0_body_DataList_ctl3_ctl1", "");
		$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", "");

		// verify item is canceled
		$this->clickAndWait("link=ITN003", "");
		$this->assertTextPresent("2", "");
		$this->assertTextPresent("Harddrive", "");

		// 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", "");
	}
}