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