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 edu.samplu.common.SmokeTestBase;
20  import org.junit.Test;
21  
22  import edu.samplu.common.ITUtil;
23  
24  /**
25   * test that repeated ajax refreshes work
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class AgendaEditRuleRefreshSmokeTest extends SmokeTestBase {
29  
30      public static final String BOOKMARK_URL =ITUtil.PORTAL+"?channelTitle=Agenda%20Lookup&channelUrl="
31              + ITUtil.getBaseUrlString() + ITUtil.KRAD_LOOKUP_METHOD
32              + "org.kuali.rice.krms.impl.repository.AgendaBo"
33              + ITUtil.SHOW_MAINTENANCE_LINKS
34              + "&returnLocation=" + ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK;
35  
36      @Override
37      protected String getBookmarkUrl() {
38          return BOOKMARK_URL;
39      }
40  
41      @Override
42      protected void navigate() throws Exception {
43          waitAndClickByLinkText(AGENDA_LOOKUP_LINK_TEXT);
44          waitForPageToLoad();
45      }
46  
47      protected void testAgendaEditRuleRefresh() throws Exception {
48          selectFrameIframePortlet();
49          waitAndClickButtonByText("Search");
50          //        waitAndClickByXpath("//div[@class='uif-boxLayout uif-horizontalBoxLayout clearfix']/button[1]"); //  jiraAwareWaitAndClick("id=32");
51          Thread.sleep(3000);
52          waitAndClickByXpath("//a[@title='edit Agenda Definition with Agenda Id=T1000']",
53                  "Does user have edit permissions?"); // jiraAwareWaitAndClick("id=194_line0");
54          checkForIncidentReport("");
55          Thread.sleep(3000);
56          waitAndClickByXpath("//li/a[@class='agendaNode ruleNode']"); // jiraAwareWaitAndClick("//li[@id='473_node_0_parent_root']/a");
57          waitAndClickByXpath("//li/a[@class='agendaNode logicNode whenTrueNode']");
58          waitAndClickByLinkText("[-] collapse all");
59  
60          // click refresh  several times
61          for (int i = 0; i < 6; i++) {
62              for (int second = 0;; second++) {
63                  if (second >= waitSeconds)
64                      failableFail(TIMEOUT_MESSAGE);
65                  try {
66                      if (isElementPresent(".kr-refresh-button"))
67                          break;
68                  } catch (Exception e) {}
69                  Thread.sleep(1000);
70              }
71              waitAndClick("button.kr-refresh-button");
72          }
73          passed();
74      }
75  
76      /**
77       * test that repeated ajax refreshes work
78       */
79      @Test
80      public void testAgendaEditRuleRefreshBookmark() throws Exception {
81          testAgendaEditRuleRefresh();
82      }
83  
84      /**
85       * test that repeated ajax refreshes work
86       */
87      @Test
88      public void testAgendaEditRuleRefreshNav() throws Exception {
89          testAgendaEditRuleRefresh();
90      }
91  }
92