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 edu.samplu.common.ITUtil;
020 import edu.samplu.common.UpgradedSeleniumITBase;
021 import org.junit.Test;
022
023 import static org.junit.Assert.fail;
024
025 /**
026 * test that repeated ajax refreshes work
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029 public class AgendaEditRuleRefreshIT extends UpgradedSeleniumITBase {
030 @Override
031 public String getTestUrl() {
032 return ITUtil.PORTAL;
033 }
034
035 @Test
036 /**
037 * test that repeated ajax refreshes work
038 */
039 public void testAgendaEditRuleRefreshIT() throws Exception {
040 waitAndClick("link=Agenda Lookup");
041 waitForPageToLoad();
042 selectFrame("iframeportlet");
043 waitAndClick("css=button:contains(earch)"); // waitAndClick("id=32");
044 Thread.sleep(3000);
045 waitAndClick("css=a[title='edit Agenda Definition withAgenda Id=T1000 ']"); // waitAndClick("id=194_line0");
046 checkForIncidentReport("");
047 waitAndClick("css=div.uif-message:contains(Rule1: stub rule lorem ipsum)"); // waitAndClick("//li[@id='473_node_0_parent_root']/a");
048 waitAndClick("css=//li/a/span.uif-message:contains('When TRUE')");
049 waitAndClick("link=[-] collapse all");
050
051 // click refresh several times
052 for (int i=0; i<6; i++) {
053 for (int second = 0;; second++) {
054 if (second >= 60) fail("timeout");
055 try { if (isElementPresent("css=button.kr-refresh-button")) break; } catch (Exception e) {}
056 Thread.sleep(1000);
057 }
058
059 waitAndClick("css=button.kr-refresh-button");
060 }
061 }
062 }