1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel;
17
18 import com.thoughtworks.selenium.SeleneseTestBase;
19 import org.junit.Assert;
20 import org.kuali.rice.testtools.common.JiraAwareFailable;
21 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
22 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
23 import org.kuali.rice.testtools.selenium.WebDriverUtils;
24 import org.openqa.selenium.Alert;
25 import org.openqa.selenium.By;
26 import org.openqa.selenium.WebElement;
27
28
29
30
31
32
33 public abstract class InquiryAftBase extends WebDriverLegacyITBase {
34
35
36
37
38
39
40
41 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL
42 + "?channelTitle=Travel%20Account%20Lookup&channelUrl="
43 + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD
44 + "edu.sampleu.travel.bo.TravelAccount"
45 + "&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK + AutomatedFunctionalTestUtils.SHOW_MAINTENANCE_LINKS;
46
47
48
49
50 public static final String SEARCH_BUTTON_XPATH ="//div[contains(button, 'Search')]/button[3]";
51
52
53
54
55 public static final String CRITERIA_NAME="lookupCriteria";
56
57 protected void navigation() throws Exception {
58 waitAndClickKRAD();
59
60 waitAndClickByXpath("(//a[contains(text(),'Travel Account Lookup')])[3]");
61 }
62
63 protected void testInquiryNav(JiraAwareFailable failable) throws Exception {
64 navigation();
65 testInquiry();
66 passed();
67 }
68
69 protected void testInquiryBookmark(JiraAwareFailable failable) throws Exception {
70 testInquiry();
71 passed();
72 }
73
74 protected void testInquiry() throws Exception {
75 selectFrameIframePortlet();
76 waitAndTypeByName(CRITERIA_NAME+"[number]", "a1");
77 waitAndClickByXpath("//*[@alt='Direct Inquiry']");
78 selectTopFrame();
79 Thread.sleep(5000);
80 gotoLightBox();
81 SeleneseTestBase.assertEquals("Travel Account Inquiry", getTextByXpath("//h1/span").trim());
82 assertElementPresentByLinkText("a1");
83 selectTopFrame();
84 waitAndClickByXpath("//div[@class='fancybox-item fancybox-close']");
85 selectFrameIframePortlet();
86 waitAndClickByXpath("//button[contains(text(),'Clear Values')]");
87
88
89 Thread.sleep(2000);
90 waitAndClickByXpath("//*[@alt='Direct Inquiry']");
91 Alert a1 = driver.switchTo().alert();
92 Assert.assertEquals("Please enter a value in the appropriate field.", a1.getText());
93 a1.accept();
94 switchToWindow("null");
95 selectFrameIframePortlet();
96
97
98 waitAndTypeByName(CRITERIA_NAME+"[foId]", "1");
99 waitAndClickByXpath("//*[@id='u229']");
100 selectTopFrame();
101 Thread.sleep(5000);
102 gotoLightBox();
103 Assert.assertEquals("Fiscal Officer Lookup", getTextByXpath("//h1/span").trim());
104 Assert.assertEquals("1", waitAndGetAttributeByName(CRITERIA_NAME + "[id]", "value"));
105 waitAndClickByXpath(SEARCH_BUTTON_XPATH);
106 selectFrameIframePortlet();
107 selectOptionByName(CRITERIA_NAME+"[extension.accountTypeCode]", "CAT");
108 waitAndClickByXpath("//fieldset[@id='u232_fieldset']/input[@alt='Search Field']");
109 selectTopFrame();
110 Thread.sleep(5000);
111 gotoLightBox();
112 Assert.assertEquals("Travel Account Type Lookup", getTextByXpath("//h1/span").trim());
113 Assert.assertEquals("CAT", waitAndGetAttributeByName(CRITERIA_NAME + "[accountTypeCode]", "value"));
114 waitAndClickByXpath(SEARCH_BUTTON_XPATH);
115 selectFrameIframePortlet();
116 }
117 }