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.junit.Ignore;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20 import org.junit.Test;
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 waitAndClickDemoLink();
80 waitAndClickByLinkText("Travel Authorization Document");
81 }
82
83 protected void testTravelAccountAuthorizationSubmit() throws Exception {
84 testTravelAccountAuthorization();
85 waitAndClickSubmitByText();
86 waitAndClickConfirmSubmitOk();
87
88
89
90
91
92 waitForTextPresent("Document was successfully");
93 }
94
95 protected void testTravelAccountAuthorizationBlanketApprove() throws Exception {
96 testTravelAccountAuthorization();
97 waitAndClickBlanketApprove();
98 checkForIncidentReport();
99
100
101 }
102
103 protected void testTravelAccountAuthorization() throws Exception {
104 waitAndTypeByName(DESCRIPTION_NAME,"Travel Authorization Description");
105 waitAndTypeByName("document.documentHeader.organizationDocumentNumber","1");
106 waitAndTypeByName("document.documentHeader.explanation","This is an explanation for Travel Authorization !'");
107 waitAndClickById("travelerQuickfinder_quickfinder_act");
108 waitAndGetReturnValue();
109 waitAndTypeByName(CONTACT_NUMBER_NAME,"918000884215");
110 jGrowl("Click Primary Destination Id Quick Finder");
111 waitAndClickByXpath("//div[@data-label='Primary Destination Id']/div/div/button");
112 waitAndGetReturnValue();
113 selectByName("document.travelTypeCode","In State");
114 waitAndTypeByName("document.tripBegin","02/01/2014");
115 waitAndTypeByName("document.tripEnd","02/04/2014");
116 jGrowl("Traveler Lookup Quickfinder");
117 waitAndClickById("travelerQuickfinder_quickfinder_act");
118 waitAndGetReturnValue();
119
120
121 jGrowl("Click Primary Destination Id Quickfinder");
122 waitAndClickByXpath("//div[@data-label='Primary Destination Id']/div/div/button");
123 waitAndGetReturnValue();
124 String primaryDestinationId = waitAndGetAttributeByName("document.tripDestinationId", "value");
125 waitAndTypeByName("document.expenseLimit","1000");
126
127
128 waitAndTypeByName("newCollectionLines['document.actualExpenseItems'].travelCompanyName", "Kuali");
129 selectOptionByName("newCollectionLines['document.actualExpenseItems'].travelExpenseTypeCd", "A");
130 waitAndTypeByName("newCollectionLines['document.actualExpenseItems'].expenseDesc", "Expense Description");
131 waitAndTypeByName("newCollectionLines['document.actualExpenseItems'].expenseAmount", "123.12");
132 jGrowl("Click Actual Expense Items Add Button");
133 waitAndClickByXpath("//button[contains(@data-submit_data, 'document.actualExpenseItems')]");
134
135
136 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].perDiemDate","12/12/13");
137 selectOptionByName("newCollectionLines['document.dailyExpenseEstimates'].travelDestinationId", primaryDestinationId);
138 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].breakfastValue","16");
139 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].lunchValue","18");
140 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].dinnerValue","20");
141 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].incidentalsValue","7");
142 selectOptionByName("newCollectionLines['document.dailyExpenseEstimates'].mileageRateId", "10000");
143 waitAndTypeByName("newCollectionLines['document.dailyExpenseEstimates'].estimatedMileage","13");
144 jGrowl("Click Daily Expense Estimates Add Button");
145 waitAndClickByXpath("//button[contains(@data-submit_data, 'document.dailyExpenseEstimates')]");
146 }
147
148 protected void waitAndGetReturnValue() throws Exception {
149 gotoLightBox();
150 waitAndClickButtonByText(SEARCH);
151 waitAndClickByLinkText(RETURN_VALUE);
152 }
153
154 @Ignore("https://jira.kuali.org/browse/KULRICE-13357 AFT Failures Dialogs on CI")
155 @Test
156 public void testTravelAccountAuthorizationSubmitNav() throws Exception {
157 testTravelAccountAuthorizationSubmit();
158 passed();
159 }
160
161 @Test
162 public void testTravelAccountAuthorizationBlanketApproveNav() throws Exception {
163 testTravelAccountAuthorizationBlanketApprove();
164 passed();
165 }
166
167 @Ignore("https://jira.kuali.org/browse/KULRICE-13357 AFT Failures Dialogs on CI")
168 @Test
169 public void testTravelAccountAuthorizationSubmitBookmark() throws Exception {
170 testTravelAccountAuthorizationSubmit();
171 passed();
172 }
173
174 @Test
175 public void testTravelAccountAuthorizationBlanketApproveBookmark() throws Exception {
176 testTravelAccountAuthorizationBlanketApprove();
177 passed();
178 }
179 }