1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.lookup;
17
18 import org.kuali.rice.krad.demo.ViewDemoAftBase;
19 import org.openqa.selenium.By;
20 import org.junit.Test;
21
22
23
24
25 public class DemoLookUpAft extends ViewDemoAftBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleView&hideReturnLink=true";
31
32
33
34
35 private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
36
37
38
39
40 private static final String SEARCH="Search";
41
42
43
44
45 private static final String CLEAR_VALUES="Clear Values";
46
47 @Override
48 public String getBookmarkUrl() {
49 return BOOKMARK_URL;
50 }
51
52 @Override
53 protected void navigate() throws Exception {
54 waitAndClickDemoLink();
55 waitAndClickByLinkText("Lookup");
56 }
57
58 protected void testLookUp() throws InterruptedException {
59 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a1");
60 waitAndClickButtonByText(SEARCH);
61 Thread.sleep(3000);
62 waitForElementPresentByXpath("//a[contains(text(), 'a1')]");
63 waitAndClickButtonByText(CLEAR_VALUES);
64 waitAndClickButtonByText(SEARCH);
65 waitForElementPresentByXpath("//a[contains(text(), 'a1')]");
66 waitForElementPresentByXpath("//a[contains(text(), 'a6')]");
67 waitAndClickButtonByText(CLEAR_VALUES);
68 waitAndTypeByName("lookupCriteria[name]","Travel Account 1");
69 waitAndClickButtonByText(SEARCH);
70 waitForElementPresentByXpath("//a[contains(text(), 'a1')]");
71 waitForElementNotPresent(By.xpath("//a[contains(text(), 'a2')]"));
72 waitAndClickButtonByText(CLEAR_VALUES);
73 waitAndTypeByName("lookupCriteria[rangeLowerBoundKeyPrefix_createDate]","02/01/2014");
74 waitAndTypeByName("lookupCriteria[createDate]","02/13/2014");
75 waitAndClickButtonByText(SEARCH);
76 waitForTextPresent("No values match this search.");
77 }
78
79 protected void testLookUpFancy() throws InterruptedException {
80 waitAndTypeByName("lookupCriteria[name]","*");
81 waitAndTypeByName("lookupCriteria[fiscalOfficer.principalName]","eri*");
82 waitAndClickButtonByText(SEARCH);
83 Thread.sleep(3000);
84 waitForElementPresentByXpath("//a[contains(text(), 'a10')]");
85 }
86
87 @Test
88 public void testLookUpBookmark() throws Exception {
89 testLookUp();
90 passed();
91 }
92
93 @Test
94 public void testLookUpNav() throws Exception {
95 testLookUp();
96 passed();
97 }
98
99 @Test
100 public void testLookUpFancyNav() throws Exception {
101 testLookUpFancy();
102 passed();
103 }
104 }