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.krad.compview;
18
19 import edu.samplu.common.UpgradedSeleniumITBase;
20 import org.junit.Test;
21 import static org.junit.Assert.assertNotSame;
22 import static org.junit.Assert.fail;
23
24 /**
25 * tests that a line in a sub collection can be deleted
26 *
27 * @author Kuali Rice Team (rice.collab@kuali.org)
28 */
29 public class DeleteSubCollectionLineIT extends UpgradedSeleniumITBase{
30 @Override
31 public String getTestUrl() {
32 return PORTAL;
33 }
34
35 @Test
36 /**
37 * tests that a line in a sub collection can be deleted
38 */
39 public void deleteSubCollectionLine() throws Exception {
40 selenium.click("link=KRAD");
41 selenium.waitForPageToLoad("30000");
42 selenium.click("link=Uif Components (Kitchen Sink)");
43 selenium.waitForPageToLoad("30000");
44 // selenium.selectFrame("iframeportlet");
45 // click on collections page link
46 selenium.click("id=u961");
47 // Thread.sleep(30000);
48 // wait for collections page to load by checking the presence of a sub collection line item
49 for (int second = 0;; second++) {
50 if (second >= 60) fail("timeout");
51 try { if (selenium.isElementPresent("id=u1089_line0_line0_control")) break; } catch (Exception e) {}
52 Thread.sleep(1000);
53 }
54 // change a value in the line to be deleted
55 selenium.type("id=u1089_line0_line0_control", "selenium");
56 // click the delete button
57 selenium.click("id=u1140_line0_line0");
58 // confirm that the input box containing the modified value is not present
59 for (int second = 0;; second++) {
60 if (second >= 60) fail("timeout");
61 try { if (!"selenium".equals(selenium.getValue("id=u1089_line0_line0_control"))) break; } catch (Exception e) {}
62 Thread.sleep(1000);
63 }
64 // verify that the value has changed for the input box in the line that has replaced the deleted one
65 assertNotSame("selenium", selenium.getValue("id=u1089_line0_line0_control"));
66 }
67 }