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.WebDriverLegacyITBase;
021
022 import org.junit.Test;
023 import org.openqa.selenium.internal.seleniumemulation.GetValue;
024
025 import static org.junit.Assert.assertNotSame;
026 import static org.junit.Assert.fail;
027
028 /**
029 * tests that a line in a sub collection can be deleted
030 *
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 */
033 public class DeleteSubCollectionLineLegacyIT extends WebDriverLegacyITBase{
034 @Override
035 public String getTestUrl() {
036 return "/kr-krad/uicomponents?viewId=UifCompView_KNS&methodToCall=start&readOnlyFields=field91";
037 }
038
039 @Test
040 /**
041 * tests that a line in a sub collection can be deleted
042 */
043 public void deleteSubCollectionLine() throws Exception {
044 // click on collections page link
045 waitAndClickByLinkText("Collections");
046 Thread.sleep(5000);
047 // wait for collections page to load by checking the presence of a sub collection line item
048
049 waitForElementPresentByName("list4[0].subList[0].field1");
050 // change a value in the line to be deleted
051 waitAndTypeByName("list4[0].subList[0].field1", "selenium");
052 // click the delete button
053 waitAndClick("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");
054 // waitAndClickByXpath("//div[@title='Line Summary \'A\' With Expression']/table/tbody/tr[1]/td[5]/div/fieldset/div/div[@class='uif-boxLayout uif-horizontalBoxLayout clearfix']/button[@data-loadingmessage='Deleting Line...']");
055 Thread.sleep(2000);
056 // confirm that the input box containing the modified value is not present
057
058 for (int second = 0;; second++) {
059 if (second >= 60) fail("timeout");
060 try {
061 System.out.println("Loop ----- "+second);
062 if (!"selenium".equals(getAttributeByName("list4[0].subList[0].field1","value")))
063 break;
064 } catch (Exception e) {}
065 Thread.sleep(1000);
066 }
067 // verify that the value has changed for the input box in the line that has replaced the deleted one
068 assertNotSame("selenium", getAttributeByName("list4[0].subList[0].field1","value"));
069 passed();
070 }
071 }