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