1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.leave.web;
17
18 import junit.framework.Assert;
19
20 import org.joda.time.DateTime;
21 import org.junit.After;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.kuali.hr.test.KPMETestCase;
25 import org.kuali.hr.time.test.HtmlUnitUtil;
26 import org.kuali.hr.time.test.TkTestConstants;
27
28 import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
29 import com.gargoylesoftware.htmlunit.WebClient;
30 import com.gargoylesoftware.htmlunit.html.HtmlButton;
31 import com.gargoylesoftware.htmlunit.html.HtmlPage;
32
33 import java.lang.management.MemoryManagerMXBean;
34 import java.util.Calendar;
35
36 public class LeaveCalendarWebTest extends KPMETestCase {
37
38 @Before
39 public void setUp() throws Exception {
40 super.setUp();
41 }
42
43 @After
44 public void tearDown() throws Exception {
45 super.tearDown();
46 }
47
48
49
50
51
52
53
54
55 @Test
56 public void testLeaveCalendarPage() throws Exception {
57
58 HtmlPage leaveCalendarPage = HtmlUnitUtil
59 .gotoPageAndLogin(TkTestConstants.Urls.LEAVE_CALENDAR_URL+"?documentId=1000", true);
60 Assert.assertNotNull("Leave Request page not found" ,leaveCalendarPage);
61
62
63
64 DateTime dt = new DateTime();
65 Assert.assertTrue("Page does not have Current calendar ", leaveCalendarPage.asText().contains("March 2012"));
66
67
68 HtmlButton nextButton = (HtmlButton) leaveCalendarPage
69 .getElementById("nav_next_lc");
70 Assert.assertNotNull(nextButton);
71
72 HtmlPage page = nextButton.click();
73 Assert.assertNotNull(page);
74
75
76 HtmlButton prevButton = (HtmlButton) page
77 .getElementById("nav_prev_lc");
78 Assert.assertNotNull(prevButton);
79 page = prevButton.click();
80 Assert.assertNotNull(page);
81
82 }
83
84 }