View Javadoc

1   /**
2    * Copyright 2005-2011 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 org.junit.Assert;
20  import org.junit.Test;
21  
22  import edu.samplu.common.ITUtil;
23  import edu.samplu.common.WebDriverLegacyITBase;
24  
25  
26  /**
27   * test that repeated ajax refreshes work
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public class AgendaEditRuleRefreshLegacyIT extends WebDriverLegacyITBase {
31  
32      @Override
33      public String getTestUrl(){
34          return ITUtil.PORTAL;
35      }
36      /**
37       * This overridden method ...
38       * 
39       * @see edu.samplu.common.WebDriverLegacyITBase#getTestUrl()
40       */
41      
42      @Test
43      /**
44       * test that repeated ajax refreshes work
45       */
46      public void testAgendaEditRuleRefreshIT() throws Exception {
47          waitAndClickByLinkText("Agenda Lookup");
48          waitForPageToLoad();
49          selectFrame("iframeportlet");
50          waitAndClickByXpath("//div[@class='uif-boxLayout uif-horizontalBoxLayout clearfix']/button[1]"); //  waitAndClick("id=32");
51          Thread.sleep(3000);
52          waitAndClickByXpath("//a[@title='edit Agenda Definition withAgenda Id=T1000 ']", "Does user have edit permissions?"); // waitAndClick("id=194_line0");
53          checkForIncidentReport("");
54          Thread.sleep(3000);
55          waitAndClickByXpath("//li/a[@class='agendaNode ruleNode']"); // waitAndClick("//li[@id='473_node_0_parent_root']/a");
56          waitAndClickByXpath("//li/a[@class='agendaNode logicNode whenTrueNode']");
57          waitAndClickByLinkText("[-] collapse all");
58  
59          // click refresh  several times
60          for (int i = 0; i < 6; i++) {
61              for (int second = 0;; second++) {
62                  if (second >= 60)
63                      Assert.fail("timeout");
64                  try {
65                      if (isElementPresent(".kr-refresh-button"))
66                          break;
67                  } catch (Exception e) {}
68                  Thread.sleep(1000);
69              }
70  
71              waitAndClick("button.kr-refresh-button");
72          }
73      }
74      
75  }
76