1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.leave.approval;
17
18 import junit.framework.Assert;
19
20 import org.junit.After;
21 import org.junit.Before;
22 import org.junit.Ignore;
23 import org.junit.Test;
24 import org.kuali.hr.KPMEWebTestCase;
25 import org.kuali.hr.util.HtmlUnitUtil;
26 import org.kuali.kpme.core.FunctionalTest;
27 import org.kuali.kpme.tklm.utils.TkTestConstants;
28
29 import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
30 import com.gargoylesoftware.htmlunit.html.HtmlElement;
31 import com.gargoylesoftware.htmlunit.html.HtmlPage;
32
33 @FunctionalTest
34 public class LeaveRequestWebTest extends KPMEWebTestCase {
35
36 @Before
37 public void setUp() throws Exception {
38 super.setUp();
39 }
40
41 @After
42 public void tearDown() throws Exception {
43 super.tearDown();
44 }
45
46 @Test
47 @Ignore
48 public void testLeaveRequestPage() throws Exception {
49
50 HtmlPage leaveRequestPage = HtmlUnitUtil
51 .gotoPageAndLogin(getWebClient(), TkTestConstants.Urls.LEAVE_REQUEST_PAGE_URL);
52 Assert.assertNotNull("Leave Request page not found" + leaveRequestPage);
53
54
55 Assert.assertTrue("Page does not contain planned leave ", leaveRequestPage
56 .asText().contains("Send for Approval"));
57
58
59 Assert.assertTrue("Page does not contain approved leaves ", leaveRequestPage
60 .asText().contains("Approved Leave"));
61
62
63 Assert.assertTrue("Page does not contain approved leaves ", leaveRequestPage
64 .asText().contains("Disapprove"));
65
66 HtmlCheckBoxInput htmlElement = (HtmlCheckBoxInput) leaveRequestPage
67 .getElementByName("plannedLeaves[0].submit");
68 leaveRequestPage = (HtmlPage) htmlElement.setValueAttribute("true");
69
70 HtmlCheckBoxInput checkbox = (HtmlCheckBoxInput) HtmlUnitUtil
71 .getInputContainingText(leaveRequestPage,
72 "plannedLeaves[0].submit");
73 checkbox.setChecked(true);
74
75 HtmlElement elementSubmit = leaveRequestPage.getElementByName("Submit");
76 Assert.assertNotNull(elementSubmit);
77
78 HtmlUnitUtil.createTempFile(leaveRequestPage);
79
80 HtmlPage leaveRequestPage1 = elementSubmit.click();
81
82 HtmlUnitUtil.createTempFile(leaveRequestPage1);
83
84
85
86 Assert.assertTrue("Page does not contain Pending leave ", leaveRequestPage1
87 .asText().contains("Send for Approval"));
88
89 }
90
91 }