View Javadoc

1   /*
2    * Copyright 2006-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package edu.samplu.admin.test;
18  
19  import edu.samplu.common.ITUtil;
20  import edu.samplu.common.UpgradedSeleniumITBase;
21  import org.junit.Test;
22  
23  import static org.junit.Assert.fail;
24  
25  /**
26   * test that repeated ajax refreshes work
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class AgendaEditRuleRefreshIT extends UpgradedSeleniumITBase {
30      @Override
31      public String getTestUrl() {
32          return ITUtil.PORTAL;
33      }
34  
35  	@Test
36      /**
37       * test that repeated ajax refreshes work
38       */
39  	public void testAgendaEditRuleRefreshIT() throws Exception {
40  		waitAndClick("link=Agenda Lookup");
41  		waitForPageToLoad();
42  		selectFrame("iframeportlet");
43  		waitAndClick("css=button:contains(earch)"); //  waitAndClick("id=32");
44          Thread.sleep(3000);
45  		waitAndClick("css=a[title='edit Agenda Definition withAgenda Id=T1000 ']", "Does user have edit permissions?");  // waitAndClick("id=194_line0");
46          checkForIncidentReport("");
47  		waitAndClick("css=div.uif-message:contains(Rule1: stub rule lorem ipsum)"); // waitAndClick("//li[@id='473_node_0_parent_root']/a");
48          waitAndClick("css=//li/a/span.uif-message:contains('When TRUE')");
49  		waitAndClick("link=[-] collapse all");
50  
51          // click refresh  several times
52          for (int i=0; i<6; i++) {
53              for (int second = 0;; second++) {
54                  if (second >= 60) fail("timeout");
55                  try { if (isElementPresent("css=button.kr-refresh-button")) break; } catch (Exception e) {}
56                  Thread.sleep(1000);
57              }
58  
59              waitAndClick("css=button.kr-refresh-button");
60          }
61  	}
62  }