summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php
blob: c0c3399c2fe0a80ad8ab6afd721215708b3358c5 (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
59
60
<?php

class DataList2TestCase extends SeleniumTestCase
{
	function test()
	{
		$this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample2&amp;notheme=true", "");

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

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

		// verify editting an item
		$this->clickAndWait("id=ctl0_body_DataList_ctl5_ctl4", "");
		$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' and @value='ctl0\$body\$DataList\$ctl5\$ProductImported']", "");
		$this->clickAndWait("link=Save", "");

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

		// verify editting another item
		$this->clickAndWait("id=ctl0_body_DataList_ctl3_ctl2", "");
		$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' and @value='ctl0\$body\$DataList\$ctl3\$ProductImported']", "");
		$this->clickAndWait("link=Cancel", "");

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

		// verify item deletion
		$this->clickAndWait("id=ctl0_body_DataList_ctl3_ctl5", "");
		$this->verifyConfirmation("Are you sure?");
		$this->chooseCancelOnNextConfirmation();
		$this->click("id=ctl0_body_DataList_ctl5_ctl3", "");
		$this->verifyTextPresent("Motherboard ", "");
		$this->verifyTextPresent("CPU ", "");
		$this->verifyTextNotPresent("Harddrive","");
		$this->verifyTextPresent("Sound card", "");
		$this->verifyTextPresent("Video card", "");
		$this->verifyTextPresent("Keyboard","");
		$this->verifyTextPresent("Monitor ", "");
	}
}

?>