summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php
blob: 800e36ff4c959eadbf80e40d906498551605e9cd (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
61
62
63
<?php

class ImageButtonTestCase extends PradoGenericSelenium2Test
{
	function test()
	{
		$this->url('validators/index.php?page=ImageButton');


		// verify all error messages are invisible
		$this->assertNotVisible('ctl0_Content_ctl0');
		$this->assertNotVisible('ctl0_Content_ctl2');
		$this->assertNotVisible('ctl0_Content_ctl4');

		// verify the first validator shows the error
		$this->byId("ctl0_Content_ctl1")->click();
		$this->assertVisible('ctl0_Content_ctl0');
		$this->assertNotVisible('ctl0_Content_ctl2');
		$this->assertNotVisible('ctl0_Content_ctl4');

		// verify the first validation is passed
		$this->pause(500);
		$this->assertNotContains('Button1 is clicked', $this->source());
		$this->type("ctl0_Content_TextBox1", "test");
		$this->byId("ctl0_Content_ctl1")->click();
		$this->assertNotVisible('ctl0_Content_ctl0');
		$this->assertNotVisible('ctl0_Content_ctl2');
		$this->assertNotVisible('ctl0_Content_ctl4');
		$this->assertContains('Button1 is clicked and valid', $this->source());

		// verify the second validator shows the error
		$this->byId("ctl0_Content_ctl3")->click();
		$this->assertNotVisible('ctl0_Content_ctl0');
		$this->assertVisible('ctl0_Content_ctl2');
		$this->assertNotVisible('ctl0_Content_ctl4');

		// verify the second validation is passed
		$this->pause(500);
		$this->assertNotContains('Button2 is clicked', $this->source());
		$this->type("ctl0_Content_TextBox2", "test");
		$this->byId("ctl0_Content_ctl3")->click();
		$this->assertNotVisible('ctl0_Content_ctl0');
		$this->assertNotVisible('ctl0_Content_ctl2');
		$this->assertNotVisible('ctl0_Content_ctl4');
		$this->assertContains('Button2 is clicked and valid', $this->source());

		// verify the third validator shows the error
		$this->byId("ctl0_Content_ctl5")->click();
		$this->assertNotVisible('ctl0_Content_ctl0');
		$this->assertNotVisible('ctl0_Content_ctl2');
		$this->assertVisible('ctl0_Content_ctl4');

		// verify the third validation is passed
		$this->assertContains('Button3 is clicked', $this->source());
		$this->assertNotContains('Button3 is clicked and valid', $this->source());
		$this->type("ctl0_Content_TextBox3", "test");
		$this->byId("ctl0_Content_ctl5")->click();
		$this->assertNotVisible('ctl0_Content_ctl0');
		$this->assertNotVisible('ctl0_Content_ctl2');
		$this->assertNotVisible('ctl0_Content_ctl4');
		$this->assertContains('Button3 is clicked and valid', $this->source());
	}
}