View Javadoc

1   /*
2    * Copyright 2006-2012 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 com.thoughtworks.selenium.*;
20  import org.junit.After;
21  import org.junit.Before;
22  import org.junit.Test;
23  import java.util.regex.Pattern;
24  
25  /**
26   * test that repeated ajax refreshes work
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class AgendaEditRuleRefreshIT extends SeleneseTestCase {
30  	@Before
31  	public void setUp() throws Exception {
32  		selenium = new DefaultSelenium("localhost", 4444, "*chrome", System.getProperty("remote.public.url"));
33  		selenium.start();
34  	}
35  
36  	@Test
37      /**
38       * test that repeated ajax refreshes work
39       */
40  	public void testAgendaEditRuleRefreshIT() throws Exception {
41  		selenium.open("/kr-dev/portal.do");
42  		selenium.type("name=__login_user", "admin");
43  		selenium.click("css=input[type=\"submit\"]");
44  		selenium.waitForPageToLoad("30000");
45  		selenium.click("link=Agenda Lookup");
46  		selenium.waitForPageToLoad("30000");
47  		selenium.selectFrame("iframeportlet");
48  		selenium.click("id=32");
49  		selenium.waitForPageToLoad("30000");
50  		selenium.click("id=194_line0");
51  		selenium.waitForPageToLoad("30000");
52  		selenium.click("//li[@id='473_node_0_parent_root']/a");
53  		selenium.click("id=472_node_0_parent_node_0_parent_node_0_parent_root_span");
54  		selenium.click("id=361");
55  
56          // click refresh  several times
57          for (int i=0; i<6; i++) {
58              for (int second = 0;; second++) {
59                  if (second >= 60) fail("timeout");
60                  try { if (selenium.isElementPresent("id=440")) break; } catch (Exception e) {}
61                  Thread.sleep(1000);
62              }
63  
64              selenium.click("id=440");
65          }
66  	}
67  
68  	@After
69  	public void tearDown() throws Exception {
70  		selenium.stop();
71  	}
72  }