summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php
blob: 7efd69ccc715d071e2932a1aa3991531c3c19066 (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
<?php

class QuickstartDataGrid2TestCase extends PradoGenericSeleniumTest
{
	function test()
	{
		$this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample2&amp;notheme=true&amp;lang=en", "");

		// verify if all required texts are present
		$this->verifyTextPresent('Book Title','');
		$this->verifyTextPresent('Publisher','');
		$this->verifyTextPresent('Price','');
		$this->verifyTextPresent('In-stock','');
		$this->verifyTextPresent('Rating','');

		// verify book titles
		$this->verifyElementPresent("//a[@href='http://www.amazon.com/gp/product/0596007124' and text()='Head First Design Patterns']",'');
		$this->verifyElementPresent("//a[@href='http://www.amazon.com/gp/product/0321278658' and text()='Extreme Programming Explained : Embrace Change']",'');

		// verify publishers
		$this->verifyTextPresent("O'Reilly Media, Inc.",'');
		$this->verifyTextPresent("Addison-Wesley Professional",'');

		// verify prices
		$this->verifyTextPresent("\$37.49",'');
		$this->verifyTextPresent("\$38.49",'');

		// 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->assertEquals($this->getEval('this.browserbot.findElement("ctl0_body_DataGrid_ctl6_ctl5").hasAttribute("checked")'), 'false');
		$this->verifyAttribute('ctl0_body_DataGrid_ctl6_ctl5@disabled','regexp:true|disabled');

		// verify ratings
		//$this->verifyElementPresent("//img[@src='images/star5.gif']",'');
		//$this->verifyElementPresent("//img[@src='images/star2.gif']",'');

		// verify toggle column visibility
		$this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Book Title']", "");
		$this->verifyTextNotPresent('Head First Design Patterns','');
		$this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']", "");
		$this->verifyElementNotPresent('ctl0_body_DataGrid_ctl1_ctl5','');
		$this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c3' and @value='In-stock']", "");
		$this->verifyElementPresent('ctl0_body_DataGrid_ctl1_ctl5','');
		$this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$c0' and @value='Book Title']", "");
		$this->verifyTextPresent('Head First Design Patterns','');
	}
}