001/**
002 * Copyright 2004-2014 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 */
016package org.kuali.hr.core.department;
017
018import org.junit.Assert;
019import org.junit.Test;
020import org.kuali.hr.KPMEWebTestCase;
021import org.kuali.hr.util.HtmlUnitUtil;
022import org.kuali.kpme.core.FunctionalTest;
023import org.kuali.kpme.core.department.Department;
024import org.kuali.kpme.core.util.HrTestConstants;
025import org.kuali.rice.krad.service.KRADServiceLocator;
026
027import com.gargoylesoftware.htmlunit.html.HtmlPage;
028
029@FunctionalTest
030public class DepartmentTest extends KPMEWebTestCase {
031        @Test
032        public void testDepartmentMaint() throws Exception {
033                HtmlPage deptLookup = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), HrTestConstants.Urls.DEPT_MAINT_URL);
034                deptLookup = HtmlUnitUtil.clickInputContainingText(deptLookup, "search");
035                Assert.assertTrue("Page contains test dept", deptLookup.asText().contains("TEST"));
036                HtmlUnitUtil.createTempFile(deptLookup);
037                HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(deptLookup, "edit","100");
038
039                Assert.assertTrue("Maintenance Page contains test dept",maintPage.asText().contains("TEST"));
040                Assert.assertTrue("Maintenance Page contains test dept",maintPage.asText().contains("Time Department Admin"));
041        }
042        
043        @Override
044        public void setUp() throws Exception {
045                super.setUp();
046                Department dept = new Department();
047                dept.setHrDeptId("1001");
048                dept.setDept("__TEST");
049                dept.setDescription("TESTING_DEPT");
050                dept.setActive(true);
051        dept.setLocation("BL");
052                KRADServiceLocator.getBusinessObjectService().save(dept);
053        }
054}