001 /**
002 * Copyright 2005-2013 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 package edu.sampleu.travel;
017
018 import com.thoughtworks.selenium.SeleneseTestBase;
019 import org.junit.Test;
020 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021
022 /**
023 * Tests the Component section in Rice.
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027 public class CollectionTotallingAft extends WebDriverLegacyITBase {
028
029 /**
030 * "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91";
031 */
032 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=Demo-CollectionTotaling&methodToCall=start";
033
034 @Override
035 protected String getBookmarkUrl() {
036 return BOOKMARK_URL;
037 }
038
039 protected void navigate() throws InterruptedException {
040 waitAndClickKRAD();
041 waitAndClickByXpath(KUALI_COLLECTION_TOTALLING_XPATH);
042 switchToWindow(KUALI_COLLECTION_TOTALLING_WINDOW_XPATH);
043 }
044
045 //Code for KRAD Test Package.
046 protected void testCollectionTotalling() throws Exception {
047 //Scenario Asserts Changes in Total at client side
048 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']"));
049 clearTextByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']");
050 waitAndTypeByXpath("//div[@id='Demo-CollectionTotaling-Section1']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']","10");
051 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']");
052 Thread.sleep(2000);
053 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']"));
054
055 //Scenario Asserts Changes in Total at client side on keyUp
056 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']"));
057 clearTextByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']");
058 waitAndTypeByXpath("//div[@id='Demo-CollectionTotaling-Section2']/div[@role='grid']/table/tbody/tr[2]/td[2]/div/input[@name='list1[0].field1']","10");
059 Thread.sleep(2000);
060 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']"));
061
062 //Totalling Flexibility
063 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']"));
064
065 //Left Total Labels
066 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"));
067
068 //Hide Footer
069 assertElementPresentByXpath("//div[@id='Demo-CollectionTotaling-Section5']/div[@role='grid']/table/tfoot/tr[@style='display: none;']");
070
071 //Multiple Calculations
072 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"));
073 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"));
074 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"));
075 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"));
076
077 //Group Totaling
078 assertEquals("Group Total:",getTextByXpath("//div[@id='Demo-CollectionTotaling-Section7']/div[@role='grid']/table/tbody/tr[7]/td/div/span/label"));
079 }
080
081 @Test
082 public void testCollectionTotallingBookmark() throws Exception {
083 testCollectionTotalling();
084 passed();
085 }
086
087 @Test
088 public void testCollectionTotallingNav() throws Exception {
089 testCollectionTotalling();
090 passed();
091 }
092 }