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
125
126 waitAndClickByLinkText("Ad Hoc Recipients");
127 waitAndTypeByXpath("//div[@data-parent='Uif-AdHocPersonCollection']/div/input", "admin");
128 waitAndClickAdHocPersonAdd();
129 waitForTextPresent("admin, admin");
130
131 blanketApproveSuccessfully();
132
133
134 open(getBaseUrlString() + LabsLookupDefaultAft.BOOKMARK_URL);
135 waitAndTypeLabeledInput("Travel Account Name:", inputVerifyDetails[0][1]);
136 waitAndClickSearchByText();
137 waitForProgressLoading();
138 waitAndClickLinkContainingText(inputVerifyDetails[1][1]);
139 waitForProgressLoading();
140 gotoLightBox();
141 assertLabeledTextPresent(inputVerifyDetails);
142 }
143
144 protected void testLabsLookupDefaultCreateNewBlanketApproveWithSubAccount()throws Exception {
145 navigateToCreateNew();
146
147 waitAndTypeLabeledInput("Description:", getDescriptionUnique());
148 waitAndTypeLabeledInput("Travel Account Name:", inputVerifyDetails[0][1]);
149 waitAndTypeLabeledInput("Travel Account Number:", inputVerifyDetails[1][1]);
150 waitAndTypeLabeledInput("Fiscal Officer User ID:", inputVerifyDetails[2][1]);
151 waitAndClickByXpath("//input[@value='CAT']");
152
153 waitAndTypeLabeledInput("Travel Sub Account Number:", uniqueString.substring(0,7) + "sa");
154 waitAndTypeLabeledInput("Sub Account Name:", "Sub Account " + uniqueString);
155 waitAndClickButtonByText("Add");
156
157 waitAndClickByLinkText("Notes and Attachments (0)");
158 waitAndTypeByXpath("//textarea[@maxlength='800']", "My Note " + uniqueString);
159 waitAndClickByXpath("//button[@title='Add a Note']");
160
161 waitAndClickByLinkText("Ad Hoc Recipients");
162 waitAndTypeByXpath("//div[@data-parent='Uif-AdHocPersonCollection']/div/input", "admin");
163 waitAndClickAdHocPersonAdd();
164 waitForTextPresent("admin, admin");
165
166 blanketApproveSuccessfully();
167
168
169 open(getBaseUrlString() + LabsLookupDefaultAft.BOOKMARK_URL);
170 waitAndTypeLabeledInput("Travel Account Name:", inputVerifyDetails[0][1]);
171 waitAndClickSearchByText();
172 waitForProgressLoading();
173 waitAndClickLinkContainingText(inputVerifyDetails[1][1]);
174 waitForProgressLoading();
175 gotoLightBox();
176 assertLabeledTextPresent(inputVerifyDetails);
177
178 assertTextPresent(new String[]{(uniqueString.substring(0,7) + "sa").toUpperCase(), "Sub Account " + uniqueString});
179 }
180 }