1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.core.calendar;
17
18 import org.junit.Assert;
19 import org.junit.Ignore;
20 import org.junit.Test;
21 import org.kuali.hr.KPMEWebTestCase;
22 import org.kuali.hr.util.HtmlUnitUtil;
23 import org.kuali.kpme.core.FunctionalTest;
24 import org.kuali.kpme.core.util.HrTestConstants;
25
26 import com.gargoylesoftware.htmlunit.html.HtmlElement;
27 import com.gargoylesoftware.htmlunit.html.HtmlPage;
28 import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
29
30 @FunctionalTest
31 public class PayCalendarEntriesMaintenaceTest extends KPMEWebTestCase {
32 @Override
33 public void setUp() throws Exception {
34 super.setUp();
35 }
36
37 @Override
38 public void tearDown() throws Exception {
39 super.tearDown();
40 }
41
42 @Test
43 @Ignore
44
45
46 public void testSubmitPayCalendarEntriesMaint() throws Exception {
47
48 String baseUrl = HrTestConstants.Urls.PAY_CALENDAR_ENTRY_MAINT_NEW_URL;
49 HtmlPage page = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), baseUrl);
50 Assert.assertNotNull(page);
51
52 HtmlTextInput text = (HtmlTextInput) page.getHtmlElementById("document.documentHeader.documentDescription");
53 text.setValueAttribute("test");
54 HtmlUnitUtil.createTempFile(page);
55 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "calendarName");
56 text.setValueAttribute("TTT");
57 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "beginPeriodDate");
58 text.setValueAttribute("02/21/2011");
59 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "beginPeriodTime");
60 text.setValueAttribute("08:00 am");
61 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "endPeriodDate");
62 text.setValueAttribute("02/28/2011");
63 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "endPeriodTime");
64 text.setValueAttribute("08:00 am");
65 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "batchInitiateDate");
66 text.setValueAttribute("02/16/2011");
67 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "batchInitiateTime");
68 text.setValueAttribute("08:00 am");
69 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "batchEndPayPeriodDate");
70 text.setValueAttribute("02/21/2011");
71 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "batchEndPayPeriodTime");
72 text.setValueAttribute("08:00 am");
73 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "batchEmployeeApprovalDate");
74 text.setValueAttribute("02/17/2011");
75 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "batchEmployeeApprovalTime");
76 text.setValueAttribute("08:00 am");
77 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "batchSupervisorApprovalDate");
78 text.setValueAttribute("02/18/2011");
79 text = (HtmlTextInput) page.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "batchSupervisorApprovalTime");
80 text.setValueAttribute("08:00 am");
81
82 HtmlElement element = page.getElementByName("methodToCall.route");
83 HtmlPage page1 = element.click();
84 HtmlUnitUtil.createTempFile(page1);
85
86 Assert.assertTrue("Maintenance Page contains error messages", page1.asText().contains("You must specify a valid Calendar."));
87
88 text = (HtmlTextInput) page1.getHtmlElementById(HrTestConstants.DOC_NEW_ELEMENT_ID_PREFIX + "calendarName");
89 text.setValueAttribute("BW-CAL");
90
91 element = page1.getElementByName("methodToCall.route");
92 HtmlPage page2 = element.click();
93 Assert.assertTrue("Maintenance page is submitted successfully", page2.asText().contains("Document was successfully submitted."));
94 Assert.assertTrue("Maintenance page is submitted successfully", page2.asText().contains("Status: FINAL"));
95 }
96 }