1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
30
31
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
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 }