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   * tests the inquiry feature in rice.
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public class InquiryLegacyIT extends WebDriverLegacyITBase {
34      @Override
35      public String getTestUrl() {
36          return ITUtil.PORTAL;
37      }
38      
39      @Test
40      public void testInquiry() throws Exception {
41          waitAndClickByLinkText("KRAD");
42          waitAndClickByLinkText("Travel Account Lookup");
43          selectFrame("iframeportlet");
44          waitAndTypeByName("lookupCriteria[number]", "a1");
45          waitAndClickByXpath("//*[@alt='Direct Inquiry']");
46          selectTopFrame();
47          Thread.sleep(5000);
48          WebElement iframe1= driver.findElement(By.xpath("//iframe[@class='fancybox-iframe']"));
49          driver.switchTo().frame(iframe1);
50          assertEquals("Travel Account Inquiry", getTextByXpath("//h1/span").trim());
51          assertElementPresentByLinkText("a1");
52          waitAndClickByXpath("//button[@id='u13']");
53          selectFrame("iframeportlet");
54          
55          waitAndClickByXpath("//button[@id='u19']");
56          Thread.sleep(2000);
57          waitAndClickByXpath("//*[@alt='Direct Inquiry']");
58          Alert a1= driver.switchTo().alert();
59          assertEquals("Please enter a value in the appropriate field.",a1.getText());
60          a1.accept();
61          switchToWindow("null");
62          selectFrame("iframeportlet");
63          
64          //No Direct Inquiry Option for Fiscal Officer.
65          waitAndTypeByName("lookupCriteria[foId]", "1");
66          waitAndClickByXpath("//*[@id='u229']");
67          selectTopFrame();
68          Thread.sleep(5000);
69          WebElement iframe2= driver.findElement(By.xpath("//iframe[@class='fancybox-iframe']"));
70          driver.switchTo().frame(iframe2);
71          assertEquals("Fiscal Officer Lookup", getTextByXpath("//h1/span").trim());
72          assertEquals("1",getAttributeByName("lookupCriteria[id]", "value"));
73          waitAndClickByXpath("//div[contains(button, 'Search')]/button[3]");
74          selectFrame("iframeportlet");
75          
76          
77          selectOptionByName("lookupCriteria[extension.accountTypeCode]", "CAT");
78          waitAndClickByXpath("//fieldset[@id='u232_fieldset']/input[@alt='Search Field']");
79          selectTopFrame();
80          Thread.sleep(5000);
81          WebElement iframe3= driver.findElement(By.xpath("//iframe[@class='fancybox-iframe']"));
82          driver.switchTo().frame(iframe3);
83          assertEquals("Travel Account Type Lookup", getTextByXpath("//h1/span").trim());
84          assertEquals("CAT",getAttributeByName("lookupCriteria[accountTypeCode]", "value"));
85          waitAndClickByXpath("//div[contains(button, 'Search')]/button[3]");
86          selectFrame("iframeportlet");
87  
88      }
89  }