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.testtools.selenium.WebDriverLegacyITBase;
19 import org.junit.Test;
20 import org.openqa.selenium.By;
21
22
23
24
25 public class DemoTravelAccountAuthorizationAft extends WebDriverLegacyITBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/approval?methodToCall=docHandler&command=initiate&docTypeName=TravelAuthorization";
31
32
33
34
35 public static final String SUBMIT = "submit";
36
37
38
39
40 public static final String SEARCH = "Search";
41
42
43
44
45 public static final String RETURN_VALUE = "return value";
46
47
48
49
50 public static final String BLANKET_APPROVE = "blanket approve";
51
52
53
54
55 public static final String DESCRIPTION_NAME = "document.documentHeader.documentDescription";
56
57
58
59
60 public static final String CONTACT_NUMBER_NAME = "document.cellPhoneNumber";
61
62
63
64
65 public static final String ACTUAL_EXPENSE_GENERIC_XPATH = "//div[@id='Uif-PageContentWrapper']/div/div[4]/div[2]/div/table/tbody/tr/";
66
67
68
69
70 public static final String DAILY_COST_ESTIMATE_GENERIC_XPATH = "//div[@id='Uif-PageContentWrapper']/div/div[5]/div[2]/div/table/tbody/tr/";
71
72 @Override
73 public String getBookmarkUrl() {
74 return BOOKMARK_URL;
75 }
76
77 @Override
78 protected void navigate() throws Exception {
79 waitAndClickById("Demo-DemoLink", "");
80 waitAndClickByLinkText("Travel Authorization Document");
81 }
82
83 protected void testTravelAccountAuthorizationSubmit() throws Exception {
84 testTravelAccountAuthorization();
85 waitAndClickButtonByText("submit");
86
87
88
89
90 waitAndClick(By.xpath("//label[contains(text(), 'Yes')]"));
91 waitForTextPresent("Document was successfully");
92 }
93
94 protected void testTravelAccountAuthorizationBlanketApprove() throws Exception {
95 testTravelAccountAuthorization();
96 waitAndClickButtonByText("blanket approve");
97 checkForIncidentReport();
98
99
100 }
101
102 protected void testTravelAccountAuthorization() throws Exception {
103 waitAndTypeByName(DESCRIPTION_NAME,"Travel Authorization Description");
104 waitAndTypeByName("document.documentHeader.organizationDocumentNumber","1");
105 waitAndTypeByName("document.documentHeader.explanation","This is an explanation for Travel Authorization !'");
106 waitAndClickByXpath("//a[@id='travelerQuickfinder_quickfinder_act']");
107 waitAndGetReturnValue();
108 waitAndTypeByName(CONTACT_NUMBER_NAME,"918000884215");
109 waitAndClickByXpath("//div[@data-label='Primary Destination Id']/div/span/a");
110 waitAndGetReturnValue();
111 selectByName("document.travelTypeCode","In State");
112 waitAndTypeByName("document.tripBegin","02/01/2014");
113 waitAndTypeByName("document.tripEnd","02/04/2014");
114 jGrowl("Traveler Lookup Quickfinder");
115 waitAndClickByXpath("//a[@id='travelerQuickfinder_quickfinder_act']");
116 waitAndGetReturnValue();
117
118
119 jGrowl("Click Primary Destination Id Quickfinder");
120 waitAndClickByXpath("//div[@data-label='Primary Destination Id']/div/span/a");
121 waitAndGetReturnValue();
122 String primaryDestinationId = waitAndGetAttributeByName("document.tripDestinationId", "value");
123 waitAndTypeByName("document.expenseLimit","1000");
124
125
126 waitAndTypeByName("newCollectionLines['document.actualExpenseItems'].travelCompanyName", "Kuali");
127 selectOptionByName("newCollectionLines['document.actualExpenseItems'].travelExpenseTypeCd", "A");
128 waitAndTypeByName("newCollectionLines['document.actualExpenseItems'].expenseDesc", "Expense Description");
129 waitAndTypeByName("newCollectionLines['document.actualExpenseItems'].expenseAmount", "123.12");
130 jGrowl("Click Actual Expense Items Add Button");
131 waitAndClickByXpath("//button[contains(@data-submit_data, 'document.actualExpenseItems')]");
132
133
134 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].perDiemDate","12/12/13");
135 selectOptionByName("newCollectionLines['document.dailyExpenseEstimates'].travelDestinationId", primaryDestinationId);
136 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].breakfastValue","16");
137 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].lunchValue","18");
138 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].dinnerValue","20");
139 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].incidentalsValue","7");
140 selectOptionByName("newCollectionLines['document.dailyExpenseEstimates'].mileageRateId", "10000");
141 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].estimatedMileage","13");
142 jGrowl("Click Daily Expense Estimates Add Button");
143 waitAndClickByXpath("//button[contains(@data-submit_data, 'document.dailyExpenseEstimates')]");
144 }
145
146 protected void waitAndGetReturnValue() throws Exception {
147 gotoLightBox();
148 waitAndClickButtonByText(SEARCH);
149 waitAndClickByLinkText(RETURN_VALUE);
150 }
151
152 @Test
153 public void testTravelAccountAuthorizationSubmitNav() throws Exception {
154 testTravelAccountAuthorizationSubmit();
155 passed();
156 }
157
158 @Test
159 public void testTravelAccountAuthorizationBlanketApproveNav() throws Exception {
160 testTravelAccountAuthorizationBlanketApprove();
161 passed();
162 }
163
164 @Test
165 public void testTravelAccountAuthorizationSubmitBookmark() throws Exception {
166 testTravelAccountAuthorizationSubmit();
167 passed();
168 }
169
170 @Test
171 public void testTravelAccountAuthorizationBlanketApproveBookmark() throws Exception {
172 testTravelAccountAuthorizationBlanketApprove();
173 passed();
174 }
175 }