001/** 002 * Copyright 2005-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package edu.sampleu.admin; 017 018import org.junit.Test; 019import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils; 020import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 021import org.kuali.rice.testtools.selenium.WebDriverUtils; 022 023/** 024 * test that repeated ajax refreshes work 025 * @author Kuali Rice Team (rice.collab@kuali.org) 026 */ 027public class AgendaEditRuleRefreshAft extends WebDriverLegacyITBase { 028 029 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL+"?channelTitle=Agenda%20Lookup&channelUrl=" 030 + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD 031 + "org.kuali.rice.krms.impl.repository.AgendaBo" 032 + AutomatedFunctionalTestUtils.SHOW_MAINTENANCE_LINKS 033 + "&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK; 034 035 @Override 036 protected String getBookmarkUrl() { 037 return BOOKMARK_URL; 038 } 039 040 @Override 041 protected void navigate() throws Exception { 042 waitAndClickByLinkText(AGENDA_LOOKUP_LINK_TEXT); 043 waitForPageToLoad(); 044 } 045 046 protected void testAgendaEditRuleRefresh() throws Exception { 047 selectFrameIframePortlet(); 048 waitAndClickSearchByText(); 049 // waitAndClickByXpath("//div[@class='uif-boxLayout uif-horizontalBoxLayout clearfix']/button[1]"); // jiraAwareWaitAndClick("id=32"); 050 waitAndClickByXpath("//a[@title='edit Agenda Definition with Agenda Id=T1000']", 051 "Does user have edit permissions?"); // jiraAwareWaitAndClick("id=194_line0"); 052 waitAndClickByXpath("//li/a[@class='agendaNode ruleNode']"); // jiraAwareWaitAndClick("//li[@id='473_node_0_parent_root']/a"); 053 waitAndClickByXpath("//li/a[@class='agendaNode logicNode whenTrueNode']"); 054 waitAndClickByLinkText("[-] collapse all"); 055 056 // click refresh several times 057 for (int i = 0; i < 6; i++) { 058 for (int second = 0;; second++) { 059 if (second >= waitSeconds) 060 jiraAwareFail(TIMEOUT_MESSAGE); 061 try { 062 if (isElementPresent(".kr-refresh-button")) 063 break; 064 } catch (Exception e) {} 065 Thread.sleep(1000); 066 } 067 waitAndClick("button.kr-refresh-button"); 068 } 069 passed(); 070 } 071 072 /** 073 * test that repeated ajax refreshes work 074 */ 075 @Test 076 public void testAgendaEditRuleRefreshBookmark() throws Exception { 077 testAgendaEditRuleRefresh(); 078 } 079 080 /** 081 * test that repeated ajax refreshes work 082 */ 083 @Test 084 public void testAgendaEditRuleRefreshNav() throws Exception { 085 testAgendaEditRuleRefresh(); 086 } 087} 088