001    /**
002     * Copyright 2005-2014 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 org.kuali.rice.testtools.common.JiraAwareFailable;
019    import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
020    import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021    import org.kuali.rice.testtools.selenium.WebDriverUtils;
022    
023    /**
024     * @author Kuali Rice Team (rice.collab@kuali.org)
025     */
026    public abstract class TravelAccountTypeLookupAftBase extends WebDriverLegacyITBase {
027    
028        /**
029         * /portal.do?channelTitle=Travel%20Account%20Type%20Lookup&channelUrl=" +WebDriverUtils.getBaseUrlString()+ /kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page3
030         */
031        public static final String BOOKMARK_URL = "/portal.do?channelTitle=Travel%20Account%20Type%20Lookup&channelUrl="
032                + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD
033                + "edu.sampleu.travel.bo.TravelAccountType";
034    
035        /**
036         * //*[contains(button,"earch")]/button
037         */
038        public static final String SEARCH_BUTTON_XPATH ="//*[contains(button,\"earch\")]/button";
039    
040        protected String getDataTableTrTd1ContainsXpath(String contains) {
041            return "//table[@class='uif-tableCollectionLayout dataTable']//tr[contains(td[1],'" + contains + "')]";
042        }
043    
044        protected String getBookmarkUrl() {
045            return BOOKMARK_URL;
046        }
047    
048        protected void navigation() throws Exception {
049            waitAndClickByLinkText("KRAD");
050            waitAndClickByLinkText("Travel Account Type Lookup");
051        }
052    
053        protected void testTravelAccountTypeLookupNav(JiraAwareFailable failable) throws Exception {
054            navigation();
055            testTravelAccountTypeLookup();
056            passed();
057        }
058    
059        protected void testTravelAccountTypeLookupBookmark(JiraAwareFailable failable) throws Exception {
060            testTravelAccountTypeLookup();
061            passed();
062        }
063    
064        protected void testTravelAccountTypeLookup() throws Exception {
065            selectFrameIframePortlet();
066    
067            //Blank Search
068            waitAndClickByXpath(SEARCH_BUTTON_XPATH + "[1]");
069            Thread.sleep(4000);
070            assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("CAT"));
071            assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("EAT"));
072            assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("IAT"));
073    
074            //search with each field
075            waitAndTypeByName("lookupCriteria[accountTypeCode]", "CAT");
076            waitAndClickByXpath(SEARCH_BUTTON_XPATH + "[1]");
077            Thread.sleep(2000);
078            assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("CAT"));
079            waitAndClickByXpath(SEARCH_BUTTON_XPATH + "[2]");
080            Thread.sleep(2000);
081            waitAndTypeByName("lookupCriteria[name]", "Expense Account Type");
082            waitAndClickByXpath(SEARCH_BUTTON_XPATH + "[1]");
083            Thread.sleep(4000);
084            assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("EAT"));
085    
086            //Currently No links available for Travel Account Type Inquiry so cant verify heading and values.
087        }
088    }