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(getWebClient(), TkTestConstants.Urls.LEAVE_CALENDAR_URL+"?documentId=1000", true);
60 Assert.assertNotNull("Leave Request page not found" ,leaveCalendarPage);
61
62
63
64 Assert.assertTrue("Page does not have Current calendar ", leaveCalendarPage.asText().contains("March 2012"));
65
66
67 HtmlButton nextButton = (HtmlButton) leaveCalendarPage
68 .getElementById("nav_next_lc");
69 Assert.assertNotNull(nextButton);
70
71 HtmlPage page = nextButton.click();
72 Assert.assertNotNull(page);
73
74
75 HtmlButton prevButton = (HtmlButton) page
76 .getElementById("nav_prev_lc");
77 Assert.assertNotNull(prevButton);
78 page = prevButton.click();
79 Assert.assertNotNull(page);
80
81 }
82
83 }