1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.overtime.weekly.rule;
17
18 import org.junit.Assert;
19 import org.junit.Test;
20 import org.kuali.hr.time.test.HtmlUnitUtil;
21
22 import com.gargoylesoftware.htmlunit.html.HtmlElement;
23 import com.gargoylesoftware.htmlunit.html.HtmlForm;
24 import com.gargoylesoftware.htmlunit.html.HtmlInput;
25 import com.gargoylesoftware.htmlunit.html.HtmlPage;
26
27
28 public class WeeklyOvertimeRuleGroupMaintenanceTest extends WeeklyOvertimeRuleMaintenanceTest {
29
30 protected static final String OVERTIME_EARN_GROUP="OVT";
31 @Test
32
33 public void testSubmitWeeklyOvertimeRuleGroupMaint() throws Exception {
34 String baseUrl = HtmlUnitUtil.getBaseURL() + "/kr/maintenance.do?businessObjectClassName=org.kuali.hr.time.overtime.weekly.rule.WeeklyOvertimeRuleGroup&methodToCall=edit";
35 HtmlPage page = HtmlUnitUtil.gotoPageAndLogin(baseUrl);
36 Assert.assertNotNull(page);
37
38 HtmlForm form = page.getFormByName("KualiForm");
39 Assert.assertNotNull("Search form was missing from page.", form);
40
41 HtmlInput input = HtmlUnitUtil.getInputContainingText(form, "methodToCall.route");
42 Assert.assertNotNull("Could not locate submit button", input);
43 setFieldValue(page, "document.documentHeader.documentDescription", "test");
44 HtmlElement element = page.getElementByName("methodToCall.route");
45 HtmlPage finalPage = element.click();
46
47 Assert.assertTrue("Maintenance Page contains error messages",finalPage.asText().contains("The specified maxHoursEarnGroup '" + TEST_CODE + "' does not exist."));
48 Assert.assertTrue("Maintenance Page contains error messages",finalPage.asText().contains("The specified convertFromEarnGroup '" + TEST_CODE + "' does not exist."));
49 Assert.assertTrue("Maintenance Page contains error messages",finalPage.asText().contains("The specified convertToEarnCode '" + TEST_CODE + "' does not exist."));
50
51 setFieldValue(page, "document.newMaintainableObject.add.lstWeeklyOvertimeRules.effectiveDate", "4/01/2011");
52 setFieldValue(page, "document.newMaintainableObject.add.lstWeeklyOvertimeRules.maxHoursEarnGroup", "REG");
53 setFieldValue(page, "document.newMaintainableObject.add.lstWeeklyOvertimeRules.convertFromEarnGroup", "REG");
54 setFieldValue(page, "document.newMaintainableObject.add.lstWeeklyOvertimeRules.convertToEarnCode", OVERTIME_EARN_GROUP);
55 setFieldValue(page, "document.newMaintainableObject.add.lstWeeklyOvertimeRules.maxHours", "5");
56 setFieldValue(page, "document.newMaintainableObject.add.lstWeeklyOvertimeRules.step", "10");
57 element = page.getElementById("methodToCall.addLine.lstWeeklyOvertimeRules.(!!org.kuali.hr.time.overtime.weekly.rule.WeeklyOvertimeRule!!)");
58 Assert.assertNotNull("Missing Add Line button", element);
59
60 HtmlPage addPage = element.click();
61
62
63 Assert.assertTrue("Maintenance Page contains error messages",addPage.asText().contains("Rule already exists for step '10'."));
64 }
65
66 }