1 /**
2 * Copyright 2005-2013 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package edu.samplu.travel.krad.test;
17
18 import edu.samplu.common.Failable;
19 import edu.samplu.common.ITUtil;
20 import edu.samplu.common.WebDriverLegacyITBase;
21
22
23 /**
24 * Tests the Component section in Rice.
25 *
26 * @author Kuali Rice Team (rice.collab@kuali.org)
27 */
28 public abstract class TravelAccountLookupAbstractSmokeTestBase extends WebDriverLegacyITBase {
29
30 /**
31 * "/portal.do?channelTitle=Travel%20Account%20Lookup&channelUrl="
32 * + ITUtil.getBaseUrlString() + ITUtil.KRAD_LOOKUP_METHOD
33 * + "edu.sampleu.travel.bo.TravelAccount&returnLocation="
34 * + ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK + ITUtil.SHOW_MAINTENANCE_LINKS
35 */
36 public static final String BOOKMARK_URL = "/portal.do?channelTitle=Travel%20Account%20Lookup&channelUrl="
37 + ITUtil.getBaseUrlString() + ITUtil.KRAD_LOOKUP_METHOD
38 + "edu.sampleu.travel.bo.TravelAccount&returnLocation="
39 + ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK + ITUtil.SHOW_MAINTENANCE_LINKS;
40
41 protected void bookmark() {
42 open(ITUtil.getBaseUrlString() + BOOKMARK_URL);
43 }
44
45 /**
46 * Nav tests start at {@link edu.samplu.common.ITUtil#PORTAL}.
47 * Bookmark Tests should override and return {@link TravelAccountLookupAbstractSmokeTestBase#BOOKMARK_URL}
48 * {@inheritDoc}
49 * @return
50 */
51 @Override
52 public String getTestUrl() {
53 return ITUtil.PORTAL;
54 }
55
56 protected void navigation() throws InterruptedException {
57 waitAndClickKRAD();
58 waitAndClickByLinkText(TRAVEL_ACCOUNT_LOOKUP_LINK_TEXT);
59 }
60
61 protected void testTravelAccountLookupNav(Failable failable) throws Exception {
62 navigation();
63 testTravelAccountLookup();
64 passed();
65 }
66
67 protected void testTravelAccountLookupBookmark(Failable failable) throws Exception {
68 testTravelAccountLookup();
69 passed();
70 }
71
72 protected void testTravelAccountLookup() throws Exception {
73 selectFrameIframePortlet();
74
75 //Blank Search
76 waitAndClickByXpath(SEARCH_XPATH_3);
77 Thread.sleep(2000);
78
79 // --------------------------------Further code will not run due to page exception------------------------------------
80 //assertElementPresentByLinkText("a1");
81 //ssertElementPresentByLinkText("a2");
82 //assertElementPresentByLinkText("a3");
83
84 //QuickFinder Lookup
85 //waitAndTypeByName("lookupCriteria[number]", "a*");
86 //waitAndClickByXpath("//*[@id='u18']");
87 //Thread.sleep(2000);
88 //assertElementPresentByLinkText("a1");
89 //assertElementPresentByLinkText("a2");
90 //assertElementPresentByLinkText("a3");
91 //waitAndClickByXpath("//button[@id='u19']");
92 //Thread.sleep(2000);
93
94 //search with each field
95 //waitAndTypeByName("lookupCriteria[number]", "a2");
96 //waitAndClickByXpath("//*[@id='u18']");
97 //Thread.sleep(2000);
98 //assertElementPresentByLinkText("a2");
99 //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 }