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

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

		$this->assertEquals("PRADO QuickStart Sample", $this->title());

		// a regular checkbox
		$this->byXPath("//input[@name='ctl0\$body\$ctl0']")->click();

		// a checkbox with customized value
		$this->byXPath("//input[@name='ctl0\$body\$ctl1' and @value='value']")->click();

		// an auto postback checkbox
		$this->assertNotContains("I'm clicked", $this->source());
		$this->byXPath("//input[@name='ctl0\$body\$ctl2']")->click();
		$this->assertContains("I'm clicked", $this->source());
		$this->byXPath("//input[@name='ctl0\$body\$ctl2']")->click();
		$this->assertContains("I'm clicked", $this->source());

		// a checkbox causing validation on a textbox
		$this->assertNotVisible('ctl0_body_ctl3');
		$this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click();
//		$this->pause(1000);
		$this->assertVisible('ctl0_body_ctl3');
		$this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click();
//		$this->pause(1000);
		$this->assertVisible('ctl0_body_ctl3');
		$this->type("ctl0\$body\$TextBox", "test");
		$this->byXPath("//input[@name='ctl0\$body\$ctl4']")->click();
		$this->assertNotVisible('ctl0_body_ctl3');

		// a checkbox validated by a required field validator
		$this->assertNotVisible('ctl0_body_ctl6');
		$this->byXPath("//input[@type='submit' and @value='Submit']")->click();
//		$this->pause(1000);
		$this->assertVisible('ctl0_body_ctl6');
		$this->byXPath("//input[@name='ctl0\$body\$CheckBox']")->click();
		$this->byXPath("//input[@type='submit' and @value='Submit']")->click();
		$this->assertNotVisible('ctl0_body_ctl6');

		// a checkbox validated by a required field validator using AutoPostBack
		$this->assertNotVisible('ctl0_body_ctl7');
		$this->byXPath("//input[@name='ctl0\$body\$CheckBox2']")->click();
//		$this->pause(1000);
		$this->assertVisible('ctl0_body_ctl7');
//		$this->byXPath("//input[@name='ctl0\$body\$CheckBox2' and @value='ctl0\$body\$CheckBox2']")->click();
//		$this->assertNotVisible('ctl0_body_ctl7');
	}
}