001 /** 002 * Copyright 2004-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.hr.time.department; 017 018 import org.junit.Assert; 019 import org.junit.Test; 020 import org.kuali.hr.test.KPMETestCase; 021 import org.kuali.hr.time.test.HtmlUnitUtil; 022 import org.kuali.hr.time.test.TkTestConstants; 023 import org.kuali.rice.krad.service.KRADServiceLocator; 024 025 import com.gargoylesoftware.htmlunit.html.HtmlPage; 026 027 public class DepartmentTest extends KPMETestCase { 028 @Test 029 public void testDepartmentMaint() throws Exception { 030 HtmlPage deptLookup = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), TkTestConstants.Urls.DEPT_MAINT_URL); 031 deptLookup = HtmlUnitUtil.clickInputContainingText(deptLookup, "search"); 032 Assert.assertTrue("Page contains test dept", deptLookup.asText().contains("TEST")); 033 HtmlUnitUtil.createTempFile(deptLookup); 034 HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(deptLookup, "edit","100"); 035 036 Assert.assertTrue("Maintenance Page contains test dept",maintPage.asText().contains("TEST")); 037 Assert.assertTrue("Maintenance Page contains test dept",maintPage.asText().contains("Time Department Admin")); 038 } 039 040 @Override 041 public void setUp() throws Exception { 042 super.setUp(); 043 Department dept = new Department(); 044 dept.setHrDeptId("1001"); 045 dept.setDept("__TEST"); 046 dept.setDescription("TESTING_DEPT"); 047 dept.setActive(true); 048 dept.setLocation("BL"); 049 KRADServiceLocator.getBusinessObjectService().save(dept); 050 } 051 }