View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.core.department;
17  
18  import org.junit.Assert;
19  import org.junit.Test;
20  import org.kuali.hr.KPMEWebTestCase;
21  import org.kuali.hr.util.HtmlUnitUtil;
22  import org.kuali.kpme.core.FunctionalTest;
23  import org.kuali.kpme.core.department.Department;
24  import org.kuali.kpme.core.util.HrTestConstants;
25  import org.kuali.rice.krad.service.KRADServiceLocator;
26  
27  import com.gargoylesoftware.htmlunit.html.HtmlPage;
28  
29  @FunctionalTest
30  public class DepartmentTest extends KPMEWebTestCase {
31  	@Test
32  	public void testDepartmentMaint() throws Exception {
33  		HtmlPage deptLookup = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), HrTestConstants.Urls.DEPT_MAINT_URL);
34  		deptLookup = HtmlUnitUtil.clickInputContainingText(deptLookup, "search");
35  		Assert.assertTrue("Page contains test dept", deptLookup.asText().contains("TEST"));
36  		HtmlUnitUtil.createTempFile(deptLookup);
37  		HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(deptLookup, "edit","100");
38  
39  		Assert.assertTrue("Maintenance Page contains test dept",maintPage.asText().contains("TEST"));
40  		Assert.assertTrue("Maintenance Page contains test dept",maintPage.asText().contains("Time Department Admin"));
41  	}
42  	
43  	@Override
44  	public void setUp() throws Exception {
45  		super.setUp();
46  		Department dept = new Department();
47  		dept.setHrDeptId("1001");
48  		dept.setDept("__TEST");
49  		dept.setDescription("TESTING_DEPT");
50  		dept.setActive(true);
51          dept.setLocation("BL");
52  		KRADServiceLocator.getBusinessObjectService().save(dept);
53  	}
54  }