001 /*
002 * Copyright 2006-2012 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 */
016
017 package edu.samplu.krad.compview;
018
019 import edu.samplu.common.UpgradedSeleniumITBase;
020 import org.junit.Test;
021 import static org.junit.Assert.assertNotSame;
022 import static org.junit.Assert.fail;
023
024 /**
025 * tests that a line in a sub collection can be deleted
026 *
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029 public class DeleteSubCollectionLineIT extends UpgradedSeleniumITBase{
030 @Override
031 public String getTestUrl() {
032 return PORTAL;
033 }
034
035 @Test
036 /**
037 * tests that a line in a sub collection can be deleted
038 */
039 public void deleteSubCollectionLine() throws Exception {
040 selenium.click("link=KRAD");
041 selenium.waitForPageToLoad("30000");
042 selenium.click("link=Uif Components (Kitchen Sink)");
043 selenium.waitForPageToLoad("30000");
044 // selenium.selectFrame("iframeportlet");
045 // click on collections page link
046 selenium.click("id=u961");
047 // Thread.sleep(30000);
048 // wait for collections page to load by checking the presence of a sub collection line item
049 for (int second = 0;; second++) {
050 if (second >= 60) fail("timeout");
051 try { if (selenium.isElementPresent("id=u1089_line0_line0_control")) break; } catch (Exception e) {}
052 Thread.sleep(1000);
053 }
054 // change a value in the line to be deleted
055 selenium.type("id=u1089_line0_line0_control", "selenium");
056 // click the delete button
057 selenium.click("id=u1140_line0_line0");
058 // confirm that the input box containing the modified value is not present
059 for (int second = 0;; second++) {
060 if (second >= 60) fail("timeout");
061 try { if (!"selenium".equals(selenium.getValue("id=u1089_line0_line0_control"))) break; } catch (Exception e) {}
062 Thread.sleep(1000);
063 }
064 // verify that the value has changed for the input box in the line that has replaced the deleted one
065 assertNotSame("selenium", selenium.getValue("id=u1089_line0_line0_control"));
066 }
067 }