View Javadoc

1   /**
2    * Copyright 2005-2013 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  package edu.sampleu.travel;
17  
18  import com.thoughtworks.selenium.SeleneseTestBase;
19  import org.junit.Test;
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * Tests the Component section in Rice.
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public class CollectionTotallingAft extends WebDriverLegacyITBase {
28  
29      /**
30       * "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91";
31       */
32      public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=Demo-CollectionTotaling&methodToCall=start";
33  
34      @Override
35      protected String getBookmarkUrl() {
36          return BOOKMARK_URL;
37      }
38  
39      protected void navigate() throws InterruptedException {
40          waitAndClickKRAD();
41          waitAndClickByXpath(KUALI_COLLECTION_TOTALLING_XPATH);
42          switchToWindow(KUALI_COLLECTION_TOTALLING_WINDOW_XPATH);               
43      }
44  
45      //Code for KRAD Test Package.
46      protected void testCollectionTotalling() throws Exception {
47          //Scenario Asserts Changes in Total at client side
48          assertEquals("333",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));
49          clearTextByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']");
50          waitAndTypeByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']","10");
51          waitAndClickByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']");
52          Thread.sleep(2000);
53          assertEquals("338",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));        
54          
55          //Scenario Asserts Changes in Total at client side on keyUp
56          assertEquals("333",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));
57          clearTextByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']");
58          waitAndTypeByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']","10");
59          Thread.sleep(2000);
60          assertEquals("338",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tfoot/tr/th[2]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));        
61          
62          //Totalling Flexibility
63          assertEquals("82",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section3']/div[@role='grid']/table/tfoot/tr/th[3]/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-message']"));
64  
65          //Left Total Labels
66          assertEquals("Page Total:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section4']/div[@role='grid']/table/tfoot/tr/th/div/div[@class='uif-verticalBoxLayout']/span[@class='uif-label']/label"));
67          
68          //Hide Footer
69          assertElementPresentByXpath("//div[@id='Demo-CollectionTotaling-Section5']/div[@role='grid']/table/tfoot/tr[@style='display: none;']");
70          
71          //Multiple Calculations
72          assertEquals("Page Total:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section6']/div[@role='grid']/table/tfoot/tr/th[5]/div/div[@class='uif-verticalBoxLayout']/div/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-label']/label"));
73          assertEquals("Page Average:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section6']/div[@role='grid']/table/tfoot/tr/th[5]/div/div[@class='uif-verticalBoxLayout']/div[2]/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-label']/label"));
74          assertEquals("Page Min:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section6']/div[@role='grid']/table/tfoot/tr/th[5]/div/div[@class='uif-verticalBoxLayout']/div[3]/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-label']/label"));
75          assertEquals("Page Max:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section6']/div[@role='grid']/table/tfoot/tr/th[5]/div/div[@class='uif-verticalBoxLayout']/div[4]/fieldset/div/div[@class='uif-verticalBoxLayout']/div[@data-role='pageTotal']/span[@class='uif-label']/label"));
76          
77          //Group Totaling
78          assertEquals("Group Total:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section7']/div[@role='grid']/table/tbody/tr[7]/td/div/span/label"));
79      }
80  
81      @Test
82      public void testCollectionTotallingBookmark() throws Exception {
83          testCollectionTotalling();
84          passed();
85      }
86  
87      @Test
88      public void testCollectionTotallingNav() throws Exception {
89          testCollectionTotalling();
90          passed();
91      }
92  }