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.krad.compview;
18  
19  import edu.samplu.common.ITUtil;
20  import edu.samplu.common.UpgradedSeleniumITBase;
21  import org.junit.Test;
22  import static org.junit.Assert.assertNotSame;
23  import static org.junit.Assert.fail;
24  
25  /**
26   * tests that a line in a sub collection can be deleted
27   *
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public class DeleteSubCollectionLineIT extends UpgradedSeleniumITBase{
31      @Override
32      public String getTestUrl() {
33          return  "/kr-krad/uicomponents?viewId=UifCompView_KNS&methodToCall=start&readOnlyFields=field91";
34      }
35  
36      @Test
37      /**
38       * tests that a line in a sub collection can be deleted
39       */
40      public void deleteSubCollectionLine() throws Exception {
41          // click on collections page link
42          waitAndClick("link=Collections");
43          Thread.sleep(5000);
44          // wait for collections page to load by checking the presence of a sub collection line item
45  
46          waitForElementPresent("name=list4[0].subList[0].field1");
47          // change a value in the line to be deleted
48          waitAndType("name=list4[0].subList[0].field1", "selenium");
49          // click the delete button
50          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");
51          Thread.sleep(2000);
52          // confirm that the input box containing the modified value is not present
53          
54          for (int second = 0;; second++) {
55              if (second >= 60) fail("timeout");
56              try { if (!"selenium".equals(getValue("name=list4[0].subList[0].field1"))) break;} catch (Exception e) {}
57              Thread.sleep(1000);
58          }
59          // verify that the value has changed for the input box in the line that has replaced the deleted one
60          assertNotSame("selenium", getValue("name=list4[0].subList[0].field1"));
61      }
62  }