001 /*
002 * Copyright 2006-2012 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
017 package edu.samplu.admin.test;
018
019 import com.thoughtworks.selenium.*;
020 import org.junit.After;
021 import org.junit.Before;
022 import org.junit.Test;
023 import java.util.regex.Pattern;
024
025 /**
026 * test that repeated ajax refreshes work
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029 public class AgendaEditRuleRefreshIT extends SeleneseTestCase {
030 @Before
031 public void setUp() throws Exception {
032 selenium = new DefaultSelenium("localhost", 4444, "*chrome", System.getProperty("remote.public.url"));
033 selenium.start();
034 }
035
036 @Test
037 /**
038 * test that repeated ajax refreshes work
039 */
040 public void testAgendaEditRuleRefreshIT() throws Exception {
041 selenium.open("/kr-dev/portal.do");
042 selenium.type("name=__login_user", "admin");
043 selenium.click("css=input[type=\"submit\"]");
044 selenium.waitForPageToLoad("30000");
045 selenium.click("link=Agenda Lookup");
046 selenium.waitForPageToLoad("30000");
047 selenium.selectFrame("iframeportlet");
048 selenium.click("id=32");
049 selenium.waitForPageToLoad("30000");
050 selenium.click("id=194_line0");
051 selenium.waitForPageToLoad("30000");
052 selenium.click("//li[@id='473_node_0_parent_root']/a");
053 selenium.click("id=472_node_0_parent_node_0_parent_node_0_parent_root_span");
054 selenium.click("id=361");
055
056 // click refresh several times
057 for (int i=0; i<6; i++) {
058 for (int second = 0;; second++) {
059 if (second >= 60) fail("timeout");
060 try { if (selenium.isElementPresent("id=440")) break; } catch (Exception e) {}
061 Thread.sleep(1000);
062 }
063
064 selenium.click("id=440");
065 }
066 }
067
068 @After
069 public void tearDown() throws Exception {
070 selenium.stop();
071 }
072 }