View Javadoc

1   /**
2    * Copyright 2004-2014 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.job;
17  
18  import junit.framework.Assert;
19  
20  import org.junit.Test;
21  import org.kuali.hr.KPMEWebTestCase;
22  import org.kuali.hr.util.HtmlUnitUtil;
23  import org.kuali.kpme.core.FunctionalTest;
24  import org.kuali.kpme.core.util.HrTestConstants;
25  
26  import com.gargoylesoftware.htmlunit.html.HtmlPage;
27  
28  /**
29   * This class needs refactored - the name job test implies that it should unit test on the Job object, especially considering it's package location.
30   *
31   *
32   */
33  @FunctionalTest
34  public class JobMaintenanceTest extends KPMEWebTestCase {
35  
36  	private static final String CALENDAR_GROUP = "BWN-CAL";
37  	private static Long jobId = 23L;//id entered in the bootstrap SQL
38  	private static Long jobNumber = 5L;//number entered in the bootstrap SQL
39  	public static final String TEST_USER = "admin";
40  
41  	@Test
42  	public void jobMaintenancePage() throws Exception{
43  		HtmlPage lookupPage = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), HrTestConstants.Urls.JOB_MAINT_URL);
44  		lookupPage = HtmlUnitUtil.clickInputContainingText(lookupPage, "search");
45  		HtmlUnitUtil.createTempFile(lookupPage);
46  		Assert.assertTrue("Page contains admin entry", lookupPage.asText().contains("admin"));
47  		// 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.
48  		HtmlPage editPage = HtmlUnitUtil.clickAnchorContainingText(lookupPage, "edit", jobId.toString());
49  		HtmlUnitUtil.createTempFile(editPage);
50  		Assert.assertTrue("Maintenance Page contains the correct job number", editPage.asText().contains(jobNumber.toString()));
51  	}
52  
53  	@Test
54  	public void testSaveAndFetchObject() throws Exception{
55  		//Confirming the save and fetch
56  		//save an object and confirm that it can be fetched
57  	}
58  
59  	@Test
60  	public void testMaintenancePageNew() throws Exception {
61  		//create new
62  		//input the data
63  		//confirm submit works
64  	}
65  
66  	@Test
67  	public void testMaintenancePageEdit() throws Exception {
68  		HtmlPage lookupPage = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), HrTestConstants.Urls.JOB_MAINT_URL);
69  		lookupPage = HtmlUnitUtil.clickInputContainingText(lookupPage, "search");
70  		HtmlPage editPage = HtmlUnitUtil.clickAnchorContainingText(lookupPage, "edit", jobId.toString());
71  		//input bad dept, sal group, job location, pay type, pay grade
72  		//submit
73  		//confirm each error shows up
74  
75  		//use each of the above lookups to populate the page
76  		//submit
77  		//confirm submit worked
78  
79  	}
80  }
81