1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.lookup.stackedresults;
17
18 import org.junit.Test;
19 import org.kuali.rice.krad.demo.ViewDemoAftBase;
20
21
22
23
24
25
26 public class DemoLookUpStackedResultsAft extends ViewDemoAftBase {
27
28
29
30
31 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewStackedResults&hideReturnLink=true";
32
33
34
35
36 private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
37 private static final String LOOKUP_CRITERIA_DATE="lookupCriteria[createDate]";
38
39
40
41
42 private static final String SEARCH="Search";
43
44
45
46
47 private static final String CLEAR_VALUES="Clear Values";
48
49
50 @Override
51 public String getBookmarkUrl() {
52 return BOOKMARK_URL;
53 }
54
55 @Override
56 protected void navigate() throws Exception {
57 waitAndClickDemoLink();
58 waitAndClickByLinkText("Lookup with Stacked Results");
59 }
60
61 protected void testLookUpStackedResults() throws InterruptedException {
62 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
63 waitAndClickButtonByText(SEARCH);
64 waitForElementPresentByXpath("//a[contains(text(), 'a1')]");
65 waitAndClickButtonByText(CLEAR_VALUES);
66 waitAndClickButtonByText(SEARCH);
67 waitForElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-gridLayout uif-table-fixed']/tbody/tr/td/div/span/a[contains(text(),'a1')]");
68 assertTextPresent(new String[]{"Travel Account Number: Required"});
69 waitAndClickButtonByText(CLEAR_VALUES);
70 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "");
71 waitAndTypeByName(LOOKUP_CRITERIA_DATE, "234");
72 fireMouseOverEventByName(LOOKUP_CRITERIA_NUMBER_NAME);
73 waitForElementPresentByXpath("//div[@class='popover top in uif-tooltip-error-cs']");
74 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "");
75 fireMouseOverEventByName(LOOKUP_CRITERIA_DATE);
76 waitForElementPresentByXpath("//div[@class='popover top in uif-tooltip-error-cs']");
77 waitAndClickButtonByText(SEARCH);
78 assertTextPresent(new String[]{
79 "Date Created: Must be a date in the following format(s): MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, yyyy-MM-dd","This page has 2 errors","Travel Account Number: Required"});
80 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
81 waitAndTypeByName(LOOKUP_CRITERIA_DATE, "08/23/2012");
82 waitAndClickButtonByText(SEARCH);
83 }
84
85 @Test
86 public void testLookUpMultiValueBookmark() throws Exception {
87 testLookUpStackedResults();
88 passed();
89 }
90
91 @Test
92 public void testLookUpMultiValueNav() throws Exception {
93 testLookUpStackedResults();
94 passed();
95 }
96 }