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     */
016    package org.kuali.hr.time.clock.web;
017    
018    import org.junit.After;
019    import org.junit.Before;
020    import org.junit.Ignore;
021    import org.kuali.kpme.core.FunctionalTest;
022    
023    import com.thoughtworks.selenium.DefaultSelenium;
024    import com.thoughtworks.selenium.SeleneseTestCase;
025    
026    @Ignore
027    @FunctionalTest
028    public class ClockSeleniumTest extends SeleneseTestCase {
029            @Before
030            public void setUp() throws Exception {
031                    selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:8090/");
032                    try {
033                            selenium.start();
034                    } catch (Exception e) {
035                    }
036            }
037    
038            @Ignore
039            public void testClockSelenium() throws Exception {
040                    selenium.open("/tk-dev/Clock.do");
041                    selenium.type("__login_user", "admin");
042                    selenium.click("//input[@name='login']");
043                    selenium.waitForPageToLoad("30000");
044                    
045                    //total hours exceeds the original hours
046                    selenium.click("//input[@name='distributeTime']");
047                    selenium.waitForPopUp("distributePopup", "30000");
048                    selenium.selectWindow("distributePopup");  //select the new window
049                    selenium.getBodyText();
050                    selenium.click("//input[@name='editTimeBlock']");
051                    selenium.waitForPageToLoad("30000");
052                    selenium.click("//input[@name='addTimeBlock']");  // add two time blocks
053                    selenium.click("//input[@name='addTimeBlock']");
054                    selenium.click("//input[@name='saveTimeBlock']");
055                    assertTrue(selenium.isTextPresent("Total Hours entered not equel to the hours of the original time block"));
056                    
057                    // new time blocks has overlaps with existing time blocks
058                    selenium.type("beginTimeField", "08:15 AM");
059                    selenium.close();  // close the new window
060                    selenium.selectWindow(null); // go back to the original window
061            }
062    
063            @After
064            public void tearDown() throws Exception {
065                    selenium.stop();
066            }
067    }