1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.travel.application;
17
18 import org.kuali.rice.krad.demo.ViewDemoAftBase;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20 import org.junit.Test;
21
22
23
24
25 public class DemoTravelPerDiemLookUpAft extends ViewDemoAftBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelPerDiemExpense";
31
32
33
34
35 public static final String SEARCH = "Search";
36
37
38
39
40 public static final String CLEAR_VALUES = "Clear Values";
41
42 @Override
43 public String getBookmarkUrl() {
44 return BOOKMARK_URL;
45 }
46
47 @Override
48 protected void navigate() throws Exception {
49 waitAndClickDemoLink();
50 waitAndClickByLinkText("Travel Per Diem Lookup");
51 }
52
53 protected void testTravelPerDiemLookUp() throws Exception {
54 waitAndTypeByName("lookupCriteria[travelPerDiemExpenseId]","1");
55 waitAndTypeByName("lookupCriteria[travelAuthorizationDocumentId]","1");
56 selectByName("lookupCriteria[travelDestinationId]","Colorado");
57 waitAndClickByXpath("//div[@data-label='Primary Destination']/div/div/button[@class='btn btn-default uif-action icon-search']");
58 waitSearchAndReturnFromLightbox();
59 assertEquals("lookupCriteria[travelAuthorizationDocumentId] value not 1 as set before Lightbox search", "1", waitAndGetAttributeByName("lookupCriteria[travelAuthorizationDocumentId]", "value"));
60 waitAndClickByXpath("//div[@data-label='Mileage Rate']/div/div/button[@class='btn btn-default uif-action icon-search']");
61 waitSearchAndReturnFromLightbox();
62 waitAndClickButtonByText(SEARCH);
63 waitForTextPresent("No values match this search.");
64 waitForTextPresent("You have entered the primary key for this table (Id) in the search criteria. Since these fields can be used to uniquely identify a row in this table, the other search criteria entered will be ignored.");
65 waitAndClickButtonByText(CLEAR_VALUES);
66 waitAndTypeByName("lookupCriteria[travelPerDiemExpenseId]","10000");
67 waitAndClickButtonByText(SEARCH);
68
69 String activeResults [] ={"30","10000","10000","10000","10","10","15","20","DO"};
70 assertTextPresent(activeResults);
71 }
72
73 @Test
74 public void testTravelPerDiemLookUpBookmark() throws Exception {
75 testTravelPerDiemLookUp();
76 passed();
77 }
78
79 @Test
80 public void testTravelPerDiemLookUpNav() throws Exception {
81 testTravelPerDiemLookUp();
82 passed();
83 }
84
85 private void waitSearchAndReturnFromLightbox() throws Exception {
86 gotoLightBox();
87 waitAndClickButtonByText("Search");
88 waitAndClickByLinkText("return value");
89 }
90 }