1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.labs.lookups;
17
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
21
22
23
24
25 public class LabsLookupDefaultCreateNewBlanketApproveAft extends LabsLookupBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LabsLookup-DefaultView&hideReturnLink=true";
31
32 protected String[][] inputVerifyDetails;
33
34 @Before
35 @Override
36 public void testSetUp() {
37 super.testSetUp();
38 getDescriptionUnique();
39 inputVerifyDetails = new String[][]{
40 {"Travel Account Name:", uniqueString},
41 {"Travel Account Number:", "z" + uniqueString.substring(4, 13)},
42 {"Fiscal Officer User ID:", "fran"},
43 {"Fiscal Officer:", "fran"},
44 {"Fiscal Officer Name:", "fran"},
45 {"Code And Description:", "CAT - Clearing"}
46 };
47 }
48
49 @Override
50 protected void blanketApproveSuccessfully() throws InterruptedException {
51 waitAndClickBlanketApprove();
52 waitAndClickConfirmBlanketApproveOk();
53 acceptAlertIfPresent();
54 waitForProgressLoading();
55
56
57
58 }
59
60
61 @Override
62 protected String getBookmarkUrl() {
63 return BOOKMARK_URL;
64 }
65
66 @Override
67 public String getUserName() {
68 return "admin";
69 }
70
71 @Override
72 protected String getDescriptionUnique() {
73
74 if (uniqueString == null) {
75 uniqueString = "z" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomCharsNot9Digits();
76 }
77 return getDescriptionBase() + " " + uniqueString;
78 }
79
80 @Override
81 protected void navigate() throws Exception {
82 navigateToLookup("Lookup Default");
83 }
84
85 @Test
86 public void testLabsLookupDefaultCreateNewBlanketApproveBookmark() throws Exception {
87 testLabsLookupDefaultCreateNewBlanketApprove();
88 passed();
89 }
90
91 @Test
92 public void testLabsLookupDefaultCreateNewBlanketApproveWithSubAccountBookmark() throws Exception {
93 testLabsLookupDefaultCreateNewBlanketApproveWithSubAccount();
94 passed();
95 }
96
97 @Test
98 public void testLabsLookupDefaultCreateNewBlanketApproveNav() throws Exception {
99 testLabsLookupDefaultCreateNewBlanketApprove();
100 passed();
101 }
102
103 @Test
104 public void testLabsLookupDefaultCreateNewBlanketApproveWithSubAccountNav() throws Exception {
105 testLabsLookupDefaultCreateNewBlanketApproveWithSubAccount();
106 passed();
107 }
108
109 protected void testLabsLookupDefaultCreateNewBlanketApprove()throws Exception {
110 navigateToCreateNew();
111
112
113
114 waitAndTypeLabeledInput("Description:", getDescriptionUnique());
115 waitAndTypeLabeledInput(inputVerifyDetails[0][0], inputVerifyDetails[0][1]);
116 waitAndTypeLabeledInput("Travel Account Number:", inputVerifyDetails[1][1]);
117 waitAndTypeLabeledInput("Fiscal Officer User ID:", inputVerifyDetails[2][1]);
118 waitAndClickByXpath("//input[@value='CAT']");
119
120
121 waitAndClickByLinkText("Notes and Attachments (0)");
122 waitAndTypeByXpath("//textarea[@maxlength='800']", "My Note " + uniqueString);
123 waitAndClickByXpath("//button[@title='Add a Note']");
124 waitForProgressLoading();
125
126
127 waitAndClickByLinkText("Ad Hoc Recipients");
128 waitAndTypeByXpath("//div[@data-parent='Uif-AdHocPersonCollection']/div/input", "admin");
129 waitAndClickAdHocPersonAdd();
130 waitForTextPresent("admin, admin");
131
132 blanketApproveSuccessfully();
133
134
135 open(getBaseUrlString() + LabsLookupDefaultAft.BOOKMARK_URL);
136 waitAndTypeLabeledInput("Travel Account Name:", inputVerifyDetails[0][1]);
137 waitAndClickSearchByText();
138 waitForProgressLoading();
139 waitAndClickLinkContainingText(inputVerifyDetails[1][1]);
140 waitForProgressLoading();
141 gotoLightBox();
142 assertLabeledTextPresent(inputVerifyDetails);
143 }
144
145 protected void testLabsLookupDefaultCreateNewBlanketApproveWithSubAccount()throws Exception {
146 navigateToCreateNew();
147
148 waitAndTypeLabeledInput("Description:", getDescriptionUnique());
149 waitAndTypeLabeledInput("Travel Account Name:", inputVerifyDetails[0][1]);
150 waitAndTypeLabeledInput("Travel Account Number:", inputVerifyDetails[1][1]);
151 waitAndTypeLabeledInput("Fiscal Officer User ID:", inputVerifyDetails[2][1]);
152 waitAndClickByXpath("//input[@value='CAT']");
153
154 waitAndTypeLabeledInput("Travel Sub Account Number:", uniqueString.substring(0,7) + "sa");
155 waitAndTypeLabeledInput("Sub Account Name:", "Sub Account " + uniqueString);
156 waitAndClickButtonByText("Add");
157 waitForProgressAddingLine();
158
159 waitAndClickByLinkText("Notes and Attachments (0)");
160 waitAndTypeByXpath("//textarea[@maxlength='800']", "My Note " + uniqueString);
161 waitAndClickByXpath("//button[@title='Add a Note']");
162 waitForProgressLoading();
163
164 waitAndClickByLinkText("Ad Hoc Recipients");
165 waitAndTypeByXpath("//div[@data-parent='Uif-AdHocPersonCollection']/div/input", "admin");
166 waitAndClickAdHocPersonAdd();
167 waitForTextPresent("admin, admin");
168
169 blanketApproveSuccessfully();
170
171
172 open(getBaseUrlString() + LabsLookupDefaultAft.BOOKMARK_URL);
173 waitAndTypeLabeledInput("Travel Account Name:", inputVerifyDetails[0][1]);
174 waitAndClickSearchByText();
175 waitForProgressLoading();
176 waitAndClickLinkContainingText(inputVerifyDetails[1][1]);
177 waitForProgressLoading();
178 gotoLightBox();
179 assertLabeledTextPresent(inputVerifyDetails);
180
181 assertTextPresent(new String[]{(uniqueString.substring(0,7) + "sa").toUpperCase(), "Sub Account " + uniqueString});
182 }
183 }