001 /*
002 * Copyright 2011 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl1.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.samplu.travel.krad.test;
017
018 import static org.junit.Assert.*;
019
020 import org.junit.Test;
021 import org.openqa.selenium.Alert;
022 import org.openqa.selenium.By;
023 import org.openqa.selenium.WebElement;
024
025 import edu.samplu.common.ITUtil;
026 import edu.samplu.common.WebDriverLegacyITBase;
027
028 /**
029 * tests the inquiry feature in rice.
030 *
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 */
033 public class InquiryLegacyIT extends WebDriverLegacyITBase {
034 @Override
035 public String getTestUrl() {
036 return ITUtil.PORTAL;
037 }
038
039 @Test
040 public void testInquiry() throws Exception {
041 waitAndClickByLinkText("KRAD");
042 waitAndClickByLinkText("Travel Account Lookup");
043 selectFrame("iframeportlet");
044 waitAndTypeByName("lookupCriteria[number]", "a1");
045 waitAndClickByXpath("//*[@alt='Direct Inquiry']");
046 selectTopFrame();
047 Thread.sleep(5000);
048 WebElement iframe1= driver.findElement(By.xpath("//iframe[@class='fancybox-iframe']"));
049 driver.switchTo().frame(iframe1);
050 assertEquals("Travel Account Inquiry", getTextByXpath("//h1/span").trim());
051 assertElementPresentByLinkText("a1");
052 waitAndClickByXpath("//button[@id='u13']");
053 selectFrame("iframeportlet");
054
055 waitAndClickByXpath("//button[@id='u19']");
056 Thread.sleep(2000);
057 waitAndClickByXpath("//*[@alt='Direct Inquiry']");
058 Alert a1= driver.switchTo().alert();
059 assertEquals("Please enter a value in the appropriate field.",a1.getText());
060 a1.accept();
061 switchToWindow("null");
062 selectFrame("iframeportlet");
063
064 //No Direct Inquiry Option for Fiscal Officer.
065 waitAndTypeByName("lookupCriteria[foId]", "1");
066 waitAndClickByXpath("//*[@id='u229']");
067 selectTopFrame();
068 Thread.sleep(5000);
069 WebElement iframe2= driver.findElement(By.xpath("//iframe[@class='fancybox-iframe']"));
070 driver.switchTo().frame(iframe2);
071 assertEquals("Fiscal Officer Lookup", getTextByXpath("//h1/span").trim());
072 assertEquals("1",getAttributeByName("lookupCriteria[id]", "value"));
073 waitAndClickByXpath("//div[contains(button, 'Search')]/button[3]");
074 selectFrame("iframeportlet");
075
076
077 selectOptionByName("lookupCriteria[extension.accountTypeCode]", "CAT");
078 waitAndClickByXpath("//fieldset[@id='u232_fieldset']/input[@alt='Search Field']");
079 selectTopFrame();
080 Thread.sleep(5000);
081 WebElement iframe3= driver.findElement(By.xpath("//iframe[@class='fancybox-iframe']"));
082 driver.switchTo().frame(iframe3);
083 assertEquals("Travel Account Type Lookup", getTextByXpath("//h1/span").trim());
084 assertEquals("CAT",getAttributeByName("lookupCriteria[accountTypeCode]", "value"));
085 waitAndClickByXpath("//div[contains(button, 'Search')]/button[3]");
086 selectFrame("iframeportlet");
087
088 }
089 }