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.WebDriverLegacyITBase;
20  
21  import org.junit.Test;
22  
23  import static org.junit.Assert.assertEquals;
24  import static org.junit.Assert.assertTrue;
25  import static org.junit.Assert.fail;
26  
27  /**
28   * tests that the parent line variable is available in a sub collection
29   *
30   * <p>configuration done in /edu/sampleu/demo/kitchensink/UifComponentsViewP7.xml on bean id="subCollection1"</p>
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  public class ParentLineLegacyIT extends WebDriverLegacyITBase {
35      @Override
36      public String getTestUrl() {
37          return "/kr-krad/uicomponents?methodToCall=start&readOnlyFields=field91&viewId=UifCompView_KNS#UifCompView-Page7";
38      }
39  
40      @Test
41      /**
42       * tests that the size of a sub collection is correctly displayed using the parentLine el variable
43       */
44      public void testSubCollectionSize() throws Exception {
45          checkForIncidentReport("link=Collections");
46  //        // click on collections page link
47          waitAndClickByLinkText("Collections");
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 >= 30)
51                  fail("timeout");
52              try { 
53                  if(getText("div.uif-group.uif-collectionGroup.uif-tableCollectionGroup.uif-tableSubCollection.uif-disclosure span.uif-headerText-span").equals("SubCollection - (3 lines)"))
54                  {
55                      break;
56                  }
57                            
58              }
59              catch (Exception e) {}
60              Thread.sleep(1000);
61          }
62          // verify that sub collection sizes are displayed as expected
63          assertEquals("SubCollection - (3 lines)", getText("div.uif-group.uif-collectionGroup.uif-tableCollectionGroup.uif-tableSubCollection.uif-disclosure span.uif-headerText-span"));
64          assertEquals("SubCollection - (2 lines)", getTextByXpath("//a[@id='subCollection1_line1_toggle']/span"));
65          
66          
67      }
68  }