summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/validators/tests/ListControlTestCase.php
blob: 55e370c54cc5b769b9000d612f23160c70593064 (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
<?php
/*
 * Created on 24/04/2006
 */

class ListControlTestCase extends PradoGenericSelenium2Test
{
	function test()
	{
		$base = "ctl0_Content_";
		$this->url("validators/index.php?page=ListControl");
		$this->assertContains("List Control Required Field Validation Test", $this->source());
		$this->byXPath("//input[@type='submit' and @value='Submit!']")->click();

		$this->assertVisible("{$base}validator1");
		$this->assertVisible("{$base}validator2");
		$this->assertVisible("{$base}validator3");
		$this->assertVisible("{$base}validator4");

		$this->byXPath("//input[@id='{$base}list1_c1' and @value='Red']")->click();
		$this->select("{$base}list2", "Red");
		$this->select("{$base}list3", "Blue");
		$this->byId("{$base}list4_c3")->click();
		$this->byXPath("//input[@type='submit' and @value='Submit!']")->click();

		$this->assertNotVisible("{$base}validator1");
		$this->assertNotVisible("{$base}validator2");
		$this->assertNotVisible("{$base}validator3");
		$this->assertNotVisible("{$base}validator4");

		//invalid selector: Unable to locate an element with the xpath expression .//option[.='Don\'t select this one'] because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string './/option[.='Don\'t select this one']' is not a valid XPath expression.
		$this->select("{$base}list3", "Dont select this one");
		$this->byId("{$base}list4_c0")->click();
		$this->select("{$base}list2", "--- Select a color ---");
		$this->byXPath("//input[@type='submit' and @value='Submit!']")->click();
		$this->byXPath("//input[@id='{$base}list1_c1' and @value='Red']")->click();
		$this->byXPath("//input[@id='{$base}list1_c0' and @value='Select a color below']")->click();
		$this->byXPath("//input[@type='submit' and @value='Submit!']")->click();

		$this->assertVisible("{$base}validator1");
		$this->assertVisible("{$base}validator2");
		$this->assertVisible("{$base}validator3");
		$this->assertVisible("{$base}validator4");

	}

}