001/**
002 * Copyright 2005-2016 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 */
016package edu.sampleu.travel;
017
018import org.kuali.rice.testtools.common.JiraAwareFailable;
019import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
020import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021import org.kuali.rice.testtools.selenium.WebDriverUtils;
022
023/**
024 * Tests the Component section in Rice.
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028public abstract class TravelAccountLookupAftBase extends WebDriverLegacyITBase {
029
030    /**
031     * "/portal.do?channelTitle=Travel%20Account%20Lookup&channelUrl="
032     * + WebDriverUtils.getBaseUrlString() + ITUtil.KRAD_LOOKUP_METHOD
033     * + "edu.sampleu.travel.bo.TravelAccount&returnLocation="
034     * + ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK + ITUtil.SHOW_MAINTENANCE_LINKS
035     */
036    public static final String BOOKMARK_URL = "/portal.do?channelTitle=Travel%20Account%20Lookup&channelUrl="
037            + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD
038            + "edu.sampleu.travel.bo.TravelAccount&returnLocation="
039            + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK + AutomatedFunctionalTestUtils.SHOW_MAINTENANCE_LINKS;
040
041    @Override
042    protected String getBookmarkUrl() {
043        return BOOKMARK_URL;
044    }
045
046    protected void navigation() throws InterruptedException {
047        waitAndClickKRAD();
048        waitAndClickByLinkText(TRAVEL_ACCOUNT_LOOKUP_LINK_TEXT);
049    }
050
051    protected void testTravelAccountLookupNav(JiraAwareFailable failable) throws Exception {
052        navigation();
053        testTravelAccountLookup();
054        passed();
055    }
056
057    protected void testTravelAccountLookupBookmark(JiraAwareFailable failable) throws Exception {
058        testTravelAccountLookup();
059        passed();
060    }
061
062    protected void testTravelAccountLookup() throws Exception {
063        selectFrameIframePortlet();
064
065        //Blank Search
066        waitAndClickByXpath(SEARCH_XPATH_3);
067        Thread.sleep(2000);
068
069        //  --------------------------------Further code will not run due to page exception------------------------------------
070        //assertElementPresentByLinkText("a1");
071        //ssertElementPresentByLinkText("a2");
072        //assertElementPresentByLinkText("a3");
073
074        //QuickFinder Lookup
075        //waitAndTypeByName("lookupCriteria[number]", "a*");
076        //waitAndClickByXpath("//*[@id='u18']");
077        //Thread.sleep(2000);
078        //assertElementPresentByLinkText("a1");
079        //assertElementPresentByLinkText("a2");
080        //assertElementPresentByLinkText("a3");
081        //waitAndClickByXpath("//button[@id='u19']");
082        //Thread.sleep(2000);
083
084        //search with each field
085        //waitAndTypeByName("lookupCriteria[number]", "a2");
086        //waitAndClickByXpath("//*[@id='u18']");
087        //Thread.sleep(2000);
088        //assertElementPresentByLinkText("a2");
089        //waitAndClickByXpath("//button[@id='u19']");
090        //Thread.sleep(2000);
091        // waitAndTypeByName("lookupCriteria[foId]", "1");
092        //waitAndClickByXpath("//*[@id='u18']");
093        //Thread.sleep(2000);
094        //assertEquals("1", getTextByXpath("//table[@id='u27']//tr//td[8]").trim().substring(0, 1));
095        //waitAndClickByXpath("//button[@id='u19']");
096        //Thread.sleep(2000);
097        //selectOptionByName("lookupCriteria[extension.accountTypeCode]", "CAT");
098        //waitAndClickByXpath("//*[@id='u18']");
099        //waitAndClickByXpath("//table[@id='u27']//tr//td[2]//a");
100        //Thread.sleep(2000);
101        //selectTopFrame();
102        //Thread.sleep(5000);
103        //gotoLightBox();
104        //assertEquals("Travel Account Inquiry", getTextByXpath("//h1/span").trim());
105        //assertEquals("CAT - Clearing Account Type", getTextByXpath("//*[@id='u44_control']").trim());
106        //waitAndClickByXpath("//button[@id='u13']");
107        //selectFrame("iframeportlet");
108    }
109}