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