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