1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.util;
17
18 import org.junit.After;
19 import org.junit.Before;
20 import org.junit.Ignore;
21 import org.junit.Test;
22
23 import com.thoughtworks.selenium.DefaultSelenium;
24 import com.thoughtworks.selenium.SeleneseTestCase;
25
26 @Ignore
27 public class UICalendarTest extends SeleneseTestCase {
28 @Before
29 public void setUp() throws Exception {
30 selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://ci.kpme.kuali.org:9080/");
31
32
33 selenium.setSpeed("1000");
34 try {
35 selenium.start();
36 } catch (Exception e) {
37
38 }
39 }
40
41
42
43
44
45
46 @Test
47 public void testAddAndDeleteTimeBlock() throws Exception {
48 openPageAndLogin("/tk-dev/TimeDetail.do");
49 selenium.waitForPageToLoad("5000");
50 selenium.click("id=day_9");
51 selenium.select("id=assignment", "value=1_1234_1");
52 selenium.type("id=beginTimeField", "08:00 AM");
53 selenium.type("id=endTimeField", "05:00 PM");
54 selenium.click("//button[@type='button']");
55 selenium.waitForPageToLoad("5000");
56 selenium.click("class=event-delete");
57 selenium.waitForPageToLoad("3000");
58 verifyFalse(selenium.isTextPresent("08:00 AM"));
59 verifyFalse(selenium.isTextPresent("05:00 PM"));
60 }
61
62
63
64
65
66
67 @Test
68 public void testTestEarnCodeSwitch() throws Exception {
69 openPageAndLogin("/tk-dev/TimeDetail.do");
70 selenium.click("id=day_10");
71 selenium.select("id=assignment", "label=work area description : $0.00 Rcd 1 TEST-DEPT");
72
73 verifyTrue(selenium.isTextPresent("exact:In:"));
74 verifyTrue(selenium.isTextPresent("exact:Out:"));
75 verifyTrue(selenium.isTextPresent("RGH : REGULAR"));
76
77 selenium.select("id=earnCode", "label=SCK : SICK");
78 verifyTrue(selenium.isTextPresent("exact:Hours:"));
79
80 selenium.select("id=earnCode", "label=TIP : Tips");
81 verifyTrue(selenium.isTextPresent("exact:Amount:"));
82 }
83
84
85
86
87
88
89 @Test
90 public void testTestClockInAndOut() throws Exception {
91 openPageAndLogin("/tk-dev/Clock.do");
92 selenium.waitForPageToLoad("3000");
93 selenium.select("id=assignment", "label=work area description : $0.00 Rcd 1 TEST-DEPT");
94
95 selenium.click("id=clock-button");
96 selenium.waitForPageToLoad("3000");
97
98 verifyEquals("Clock Out", selenium.getValue("id=clock-button"));
99
100 selenium.click("id=clock-button");
101
102 selenium.click("link=Time Detail");
103 selenium.waitForPageToLoad("3000");
104 verifyTrue(selenium.isTextPresent("exact:RGN: REGULAR"));
105 }
106
107 @After
108 public void tearDown() throws Exception {
109 selenium.stop();
110 }
111
112 private void openPageAndLogin(String pageLink) {
113 selenium.open(pageLink);
114 selenium.type("__login_user", "admin");
115 selenium.click("//input[@name='login']");
116 selenium.waitForPageToLoad("2000");
117 }
118 }
119
120