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