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.time.clock.log;
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.tklm.utils.TkTestConstants;
024
025import com.gargoylesoftware.htmlunit.html.HtmlInput;
026import com.gargoylesoftware.htmlunit.html.HtmlPage;
027
028@FunctionalTest
029public class ClockLogMaintenanceTest extends KPMEWebTestCase{
030        private static Long TEST_CODE_INVALID_TASK_ID =9999L;
031        private static Long TEST_CODE_INVALID_WORK_AREA_ID =9999L;
032        private static Long clockLogId = 1L;    
033        
034        @Test
035        public void testClockLogMaint() throws Exception {
036        /*      HtmlPage clockLogLookUp = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), TkTestConstants.Urls.CLOCK_LOG_MAINT_URL);
037                clockLogLookUp = HtmlUnitUtil.clickInputContainingText(clockLogLookUp, "search");
038                Assert.assertTrue("Page contains test ClockLog", clockLogLookUp.asText().contains("TEST"));             
039                HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(clockLogLookUp, "edit",clockLogId.toString());              
040                Assert.assertTrue("Maintenance Page contains test ClockLog",maintPage.asText().contains("TEST"));               
041        }
042        
043        @Test
044        public void testClockLogMaintForErrorMessages() throws Exception {
045                HtmlPage clockLogLookUp = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), TkTestConstants.Urls.CLOCK_LOG_MAINT_URL);
046                clockLogLookUp = HtmlUnitUtil.clickInputContainingText(clockLogLookUp, "search");
047                Assert.assertTrue("Page contains test ClockLog", clockLogLookUp.asText().contains("TEST"));             
048                HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(clockLogLookUp, "edit",clockLogId.toString());              
049                Assert.assertTrue("Maintenance Page contains test ClockLog",maintPage.asText().contains("TEST"));
050                
051                HtmlInput inputForDescription = HtmlUnitUtil.getInputContainingText(
052                                maintPage, "* Document Description");
053                inputForDescription.setValueAttribute("Test_Description");
054                HtmlUnitUtil.setFieldValue(maintPage, "document.newMaintainableObject.workArea", TEST_CODE_INVALID_WORK_AREA_ID.toString());
055                HtmlUnitUtil.setFieldValue(maintPage, "document.newMaintainableObject.task", TEST_CODE_INVALID_TASK_ID.toString());
056                HtmlPage resultantPageAfterEdit = HtmlUnitUtil
057                                .clickInputContainingText(maintPage, "submit");
058                HtmlUnitUtil.createTempFile(resultantPageAfterEdit);
059                
060                Assert.assertTrue("Maintenance Page contains test Workarea ",
061                                resultantPageAfterEdit.asText().contains(
062                                                "The specified Workarea '"
063                                                                + TEST_CODE_INVALID_WORK_AREA_ID
064                                                                + "' does not exist."));
065                
066                HtmlUnitUtil.createTempFile(resultantPageAfterEdit);
067                
068                Assert.assertTrue("Maintenance Page contains test Task ",
069                                resultantPageAfterEdit.asText().contains(
070                                                "The specified Task '"
071                                                                + TEST_CODE_INVALID_TASK_ID
072                                                                + "' does not exist."));
073                
074        */      
075        }
076        
077}