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.time.department;
17  
18  import org.junit.Assert;
19  import org.junit.Test;
20  import org.kuali.hr.test.KPMETestCase;
21  import org.kuali.hr.time.test.HtmlUnitUtil;
22  import org.kuali.hr.time.test.TkTestConstants;
23  import org.kuali.rice.krad.service.KRADServiceLocator;
24  
25  import com.gargoylesoftware.htmlunit.html.HtmlPage;
26  
27  public class DepartmentTest extends KPMETestCase {
28  	@Test
29  	public void testDepartmentMaint() throws Exception {
30  		HtmlPage deptLookup = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), TkTestConstants.Urls.DEPT_MAINT_URL);
31  		deptLookup = HtmlUnitUtil.clickInputContainingText(deptLookup, "search");
32  		Assert.assertTrue("Page contains test dept", deptLookup.asText().contains("TEST"));
33  		HtmlUnitUtil.createTempFile(deptLookup);
34  		HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(deptLookup, "edit","100");
35  
36  		Assert.assertTrue("Maintenance Page contains test dept",maintPage.asText().contains("TEST"));
37  		Assert.assertTrue("Maintenance Page contains test dept",maintPage.asText().contains("Time Department Admin"));
38  	}
39  	
40  	@Override
41  	public void setUp() throws Exception {
42  		super.setUp();
43  		Department dept = new Department();
44  		dept.setHrDeptId("1001");
45  		dept.setDept("__TEST");
46  		dept.setDescription("TESTING_DEPT");
47  		dept.setActive(true);
48          dept.setLocation("BL");
49  		KRADServiceLocator.getBusinessObjectService().save(dept);
50  	}
51  }