1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.labs.kitchensink;
17
18 import org.junit.Ignore;
19 import org.junit.Test;
20 import org.openqa.selenium.Keys;
21
22
23
24
25 public class LabsLookupsAft extends LabsKitchenSinkBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page6&lightbox=true";
31
32 private static final String IFRAME_XPATH="//iframe[@class='fancybox-iframe']";
33
34 @Override
35 protected String getBookmarkUrl() {
36 return BOOKMARK_URL;
37 }
38
39 @Override
40 protected void navigate() throws Exception {
41 navigateToKitchenSink("Lookups, etc");
42 }
43
44 @Test
45 @Ignore
46 public void testAjaxLookupBookmark() throws Exception {
47 testAjaxLookup();
48 passed();
49 }
50
51 @Test
52 @Ignore
53 public void testAjaxLookupNav() throws Exception {
54 testAjaxLookup();
55 passed();
56 }
57
58 @Test
59 public void testLookupsBookmark() throws Exception {
60 testLookups();
61 passed();
62 }
63
64 @Test
65 public void testLookupsNav() throws Exception {
66 testLookups();
67 passed();
68 }
69
70
71 protected void testAjaxLookup() throws InterruptedException {
72 clearTextByName("field79");
73 waitAndTypeByName("field79", "a3");
74 driver.switchTo().activeElement().sendKeys(Keys.TAB);
75
76
77 waitForTextPresent("Travel Account 3");
78 }
79
80 protected void testLookups() throws InterruptedException {
81
82
83
84
85
86
87 clearTextByName("field72");
88 waitAndTypeByName("field72", "a2");
89 fireEvent("field72", "blur");
90 waitAndClickByName("field76");
91 waitForTextPresent("Travel Account 2");
92
93 clearTextByName("field76");
94 waitAndTypeByName("field76", "a1");
95 fireEvent("field76", "blur");
96 waitForTextPresent("Travel Account 1");
97
98 waitAndClickByXpath("//a[@class='uif-actionLink icon-search']");
99 gotoIframeByXpath(IFRAME_XPATH);
100 waitAndClickButtonByText("Search");
101 waitAndClickReturnValue();
102 waitAndClickByXpath("//div[@data-parent='refreshLookups1']/div/span/a");
103 gotoIframeByXpath(IFRAME_XPATH);
104 waitAndClickButtonByText("Search");
105 waitAndClickReturnValue();
106
107 clearTextByName("field70");
108 waitAndTypeByName("field70", "a1");
109 waitAndClickByXpath("//input[@title='Direct Inquiry']");
110 gotoLightBox();
111 assertTextPresent(new String[] {"Travel Account Number:", "a1", "Travel Account Name:", "Travel Account 1", "Code And Description:", "IAT - Income"});
112 waitAndClickButtonByText("Close");
113 }
114 }