summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/validators/tests/DatePickerTestCase.php
blob: ab7ab897fabf5f46193e174097879ea234bd1c87 (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
64
65
66
<?php

class DatePickerTestCase extends SeleniumTestCase
{
	function test()
	{	
		$base = "ctl0_Content_";
		$this->open("validators/index.php?page=DatePicker", "");
		$this->verifyTextPresent("Date Picker validation Test", "");
		$this->assertNotVisible("{$base}validator1", "");
		$this->assertNotVisible("{$base}validator2", "");
		$this->assertNotVisible("{$base}validator4", "");
		$this->assertNotVisible("{$base}validator5", "");
		$this->assertNotVisible("{$base}validator6", "");
		$this->assertNotVisible("{$base}validator8", "");
		
		$this->click("{$base}submit1");
		$this->assertVisible("{$base}validator1", "");
		$this->assertNotVisible("{$base}validator2", "");

		//the range validator is visible because the date is a drop down list
		//thus has default value != ""
		$this->assertVisible("{$base}validator4", "");
		$this->assertVisible("{$base}validator5", "");
		$this->assertNotVisible("{$base}validator6", "");
		$this->assertVisible("{$base}validator8", "");
		
		$this->click("{$base}submit1");
		$this->type("{$base}picker1", "13/4/2006");
		$this->select("{$base}picker2_month", "label=9");
		$this->select("{$base}picker2_day", "label=10");
		$this->type("{$base}picker3", "14/4/2006");
		$this->type("{$base}picker4", "7/4/2006");
		$this->select("{$base}picker5_day", "label=6");
		$this->select("{$base}picker5_month", "label=3");
		$this->select("{$base}picker5_year", "label=2007");
		$this->select("{$base}picker6_month", "label=3");
		$this->select("{$base}picker6_year", "label=2007");
		$this->select("{$base}picker6_day", "label=5");
		
		$this->click("{$base}submit1");
		
		$this->assertNotVisible("{$base}validator1", "");
		$this->assertVisible("{$base}validator2", "");
		$this->assertNotVisible("{$base}validator4", "");
		$this->assertNotVisible("{$base}validator5", "");
		$this->assertVisible("{$base}validator6", "");
		$this->assertVisible("{$base}validator8", "");		
		
		$this->type("{$base}picker1", "20/4/2007");
		$this->type("{$base}picker4", "29/4/2006");
		$this->select("{$base}picker6_day", "label=10");		
		
		$this->clickAndWait("{$base}submit1");
		
		$this->assertNotVisible("{$base}validator1", "");
		$this->assertNotVisible("{$base}validator2", "");
		$this->assertNotVisible("{$base}validator4", "");
		$this->assertNotVisible("{$base}validator5", "");
		$this->assertNotVisible("{$base}validator6", "");
		$this->assertNotVisible("{$base}validator8", "");		
	}
	
}

?>