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.job; 017 018import junit.framework.Assert; 019 020import org.junit.Test; 021import org.kuali.hr.KPMEWebTestCase; 022import org.kuali.hr.util.HtmlUnitUtil; 023import org.kuali.kpme.core.FunctionalTest; 024import org.kuali.kpme.core.util.HrTestConstants; 025 026import com.gargoylesoftware.htmlunit.html.HtmlPage; 027 028/** 029 * This class needs refactored - the name job test implies that it should unit test on the Job object, especially considering it's package location. 030 * 031 * 032 */ 033@FunctionalTest 034public class JobMaintenanceTest extends KPMEWebTestCase { 035 036 private static final String CALENDAR_GROUP = "BWN-CAL"; 037 private static Long jobId = 23L;//id entered in the bootstrap SQL 038 private static Long jobNumber = 5L;//number entered in the bootstrap SQL 039 public static final String TEST_USER = "admin"; 040 041 @Test 042 public void jobMaintenancePage() throws Exception{ 043 /*HtmlPage lookupPage = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), HrTestConstants.Urls.JOB_MAINT_URL); 044 lookupPage = HtmlUnitUtil.clickInputContainingText(lookupPage, "search"); 045 HtmlUnitUtil.createTempFile(lookupPage); 046 Assert.assertTrue("Page contains admin entry", lookupPage.asText().contains("admin")); 047 // xichen, changed to edit jobId 23, because clickAnchorContainingText() is a wild search. The test was editing jobId 1, it returned the first entry whose jobId starts with 1. 048 HtmlPage editPage = HtmlUnitUtil.clickAnchorContainingText(lookupPage, "edit", jobId.toString()); 049 HtmlUnitUtil.createTempFile(editPage); 050 Assert.assertTrue("Maintenance Page contains the correct job number", editPage.asText().contains(jobNumber.toString())); 051 } 052 053 @Test 054 public void testSaveAndFetchObject() throws Exception{ 055 //Confirming the save and fetch 056 //save an object and confirm that it can be fetched 057 } 058 059 @Test 060 public void testMaintenancePageNew() throws Exception { 061 //create new 062 //input the data 063 //confirm submit works 064 } 065 066 @Test 067 public void testMaintenancePageEdit() throws Exception { 068 HtmlPage lookupPage = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), HrTestConstants.Urls.JOB_MAINT_URL); 069 lookupPage = HtmlUnitUtil.clickInputContainingText(lookupPage, "search"); 070 HtmlPage editPage = HtmlUnitUtil.clickAnchorContainingText(lookupPage, "edit", jobId.toString()); 071 //input bad dept, sal group, job location, pay type, pay grade 072 //submit 073 //confirm each error shows up 074 075 //use each of the above lookups to populate the page 076 //submit 077 //confirm submit worked*/ 078 079 } 080} 081