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.timezone.service;
17  
18  import java.util.LinkedHashMap;
19  import java.util.Map;
20  
21  import org.junit.Assert;
22  import org.junit.Test;
23  import org.kuali.hr.test.KPMETestCase;
24  import org.kuali.hr.time.test.HtmlUnitUtil;
25  import org.kuali.hr.time.test.TkTestConstants;
26  import org.kuali.hr.time.test.TkTestUtils;
27  
28  import com.gargoylesoftware.htmlunit.html.HtmlPage;
29  
30  public class TimezoneTest extends KPMETestCase {
31  
32  	@Test
33  	public void testClockInOutWithTimezone() throws Exception {
34  		HtmlPage page = HtmlUnitUtil.gotoPageAndLogin(TkTestConstants.Urls.CLOCK_URL,true);
35  		Assert.assertNotNull(page);
36      	
37      	Map<String, Object> criteria = new LinkedHashMap<String, Object>();
38      	criteria.put("selectedAssignment", new String[]{TkTestConstants.FormElementTypes.DROPDOWN, "30_30_30"});
39      	// choose the first assignment from the drop down
40      	page = TkTestUtils.fillOutForm(page, criteria);
41      	Assert.assertNotNull(page);
42      	// clock in
43      	page = TkTestUtils.clickButton(page, "clockAction");
44      	// clock out 
45      	page = TkTestUtils.clickButton(page, "clockAction");
46      	HtmlUnitUtil.createTempFile(page);
47      	Assert.assertTrue("Time zone information is incorrect", page.asText().contains("Eastern"));
48  	}
49  }