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