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.ITUtil;
020 import edu.samplu.common.UpgradedSeleniumITBase;
021 import org.junit.Test;
022 import static org.junit.Assert.assertNotSame;
023 import static org.junit.Assert.fail;
024
025 /**
026 * tests that a line in a sub collection can be deleted
027 *
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 */
030 public class DeleteSubCollectionLineIT extends UpgradedSeleniumITBase{
031 @Override
032 public String getTestUrl() {
033 return "/kr-krad/uicomponents?viewId=UifCompView_KNS&methodToCall=start&readOnlyFields=field91";
034 }
035
036 @Test
037 /**
038 * tests that a line in a sub collection can be deleted
039 */
040 public void deleteSubCollectionLine() throws Exception {
041 // click on collections page link
042 waitAndClick("link=Collections");
043 Thread.sleep(5000);
044 // wait for collections page to load by checking the presence of a sub collection line item
045
046 waitForElementPresent("name=list4[0].subList[0].field1");
047 // change a value in the line to be deleted
048 waitAndType("name=list4[0].subList[0].field1", "selenium");
049 // click the delete button
050 waitAndClick("css=div[title='Line Summary \'A\' With Expression'].uif-group.uif-gridGroup.uif-collectionItem.uif-gridCollectionItem div.uif-group.uif-collectionGroup.uif-tableCollectionGroup.uif-tableSubCollection.uif-disclosure tr.odd button[data-loadingmessage='Deleting Line...'].uif-action.uif-secondaryActionButton.uif-smallActionButton");
051 Thread.sleep(2000);
052 // confirm that the input box containing the modified value is not present
053
054 for (int second = 0;; second++) {
055 if (second >= 60) fail("timeout");
056 try { if (!"selenium".equals(getValue("name=list4[0].subList[0].field1"))) break;} catch (Exception e) {}
057 Thread.sleep(1000);
058 }
059 // verify that the value has changed for the input box in the line that has replaced the deleted one
060 assertNotSame("selenium", getValue("name=list4[0].subList[0].field1"));
061 }
062 }