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