View Javadoc
1   /**
2    * Copyright 2005-2016 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.sampleu.travel;
17  
18  import org.kuali.rice.testtools.common.JiraAwareFailable;
19  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  import org.kuali.rice.testtools.selenium.WebDriverUtils;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public abstract class TravelAccountTypeLookupAftBase extends WebDriverLegacyITBase {
27  
28      /**
29       * /portal.do?channelTitle=Travel%20Account%20Type%20Lookup&channelUrl=" +WebDriverUtils.getBaseUrlString()+ /kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page3
30       */
31      public static final String BOOKMARK_URL = "/portal.do?channelTitle=Travel%20Account%20Type%20Lookup&channelUrl="
32              + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD
33              + "edu.sampleu.travel.bo.TravelAccountType";
34  
35      /**
36       * //*[contains(button,"earch")]/button
37       */
38      public static final String SEARCH_BUTTON_XPATH ="//*[contains(button,\"earch\")]/button";
39  
40      protected String getDataTableTrTd1ContainsXpath(String contains) {
41          return "//table[@class='uif-tableCollectionLayout dataTable']//tr[contains(td[1],'" + contains + "')]";
42      }
43  
44      protected String getBookmarkUrl() {
45          return BOOKMARK_URL;
46      }
47  
48      protected void navigation() throws Exception {
49          waitAndClickByLinkText("KRAD");
50          waitAndClickByLinkText("Travel Account Type Lookup");
51      }
52  
53      protected void testTravelAccountTypeLookupNav(JiraAwareFailable failable) throws Exception {
54          navigation();
55          testTravelAccountTypeLookup();
56          passed();
57      }
58  
59      protected void testTravelAccountTypeLookupBookmark(JiraAwareFailable failable) throws Exception {
60          testTravelAccountTypeLookup();
61          passed();
62      }
63  
64      protected void testTravelAccountTypeLookup() throws Exception {
65          selectFrameIframePortlet();
66  
67          //Blank Search
68          waitAndClickByXpath(SEARCH_BUTTON_XPATH + "[1]");
69          Thread.sleep(4000);
70          assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("CAT"));
71          assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("EAT"));
72          assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("IAT"));
73  
74          //search with each field
75          waitAndTypeByName("lookupCriteria[accountTypeCode]", "CAT");
76          waitAndClickByXpath(SEARCH_BUTTON_XPATH + "[1]");
77          Thread.sleep(2000);
78          assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("CAT"));
79          waitAndClickByXpath(SEARCH_BUTTON_XPATH + "[2]");
80          Thread.sleep(2000);
81          waitAndTypeByName("lookupCriteria[name]", "Expense Account Type");
82          waitAndClickByXpath(SEARCH_BUTTON_XPATH + "[1]");
83          Thread.sleep(4000);
84          assertElementPresentByXpath(getDataTableTrTd1ContainsXpath("EAT"));
85  
86          //Currently No links available for Travel Account Type Inquiry so cant verify heading and values.
87      }
88  }