View Javadoc

1   /*
2    * Copyright 2011 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/ecl1.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 static org.junit.Assert.*;
19  
20  import org.junit.Test;
21  import org.openqa.selenium.Alert;
22  import org.openqa.selenium.By;
23  import org.openqa.selenium.WebElement;
24  
25  import edu.samplu.common.ITUtil;
26  import edu.samplu.common.WebDriverLegacyITBase;
27  
28  /**
29   * it tests travel account lookup screen.
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public class TravelAccountLookupLegacyIT extends WebDriverLegacyITBase {
34      @Override
35      public String getTestUrl() {
36          return ITUtil.PORTAL;
37      }
38      
39      @Test
40      public void testTravelAccountLookup() throws Exception {
41          waitAndClickByLinkText("KRAD");
42          waitAndClickByLinkText("Travel Account Lookup");
43          selectFrame("iframeportlet");
44          
45          //Blank Search
46          waitAndClickByXpath("//*[@id='u18']");
47          Thread.sleep(2000);
48          assertElementPresentByLinkText("a1");
49          assertElementPresentByLinkText("a2");
50          assertElementPresentByLinkText("a3");
51          
52          //QuickFinder Lookup
53          
54          waitAndTypeByName("lookupCriteria[number]", "a*");
55          waitAndClickByXpath("//*[@id='u18']");
56          Thread.sleep(2000);
57          assertElementPresentByLinkText("a1");
58          assertElementPresentByLinkText("a2");
59          assertElementPresentByLinkText("a3");
60          waitAndClickByXpath("//button[@id='u19']");
61          Thread.sleep(2000);
62          
63          //search with each field
64          waitAndTypeByName("lookupCriteria[number]", "a2");
65          waitAndClickByXpath("//*[@id='u18']");
66          Thread.sleep(2000);
67          assertElementPresentByLinkText("a2");
68          waitAndClickByXpath("//button[@id='u19']");
69          Thread.sleep(2000);
70          
71          waitAndTypeByName("lookupCriteria[foId]", "1");
72          waitAndClickByXpath("//*[@id='u18']");
73          Thread.sleep(2000);
74          assertEquals("1", getTextByXpath("//table[@id='u27']//tr//td[8]").trim().substring(0, 1));
75          waitAndClickByXpath("//button[@id='u19']");
76          Thread.sleep(2000);
77          
78          selectOptionByName("lookupCriteria[extension.accountTypeCode]", "CAT");
79          waitAndClickByXpath("//*[@id='u18']");
80          waitAndClickByXpath("//table[@id='u27']//tr//td[2]//a");
81          Thread.sleep(2000);
82          selectTopFrame();
83          Thread.sleep(5000);
84          WebElement iframe1= driver.findElement(By.xpath("//iframe[@class='fancybox-iframe']"));
85          driver.switchTo().frame(iframe1);
86          assertEquals("Travel Account Inquiry", getTextByXpath("//h1/span").trim());
87          assertEquals("CAT - Clearing Account Type", getTextByXpath("//*[@id='u44_control']").trim());
88          waitAndClickByXpath("//button[@id='u13']");
89          selectFrame("iframeportlet");
90         
91      }
92  }