View Javadoc
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   * Tests the Component section in Rice.
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public abstract class TravelAccountLookupAbstractSmokeTestBase extends WebDriverLegacyITBase {
28  
29      /**
30       * "/portal.do?channelTitle=Travel%20Account%20Lookup&channelUrl="
31       * + ITUtil.getBaseUrlString() + ITUtil.KRAD_LOOKUP_METHOD
32       * + "edu.sampleu.travel.bo.TravelAccount&returnLocation="
33       * + ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK + ITUtil.SHOW_MAINTENANCE_LINKS
34       */
35      public static final String BOOKMARK_URL = "/portal.do?channelTitle=Travel%20Account%20Lookup&channelUrl="
36              + ITUtil.getBaseUrlString() + ITUtil.KRAD_LOOKUP_METHOD
37              + "edu.sampleu.travel.bo.TravelAccount&returnLocation="
38              + ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK + ITUtil.SHOW_MAINTENANCE_LINKS;
39  
40      protected void bookmark() {
41          open(ITUtil.getBaseUrlString() + BOOKMARK_URL);
42      }
43  
44      /**
45       * Nav tests start at {@link edu.samplu.common.ITUtil#PORTAL}.
46       * Bookmark Tests should override and return {@link TravelAccountLookupAbstractSmokeTestBase#BOOKMARK_URL}
47       * {@inheritDoc}
48       * @return
49       */
50      @Override
51      public String getTestUrl() {
52          return ITUtil.PORTAL;
53      }
54  
55      protected void navigation() throws InterruptedException {
56          waitAndClickKRAD();
57          waitAndClickByLinkText(TRAVEL_ACCOUNT_LOOKUP_LINK_TEXT);
58      }
59  
60      protected void testTravelAccountLookupNav(Failable failable) throws Exception {
61          navigation();
62          testTravelAccountLookup();
63          passed();
64      }
65  
66      protected void testTravelAccountLookupBookmark(Failable failable) throws Exception {
67          testTravelAccountLookup();
68          passed();
69      }
70  
71      protected void testTravelAccountLookup() throws Exception {
72          selectFrameIframePortlet();
73  
74          //Blank Search
75          waitAndClickByXpath(SEARCH_XPATH_3);
76          Thread.sleep(2000);
77  
78          //  --------------------------------Further code will not run due to page exception------------------------------------
79          //assertElementPresentByLinkText("a1");
80          //ssertElementPresentByLinkText("a2");
81          //assertElementPresentByLinkText("a3");
82  
83          //QuickFinder Lookup
84          //waitAndTypeByName("lookupCriteria[number]", "a*");
85          //waitAndClickByXpath("//*[@id='u18']");
86          //Thread.sleep(2000);
87          //assertElementPresentByLinkText("a1");
88          //assertElementPresentByLinkText("a2");
89          //assertElementPresentByLinkText("a3");
90          //waitAndClickByXpath("//button[@id='u19']");
91          //Thread.sleep(2000);
92  
93          //search with each field
94          //waitAndTypeByName("lookupCriteria[number]", "a2");
95          //waitAndClickByXpath("//*[@id='u18']");
96          //Thread.sleep(2000);
97          //assertElementPresentByLinkText("a2");
98          //waitAndClickByXpath("//button[@id='u19']");
99          //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 }