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 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
46 waitAndClickByXpath("//*[@id='u18']");
47 Thread.sleep(2000);
48 assertElementPresentByLinkText("a1");
49 assertElementPresentByLinkText("a2");
50 assertElementPresentByLinkText("a3");
51
52
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
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 }