1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.testtools.selenium;
17
18 import org.openqa.selenium.Keys;
19
20 import org.apache.commons.lang.RandomStringUtils;
21 import org.junit.Before;
22 import org.kuali.rice.testtools.common.JiraAwareFailable;
23 import org.kuali.rice.testtools.common.JiraAwareFailureUtils;
24 import org.kuali.rice.testtools.common.PropertiesUtils;
25 import org.openqa.selenium.By;
26 import org.openqa.selenium.WebElement;
27
28 import java.io.IOException;
29 import java.text.SimpleDateFormat;
30 import java.util.ArrayList;
31 import java.util.Calendar;
32 import java.util.HashMap;
33 import java.util.List;
34 import java.util.Map;
35 import java.util.concurrent.TimeUnit;
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 public abstract class WebDriverLegacyITBase extends WebDriverAftBase {
60
61
62
63
64 public static final String ADMINISTRATION_LINK_TEXT = "Administration";
65
66
67
68
69 public static final String AGENDA_LOOKUP_LINK_TEXT = "Agenda Lookup";
70
71
72
73
74 public static final String BACKDOOR_ID_TEXT = "backdoorId";
75
76
77
78
79 public static final String BACKDOOR_LOGIN_BUTTON_XPATH = "//input[@title='Click to login.']";
80
81
82
83
84 public static final String BLANKET_APPROVE_NAME = "methodToCall.blanketApprove";
85
86
87
88
89
90 public static final String CANCEL_NAME = "methodToCall.cancel";
91
92
93
94
95
96 public static final String CANCEL2_XPATH = "//a[contains(text(), 'ancel')]";
97
98
99
100
101 public static final String CANCEL3_XPATH = "//a[@title='cancel']";
102
103
104
105
106 public static final String CLOSE_WINDOW_XPATH_TITLE = "//*[@title='close this window']";
107
108
109
110
111 public static final String COLLECTIONS_LINK_TEXT = "Collections";
112
113
114
115
116 public static final String CONFIGURATION_VIEW_WINDOW_TITLE = "Kuali :: Configuration Test View";
117
118
119
120
121 public static final String CONFIGURATION_VIEW_XPATH = "(//a[contains(text(),'Configuration Test View')])";
122
123
124
125
126 public static final String COPY_LINK_TEXT = "copy";
127
128
129
130
131 public static final String CREATE_NEW_DOCUMENT_NOT_SUBMITTED_SUCCESSFULLY_MESSAGE_TEXT = "New Document not submitted successfully";
132
133
134
135
136 public static final String CREATE_NEW_XPATH = "//img[@alt='create new']";
137
138
139
140
141 public static final String CREATE_NEW_XPATH2 = "//a[@title='Create a new record']";
142
143
144
145
146 public static final String DATA_TABLE_TR_CSS = "div.dataTables_wrapper tbody tr";
147
148
149
150
151 public static final String DIV_ERROR_LOCATOR = "//div[@class='error']";
152
153
154
155
156 public static final String DIV_ERROR_LOCATOR_KRAD = "//div[@class='alert alert-danger']/ul";
157
158
159
160
161 public static final String DIV_EXCOL_LOCATOR = "//div[@class='msg-excol']";
162
163
164
165
166 public static final String DIV_LEFT_ERRMSG = "//div[@class='left-errmsg-tab']/div/div";
167
168
169
170
171 public static final String DOC_CODE_XPATH = "//input[@id='document.newMaintainableObject.code']";
172
173
174
175
176 public static final String DOC_ID_XPATH = "//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]";
177
178
179
180
181 public static final String DOC_ID_KRAD_XPATH = "//div[@data-label=\"Document Number\"]";
182
183
184
185 public static final String DOC_ID_XPATH_2 = "//table[@id='row']/tbody/tr[1]/td[1]";
186
187
188
189
190 public static final String DOC_ID_XPATH_3 ="//table[@id='row']/tbody/tr[1]/td[1]/a";
191
192
193
194
195 public static final String DOC_DESCRIPTION_XPATH ="//input[@id='document.documentHeader.documentDescription']";
196
197
198
199
200 public static final String DOC_INITIATOR_XPATH = "//div[@id='headerarea']/div/table/tbody/tr[2]/td[1]";
201
202
203
204
205 public static final String DOC_SEARCH_XPATH = "//img[@alt='doc search']";
206
207
208
209
210 public static final String DOC_SEARCH_XPATH_TITLE = "//a[@title='Document Search']";
211
212
213
214
215 public static final String DOC_STATUS_ENROUTE = "ENROUTE";
216
217
218
219
220 public static final String DOC_STATUS_FINAL = "FINAL";
221
222
223
224
225 public static final String DOC_STATUS_SAVED = "SAVED";
226
227
228
229
230 public static final String DOC_STATUS_XPATH = "//table[@class='headerinfo']//tr[1]/td[2]";
231
232
233
234
235 public static final String DOC_STATUS_XPATH_2 = "//table[@id='row']/tbody/tr[1]/td[4]";
236
237
238
239
240 public static final String DOC_SUBMIT_SUCCESS_MSG_XPATH ="//div[contains(div,'Document was successfully submitted.')]";
241
242
243
244
245 public static final String EDIT_LINK_TEXT = "edit";
246
247
248
249
250 public static final String IFRAMEPORTLET_NAME = "iframeportlet";
251
252
253
254
255 public static final String KITCHEN_SINK_XPATH = "(//a[contains(text(),'Uif Components (Kitchen Sink)')])";
256
257
258
259
260 public static final String KRAD_XPATH = "KRAD";
261
262
263
264
265 public static final String KUALI_COLLECTION_TOTALLING_WINDOW_XPATH = "Kuali :: Collection Totaling";
266
267
268
269
270 public static final String KUALI_COLLECTION_TOTALLING_XPATH = "//a[text()='Collection Totaling']";
271
272
273
274
275 public static final String KUALI_UIF_COMPONENTS_WINDOW_XPATH = "Kuali :: Uif Components";
276
277
278
279
280 public static final String KUALI_VIEW_WINDOW_TITLE = "Kuali :: View Title";
281
282
283
284
285 public static final String LABEL_KUALI_KUALI_SYSTEMS = "KUALI - Kuali Systems";
286
287
288
289
290 public static final String LABEL_KUALI_DEFAULT = "KUALI : Default";
291
292
293
294
295 public static final String LOGOUT_XPATH = "//input[@name='imageField' and @value='Logout']";
296
297
298
299
300 public static final String MAIN_MENU_LINK_TEXT = "Main Menu";
301
302
303
304
305 public static final String RICH_MESSAGES_WINDOW_TITLE = "Kuali :: Rich Messages";
306
307
308
309
310 public static final String SAVE_SUCCESSFUL_XPATH = "//div[contains(div,'Document was successfully saved.')]";
311
312
313
314
315 public static final String SAVE_XPATH="//input[@name='methodToCall.save' and @alt='save']";
316
317
318
319
320
321 public static final String SAVE_XPATH_2 = "//*[@name='methodToCall.save' and @alt='save']";
322
323
324
325
326 public static final String SAVE_XPATH_3 = "//input[@title='search' and @name='methodToCall.search']";
327
328
329
330
331 public static final String SEARCH = "Search";
332
333
334
335
336 public static final String SEARCH_XPATH="//input[@name='methodToCall.search' and @value='search']";
337
338
339
340
341 public static final String SEARCH_XPATH_2 = "//input[@value='search']";
342
343
344
345
346 public static final String SEARCH_SECOND = "(//input[@name='methodToCall.search'])[2]";
347
348
349
350
351 public static final String SUBMIT_XPATH="//input[@name='methodToCall.route' and @alt='submit']";
352
353
354
355
356 public static final String APPROVE_XPATH="//input[@name='methodToCall.approve' and @alt='approve']";
357
358
359
360
361 public static final String DISAPPROVE_XPATH="//input[@name='methodToCall.disapprove' and @alt='disapprove']";
362
363
364
365
366 public static final String ACKNOWLEDGE_XPATH="//input[@name='methodToCall.acknowledge' and @alt='acknowledge']";
367
368
369
370
371 public static final String CLOSE_XPATH="//input[@name='methodToCall.close' and @alt='close']";
372
373
374
375
376 public static final String TRAVEL_ACCOUNT_LOOKUP_LINK_TEXT = "Travel Account Lookup";
377
378
379
380
381 public static final String UIF_COMPONENTS_KITCHEN_SINK_LINK_TEXT = "Uif Components (Kitchen Sink)";
382
383
384
385
386 public static final String VALIDATION_FRAMEWORK_DEMO_XPATH = "(//a[contains(text(),'Validation Framework Demo')])";
387
388
389
390
391 public static final String XML_INGESTER_LINK_TEXT = "XML Ingester";
392
393
394
395
396 public static final String FISCAL_OFFICER_INFO_MAINTENANCE_NEW_XPATH = "//a[@title='FiscalOfficerInfo Maintenance (New)']";
397
398 static {
399 if (System.getProperty(WebDriverUtils.REMOTE_PROPERTIES_PROPERTY) != null) {
400 PropertiesUtils propUtils = new PropertiesUtils();
401 try {
402 propUtils.loadPropertiesWithSystemAndOverridesIntoSystem(System.getProperty(WebDriverUtils.REMOTE_PROPERTIES_PROPERTY));
403 } catch (IOException ioe) {
404 System.out.println("Exception opening " + System.getProperty(WebDriverUtils.REMOTE_PROPERTIES_PROPERTY) + " " + ioe.getMessage());
405 }
406 }
407 }
408
409 protected String namespaceCode = "KR-WKFLW";
410
411 protected String uiFramework = AutomatedFunctionalTestUtils.REMOTE_UIF_KNS;
412
413 protected String uniqueString;
414
415 private static final Map<String, String> actionRequestLabelMap;
416 private static Map<String, String> actionRequestButtonMap;
417 static{
418 actionRequestLabelMap = new HashMap();
419 actionRequestLabelMap.put("A","APPROVE");
420 actionRequestLabelMap.put("F","FYI");
421 actionRequestLabelMap.put("C","COMPLETE");
422 actionRequestLabelMap.put("CR","COMPLETE");
423 actionRequestLabelMap.put("K","ACKNOWLEDGE");
424 actionRequestLabelMap.put("D","APPROVE");
425 actionRequestButtonMap = new HashMap();
426 actionRequestButtonMap.put("A","methodToCall.approve");
427 actionRequestButtonMap.put("F","methodToCall.fyi");
428 actionRequestButtonMap.put("C","methodToCall.complete");
429 actionRequestButtonMap.put("CR","methodToCall.route");
430 actionRequestButtonMap.put("K","methodToCall.acknowledge");
431 actionRequestButtonMap.put("D","methodToCall.disapprove");
432 }
433
434
435
436
437
438
439
440 @Before
441 public void testSetUp() {
442 super.testSetUp();
443 }
444
445
446
447
448
449 @Override
450 protected String getTestUrl() {
451 String testUrl = super.getTestUrl();
452 if (testUrl.contains(AutomatedFunctionalTestUtils.HIDE_RETURN_LINK) &&
453 !testUrl.contains("&showMaintenanceLinks=true")) {
454 testUrl += "&showMaintenanceLinks=true";
455 }
456 return testUrl;
457 }
458
459
460 protected void impersonateUser(String user) throws InterruptedException {
461 waitAndTypeByName(BACKDOOR_ID_TEXT,user);
462 jGrowl("Click Backdoor Login");
463 waitAndClickByXpath(BACKDOOR_LOGIN_BUTTON_XPATH);
464 }
465
466 protected void addAdHocRecipientsGroup(String[] adHocRecipients) throws InterruptedException {
467 addAdHocRecipientsGroup(new String[][]{adHocRecipients});
468 }
469
470 protected void addAdHocRecipientsGroup(String[][] adHocRecipients) throws InterruptedException {
471 String today = getDateToday();
472 Calendar nextYearCal = Calendar.getInstance();
473 nextYearCal.add(Calendar.YEAR, 1);
474 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
475 String nextYear = sdf.format(nextYearCal.getTime());
476
477 waitAndClickByName("methodToCall.toggleTab.tabAdHocRecipients");
478 for (int i = 0, s = adHocRecipients.length; i < s; i++) {
479 selectOptionByName("newAdHocRouteWorkgroup.actionRequested", adHocRecipients[i][1]);
480 waitAndTypeByName("newAdHocRouteWorkgroup.recipientName", adHocRecipients[i][0]);
481 waitAndTypeByName("newAdHocRouteWorkgroup.recipientNamespaceCode", adHocRecipients[i][2]);
482 WebDriverUtils.jGrowl(getDriver(), "Click Add Group", false, "Click Add Group");
483 waitAndClickByName("methodToCall.insertAdHocRouteWorkgroup");
484 }
485 }
486
487
488
489
490
491 protected void addAdHocRecipientsPerson(String[] adHocRecipients) throws InterruptedException {
492 addAdHocRecipientsPerson(new String[][]{adHocRecipients});
493 }
494
495
496
497
498
499 protected void addAdHocRecipientsPerson(String[][] adHocRecipients) throws InterruptedException {
500 String today = getDateToday();
501 Calendar nextYearCal = Calendar.getInstance();
502 nextYearCal.add(Calendar.YEAR, 1);
503 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
504 String nextYear = sdf.format(nextYearCal.getTime());
505
506 waitAndClickByName("methodToCall.toggleTab.tabAdHocRecipients");
507 for (int i = 0, s = adHocRecipients.length; i < s; i++) {
508 selectOptionByName("newAdHocRoutePerson.actionRequested", adHocRecipients[i][1]);
509 waitAndTypeByName("newAdHocRoutePerson.id", adHocRecipients[i][0]);
510
511
512
513
514
515
516 WebDriverUtils.jGrowl(getDriver(), "Click Add Person", false, "Click Add Person");
517 waitAndClickByName("methodToCall.insertAdHocRoutePerson");
518 }
519 }
520
521 protected void agendaLookupAssertions() throws Exception {
522 testLookUp();
523 assertTextPresent("Rules");
524 waitAndClickCancelByText();
525 }
526
527 protected void assertActionList(String docId, String actionListOptionValue, String state) throws InterruptedException {
528 selectTopFrame();
529 waitAndClickActionList();
530 selectFrameIframePortlet();
531 while (!waitForIsTextPresent(docId)) {
532 waitAndClickByLinkText("Next");
533 }
534 WebElement docIdTr = findElement(By.xpath("//table/tbody/tr/td/a[contains(text(), '" + docId + "')]/../.."));
535 assertTrue(docIdTr.getText() + " does not contain " + docId, docIdTr.getText().contains(docId));
536 assertTrue(docIdTr.getText() + " does not contain " + state, docIdTr.getText().contains(state));
537 assertTrue(docIdTr.getText() + " does not contain " + actionRequestLabelMap.get(actionListOptionValue), docIdTr.getText().contains(actionRequestLabelMap.get(actionListOptionValue)));
538
539 waitAndClickLinkContainingText(docId);
540 selectChildWindow();
541 waitAndClickByName(actionRequestButtonMap.get(actionListOptionValue));
542
543
544 if ("D".equals(actionListOptionValue)) {
545 waitAndTypeByName("reason","disapproved for AFT");
546 jGrowl("Click yes button");
547 waitAndClickByName("methodToCall.processAnswer.button0");
548 } else if ("C".equals(actionListOptionValue) || "CR".equals(actionListOptionValue)) {
549 waitAndClickByName("methodToCall.close");
550 }
551 waitForTextNotPresent(docId);
552 }
553
554 protected void assertNotInActionList(String docId) throws InterruptedException {
555 selectTopFrame();
556 waitAndClickActionList();
557 selectFrameIframePortlet();
558 waitForTextNotPresent(docId);
559 while (isElementPresentByLinkText("Next")) {
560 waitAndClickByLinkText("Next");
561 waitForTextNotPresent(docId);
562 }
563 }
564
565 protected void assertOutbox(String docId, String state) throws InterruptedException {
566
567 waitAndClickLinkContainingText("Outbox");
568 while (!waitForIsTextPresent(docId)) {
569 waitAndClickByLinkText("Next");
570 }
571 WebElement docIdTr = findElement(By.xpath("//table/tbody/tr/td/a[contains(text(), '" + docId + "')]/../.."));
572 assertTrue("Outbox items " + docIdTr.getText() + " does not contain " + docId, docIdTr.getText().contains(docId));
573 assertTrue("Outbox items " + docIdTr.getText() + " state is incorrect " + state, docIdTr.getText().contains(state));
574 waitForTextPresent(docId);
575
576
577
578
579 }
580
581 protected void assertBlanketApproveButtonsPresent() {
582 assertElementPresentByName("methodToCall.route");
583 assertElementPresentByName("methodToCall.save");
584 assertElementPresentByName(BLANKET_APPROVE_NAME, "Blanket Approve button not present does " + user + " have permssion?");
585 assertElementPresentByName("methodToCall.close");
586 assertElementPresentByName(CANCEL_NAME);
587 }
588
589 protected void assertDocFinal(String docId) throws InterruptedException {
590 assertDocSearch(docId, DOC_STATUS_FINAL);
591 }
592
593 protected void assertDocSearch(String docId, String docStatus) throws InterruptedException {
594 docSearch(docId);
595 waitForElementPresentByXpath(DOC_ID_XPATH_3);
596 jGrowl("Is doc status for docId: " + docId + " " + docStatus + "?");
597 assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
598 assertEquals(docStatus, getTextByXpath(DOC_STATUS_XPATH_2));
599 }
600
601 protected void docSearch(String docId) throws InterruptedException {
602 selectParentWindow();
603 selectTopFrame();
604 waitAndClickDocSearchTitle();
605 waitForPageToLoad();
606 selectFrameIframePortlet();
607 waitAndTypeByName("documentId", docId);
608 waitAndClickSearch();
609 }
610
611 protected void assertDocSearchNoResults(String docId) throws InterruptedException {
612 docSearch(docId);
613 waitForTextPresent("No values match this search.");
614 }
615
616 protected void assertRouteStatus(String status) throws InterruptedException {
617 waitForElementPresentByXpath("//th[contains(.,'Route Status')]/../following-sibling::*/td[contains(.,'" + status + "')]");
618 }
619
620 protected void assertTableLayout() throws Exception {
621 waitForTextPresent("Actions");
622 String pageSource = driver.getPageSource();
623 assertTrue(pageSource.contains("Table Layout"));
624 assertTrue(pageSource.contains("Field 1"));
625 assertTrue(pageSource.contains("Field 2"));
626 assertTrue(pageSource.contains("Field 3"));
627 assertTrue(pageSource.contains("Field 4"));
628 assertTrue(pageSource.contains("Actions"));
629 }
630
631 protected void blanketApproveAssert(String docId) throws InterruptedException {
632 checkForDocError();
633 assertDocSearch(docId, DOC_STATUS_FINAL);
634 }
635
636 protected void blanketApproveCheck() throws InterruptedException {
637 waitAndClickByName(BLANKET_APPROVE_NAME,
638 "No blanket approve button does the user " + getUserName() + " have permission?");
639 checkForIncidentReport();
640 }
641
642 public static String blanketApprovalCleanUpErrorText(String errorText) {
643 errorText = errorText.replace("* required field", "").replace("\n", " ").trim();
644 return errorText;
645 }
646
647
648
649
650
651
652
653
654 protected void blanketApproveTest(String docId) throws InterruptedException {
655 jGrowl("Click Blanket Approve");
656 waitAndClickByName(BLANKET_APPROVE_NAME,
657 "No blanket approve button does the user " + getUserName() + " have permission?");
658 Thread.sleep(2000);
659 checkForIncidentReport();
660 blanketApproveAssert(docId);
661 }
662
663
664 protected void failOnErrorMessageItem() {
665 failOnErrorMessageItem(this.getClass().getName());
666 }
667
668 protected void failOnErrorMessageItem(String message) {
669 final String error_locator = "//li[@class='uif-errorMessageItem']";
670 if (findElements(By.xpath(error_locator)).size() > 0) {
671 String errorText = null;
672
673 try {
674 errorText = getTextByXpath(error_locator);
675 } catch (InterruptedException e) {
676 e.printStackTrace();
677 }
678
679 if (errorText != null && errorText.contains("errors")) {
680 jiraAwareFail((errorText + " " + message).trim());
681 }
682
683 }
684 }
685
686
687
688
689 public void checkForDocError() {
690 if (hasDocError()) {
691 String errorText = extractErrorText();
692 jiraAwareFail(errorText);
693 }
694 }
695
696
697
698
699 public void checkForDocErrorKrad() {
700 if (hasDocErrorKrad()) {
701 String errorText = extractErrorTextKrad();
702 jiraAwareFail(errorText);
703 }
704 }
705
706 protected String extractErrorText() {
707 String errorText = driver.findElement(By.xpath(DIV_ERROR_LOCATOR)).getText();
708 errorText = blanketApprovalCleanUpErrorText(errorText);
709 if (driver.findElements(By.xpath(DIV_EXCOL_LOCATOR)).size() > 0) {
710 errorText = blanketApprovalCleanUpErrorText(driver.findElement(
711
712 By.xpath(DIV_EXCOL_LOCATOR)).getText());
713 }
714 if (driver.findElements(By.xpath(DIV_LEFT_ERRMSG)).size() > 0) {
715 errorText = errorText + blanketApprovalCleanUpErrorText(driver.findElement(
716 By.xpath(DIV_LEFT_ERRMSG)).getText());
717 }
718 return errorText;
719 }
720
721 protected String extractErrorTextKrad() {
722 return driver.findElement(By.xpath(DIV_ERROR_LOCATOR_KRAD)).getText();
723 }
724
725
726
727
728
729 public boolean hasDocError() {
730 if (driver.findElements(By.xpath(DIV_ERROR_LOCATOR)).size() > 0) {
731 String errorText = driver.findElement(By.xpath(DIV_ERROR_LOCATOR)).getText();
732 if (errorText != null && errorText.contains("error(s) found on page.")) {
733 return true;
734 }
735 }
736 return false;
737 }
738
739
740
741
742
743 public boolean hasDocErrorKrad() {
744 if (driver.findElements(By.xpath(DIV_ERROR_LOCATOR_KRAD)).size() > 0) {
745 String errorText = driver.findElement(By.xpath(DIV_ERROR_LOCATOR_KRAD)).getText();
746 if (errorText != null && !errorText.equals("")) {
747 return true;
748 }
749 }
750 return false;
751 }
752
753
754
755
756
757
758 public boolean hasDocError(String errorTextToMatch) {
759 if (driver.findElements(By.xpath(DIV_ERROR_LOCATOR)).size() > 0) {
760 String errorText = driver.findElement(By.xpath(DIV_ERROR_LOCATOR)).getText();
761 if (errorText != null && errorText.contains("error(s) found on page.")) {
762 WebElement errorDiv = driver.findElement(By.xpath("//div[@class='left-errmsg']/div[2]/div")); // don't highlight
763 if (errorDiv != null) {
764 errorText = errorDiv.getText();
765 return errorText != null && errorText.contains(errorTextToMatch);
766 }
767 }
768 }
769 return false;
770 }
771
772 protected String configNameSpaceBlanketApprove() throws Exception {
773 String docId = waitForDocId();
774 String dtsPlusTwoChars = AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
775 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Namespace " + AutomatedFunctionalTestUtils
776 .createUniqueDtsPlusTwoRandomCharsNot9Digits());
777 assertBlanketApproveButtonsPresent();
778 waitAndTypeByXpath(DOC_CODE_XPATH, "VTN" + dtsPlusTwoChars);
779 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']",
780 "Validation Test NameSpace " + dtsPlusTwoChars);
781 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.applicationId']", "RICE");
782
783 return docId;
784 }
785
786 protected void contextLookupAssertions() throws Exception {
787 testLookUp();
788 assertTextPresent("Notes and Attachments");
789 jGrowl("Click Cancel");
790 waitAndClickByXpath("//button[@data-performDirtyValidation=\"true\"]"); // first cancel button is for attachment cancel and is hidden
791 }
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823 protected void expandColapseByXpath(String clickLocator, String visibleLocator) throws InterruptedException {
824 waitAndClickByXpath(clickLocator);
825 waitIsVisibleByXpath(visibleLocator);
826 waitAndClickByXpath(clickLocator);
827 waitNotVisibleByXpath(visibleLocator);
828 }
829
830 protected String getDescriptionBase() {
831 return this.getClass().toString().substring(this.getClass().toString().lastIndexOf(".") + 1,
832 this.getClass().toString().length()) +
833 "." + testMethodName + " description";
834 }
835
836 protected String getDescriptionUnique() {
837 if (uniqueString == null) {
838 uniqueString = AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomCharsNot9Digits();
839 }
840 return getDescriptionBase() + " " + uniqueString;
841 }
842
843 protected String getDocStatus() {
844 return findElement(By.xpath(DOC_STATUS_XPATH_2)).getText();
845 }
846
847
848
849
850
851
852
853
854
855 protected void gotoNestedFrame() {
856 driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
857 driver.switchTo().defaultContent();
858 final String iframeXpath = "//iframe";
859
860 gotoIframeByXpath(iframeXpath);
861
862 gotoIframeByXpath(iframeXpath);
863
864 driver.manage().timeouts().implicitlyWait(waitSeconds, TimeUnit.SECONDS);
865 }
866
867 @Override
868 protected void logout() throws InterruptedException {
869 selectTopFrame();
870 if (isElementPresentByXpath(LOGOUT_XPATH)) {
871 waitAndClickLogout(this);
872 }
873 }
874
875 protected void lookupDocByWildcardedUniqueStringName() throws InterruptedException {
876 open(getBaseUrlString() + getBookmarkUrl());
877 selectFrameIframePortlet();
878 waitAndTypeByName("name", "*" + uniqueString);
879 waitAndClickSearch();
880 }
881
882 protected boolean noAffilication() {
883 return !isElementPresentByName("document.affiliations[0].dflt");
884 }
885
886 protected void saveSuccessfully() throws InterruptedException {
887 waitAndClickSaveByText();
888 waitForProgressSaving();
889 checkForDocErrorKrad();
890 waitForTextPresent("Document was successfully saved.");
891 }
892
893 protected void selectFrameIframePortlet() {
894 selectFrame(IFRAMEPORTLET_NAME);
895 }
896
897 protected void selectFrame(String locator) {
898
899 if (IFRAMEPORTLET_NAME.equals(locator)) {
900 gotoNestedFrame();
901 } else {
902 WebDriverUtils.selectFrameSafe(driver, locator);
903 }
904 }
905
906 protected void submitSuccessfully() throws InterruptedException {
907
908 submitSuccessfully(120);
909 }
910
911 protected void submitSuccessfully(int loadingSeconds) throws InterruptedException {
912 waitAndClickSubmitByText();
913 waitAndClickConfirmationOk();
914 waitForProgressLoading(loadingSeconds);
915 Thread.sleep(500);
916 checkForDocError();
917 checkForDocErrorKrad();
918 waitForTextPresent("Document was successfully submitted.");
919 }
920
921
922 protected void testAddingNamespace() throws Exception {
923 testAddingNamespace(this);
924 }
925
926
927 protected void testAddingNamespace(JiraAwareFailable failable) throws Exception {
928 selectFrameIframePortlet();
929 waitAndCreateNew();
930 waitForElementPresentByXpath(SAVE_XPATH_2, "save button does not exist on the page");
931
932
933 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Adding PEANUTS");
934 waitAndTypeByXpath("//*[@id='document.documentHeader.explanation']", "I want to add PEANUTS to test KIM");
935 waitAndTypeByXpath(DOC_CODE_XPATH, "PEANUTS");
936 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", "The Peanuts Gang");
937 checkByXpath("//input[@id='document.newMaintainableObject.active']");
938 waitAndClickByXpath(SAVE_XPATH_2);
939 waitForElementPresentByXpath(SAVE_SUCCESSFUL_XPATH, "Document is not saved successfully");
940
941
942 assertEquals(DOC_STATUS_SAVED, findElement(By.xpath("//table[@class='headerinfo']/tbody/tr[1]/td[2]")).getText());
943 assertEquals("admin", findElement(By.xpath("//table[@class='headerinfo']/tbody/tr[2]/td[1]/a")).getText());
944 }
945
946 protected void testAddingBrownGroup() throws Exception {
947 selectFrameIframePortlet();
948 waitAndCreateNew();
949 String docId = waitForDocId();
950 String random = RandomStringUtils.randomNumeric(4);
951 String organizationDocumentNumber = "ORD" + random;
952 String groupDescription = "GD" + random;
953 String groupName = "BrownGroup " + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
954 String nameSpace = "KR-IDM";
955 String today = getDateToday();
956 Calendar nextYearCal = Calendar.getInstance();
957 nextYearCal.add(Calendar.YEAR, 1);
958 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
959 String nextYear = sdf.format(nextYearCal.getTime());
960
961
962 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Brown Group");
963 waitAndTypeByName("document.documentHeader.explanation", "I want to add Brown Group to test KIM");
964 waitAndTypeByName("document.documentHeader.organizationDocumentNumber", organizationDocumentNumber);
965 selectOptionByName("document.groupNamespace", nameSpace);
966 waitAndTypeByName("document.groupName", groupName);
967 waitAndTypeByName("document.groupDescription", groupDescription);
968
969 checkByName("document.active");
970 waitAndClickByXpath(SAVE_XPATH_2);
971 waitForTextPresent("Document was successfully saved.");
972 }
973
974 protected void testAddingBrownGroupSubmit() throws Exception {
975 selectFrameIframePortlet();
976 waitAndCreateNew();
977 String docId = waitForDocId();
978 String random = RandomStringUtils.randomNumeric(4);
979 String organizationDocumentNumber = "ORD" + random;
980 String groupDescription = "GD" + random;
981 String groupName = "BrownGroup " + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
982 String nameSpace = "KR-IDM";
983 String today = getDateToday();
984 acceptAlertIfPresent();
985 Calendar nextYearCal = Calendar.getInstance();
986 nextYearCal.add(Calendar.YEAR, 1);
987 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
988 String nextYear = sdf.format(nextYearCal.getTime());
989
990
991 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Brown Group");
992 waitAndTypeByName("document.documentHeader.explanation", "I want to add Brown Group to test KIM");
993 waitAndTypeByName("document.documentHeader.organizationDocumentNumber", organizationDocumentNumber);
994 selectOptionByName("document.groupNamespace", nameSpace);
995 waitAndTypeByName("document.groupName", groupName);
996 waitAndTypeByName("document.groupDescription", groupDescription);
997
998 checkByName("document.active");
999 waitAndClickByXpath(SUBMIT_XPATH);
1000 }
1001
1002 protected void testAddingBrownGroupSaveSubmit() throws Exception {
1003 selectFrameIframePortlet();
1004 waitAndCreateNew();
1005 String docId = waitForDocId();
1006 String random = RandomStringUtils.randomNumeric(4);
1007 String organizationDocumentNumber = "ORD" + random;
1008 String groupDescription = "GD" + random;
1009 String groupName = "BrownGroup " + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1010 String nameSpace = "KR-IDM";
1011 String today = getDateToday();
1012 Calendar nextYearCal = Calendar.getInstance();
1013 nextYearCal.add(Calendar.YEAR, 1);
1014 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
1015 String nextYear = sdf.format(nextYearCal.getTime());
1016
1017
1018 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Brown Group");
1019 waitAndTypeByName("document.documentHeader.explanation", "I want to add Brown Group to test KIM");
1020 waitAndTypeByName("document.documentHeader.organizationDocumentNumber", organizationDocumentNumber);
1021 selectOptionByName("document.groupNamespace", nameSpace);
1022 waitAndTypeByName("document.groupName", groupName);
1023 waitAndTypeByName("document.groupDescription", groupDescription);
1024
1025 waitAndClickByXpath(SAVE_XPATH_2);
1026 waitForTextPresent("Document was successfully saved.");
1027 waitAndClickByXpath(SUBMIT_XPATH);
1028 waitForTextPresent("Document was successfully submitted.");
1029 }
1030
1031 protected void testAttributeDefinitionLookUp() throws Exception {
1032 waitForPageToLoad();
1033 selectFrameIframePortlet();
1034 waitAndClickByXpath("//button[contains(.,'earch')]");
1035 Thread.sleep(3000);
1036 waitForPageToLoad();
1037 findElement(By.tagName("body")).getText().contains("Actions");
1038 waitAndClickByLinkText("1000");
1039 waitForPageToLoad();
1040 findElement(By.tagName("body")).getText().contains("Attribute Inquiry");
1041 findElement(By.tagName("body")).getText().contains("KRMS Attributes");
1042 findElement(By.tagName("body")).getText().contains("Attribute Label");
1043 findElement(By.tagName("body")).getText().contains("1000");
1044 findElement(By.tagName("body")).getText().contains("peopleFlowId");
1045 findElement(By.tagName("body")).getText().contains("KR-RULE");
1046 findElement(By.tagName("body")).getText().contains("PeopleFlow");
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060 passed();
1061 }
1062
1063 protected void testCancelConfirmation() throws InterruptedException {
1064 waitAndCancelConfirmation();
1065 }
1066
1067 protected void testCreateNewAgenda() throws Exception {
1068 selectFrameIframePortlet();
1069 selectByName("document.newMaintainableObject.dataObject.namespace", "Kuali Rules Test");
1070 String agendaName = "Agenda Date :" + Calendar.getInstance().getTime().toString();
1071 waitAndTypeByName("document.newMaintainableObject.dataObject.agenda.name", "Agenda " + agendaName);
1072 fireEvent("document.newMaintainableObject.dataObject.contextName", "focus");
1073 waitAndTypeByName("document.newMaintainableObject.dataObject.contextName", "Context1");
1074 fireEvent("document.newMaintainableObject.dataObject.contextName", "blur");
1075 Thread.sleep(1000);
1076
1077 fireEvent("document.newMaintainableObject.dataObject.contextName", "focus");
1078 fireEvent("document.newMaintainableObject.dataObject.contextName", "blur");
1079 waitForElementPresentByName("document.newMaintainableObject.dataObject.agenda.typeId");
1080 selectByName("document.newMaintainableObject.dataObject.agenda.typeId", "Campus Agenda");
1081 waitForElementPresentByName("document.newMaintainableObject.dataObject.customAttributesMap[Campus]");
1082 waitAndTypeByName("document.newMaintainableObject.dataObject.customAttributesMap[Campus]", "BL");
1083 waitAndClickSubmitByText();
1084 waitAndClickConfirmationOk();
1085 assertTextPresent(new String[]{"Document was successfully submitted.", "ENROUTE"});
1086 passed();
1087 }
1088
1089 protected void testCreateDocType() throws Exception {
1090 selectFrameIframePortlet();
1091 waitAndCreateNew();
1092 assertElementPresentByXpath("//*[@name='methodToCall.route' and @alt='submit']","submit button does not exist on the page");
1093
1094
1095
1096 String docId = waitForDocId();
1097 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Creating new Document Type");
1098 String parentDocType = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:document.newMaintainableObject.parentDocType.name,documentTypeId:document.newMaintainableObject.docTypeParentId,))).((`document.newMaintainableObject.parentDocType.name:name,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
1099 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
1100 waitAndClickByXpath(parentDocType);
1101 waitForPageToLoad();
1102 Thread.sleep(2000);
1103 waitAndClickSearch();
1104 waitAndClickReturnValue();
1105 String docTypeName = "TestDocType" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1106 waitForElementPresentByXpath("//input[@id='document.newMaintainableObject.name']");
1107 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", docTypeName);
1108 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.unresolvedDocHandlerUrl']","${kr.url}/maintenance.do?methodToCall=docHandler");
1109
1110
1111 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.label']", "Label for " + docTypeName);
1112 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.unresolvedHelpDefinitionUrl']","default.htm?turl=WordDocuments%2Fdocumenttype.htm");
1113 jGrowl("Click Submit button");
1114 waitAndClickByXpath("//*[@name='methodToCall.route' and @alt='submit']");
1115 checkForIncidentReport();
1116 waitForPageToLoad();
1117 driver.switchTo().defaultContent();
1118 waitAndClickDocSearchTitle();
1119 waitForPageToLoad();
1120 selectFrameIframePortlet();
1121 waitAndTypeByName("documentId", docId);
1122 waitAndClickSearch();
1123 assertEquals(docId, waitForElementPresent(By.xpath(DOC_ID_XPATH_2)).getText());
1124 }
1125
1126 protected String testCreateNew() throws InterruptedException {
1127 selectFrameIframePortlet();
1128 waitAndCreateNew();
1129 String docId = verifyDocInitiated();
1130 createNewEnterDetails();
1131 return docId;
1132 }
1133
1134 protected String testCreateNewCancel() throws Exception {
1135 selectFrameIframePortlet();
1136 waitAndCreateNew();
1137 String docId = verifyDocInitiated();
1138 createNewEnterDetails();
1139 testCancelConfirmation();
1140 assertDocSearchNoResults(docId);
1141 return docId;
1142 }
1143
1144 protected void testCreateNewRequired() throws Exception {
1145 selectFrameIframePortlet();
1146 waitAndCreateNew();
1147 waitAndClickSubmit();
1148 waitForElementVisibleBy(By.xpath("//div[@class='error']")).getText().contains(" error(s) found on page.");
1149 }
1150
1151 protected String testCreateNewSave() throws Exception {
1152 selectFrameIframePortlet();
1153 waitAndCreateNew();
1154 String docId = verifyDocInitiated();
1155 createNewEnterDetails();
1156 waitAndClickSave();
1157
1158 int attempts = 0;
1159 while (hasDocError() && extractErrorText().contains("a record with the same primary key already exists.") &&
1160 ++attempts <= 3) {
1161 uniqueString = null;
1162 jGrowl("record with the same primary key already exists");
1163 createNewEnterDetails();
1164 waitAndClickSave();
1165 }
1166
1167 checkForDocError();
1168 waitForElementVisibleBy(By.xpath(SAVE_SUCCESSFUL_XPATH));
1169 assertDocSearch(docId, "SAVED");
1170 waitAndClickRouteLogIcon();
1171 assertRouteStatus("SAVED");
1172 return docId;
1173 }
1174
1175 protected String testCreateNewSubmit() throws Exception {
1176 selectFrameIframePortlet();
1177 waitAndCreateNew();
1178 String docId = verifyDocInitiated();
1179 createNewEnterDetails();
1180 waitAndClickSubmit();
1181 int attempts = 0;
1182 while (hasDocError() && extractErrorText().contains("a record with the same primary key already exists.") &&
1183 ++attempts <= 3) {
1184 uniqueString = null;
1185 jGrowl("record with the same primary key already exists");
1186 createNewEnterDetails();
1187 waitAndClickSubmit();
1188 }
1189
1190 checkForDocError();
1191 waitForElementVisibleBy(By.xpath(DOC_SUBMIT_SUCCESS_MSG_XPATH));
1192 assertDocSearch(docId, "FINAL");
1193 waitAndClickRouteLogIcon();
1194 assertRouteStatus("FINAL");
1195 return docId;
1196 }
1197
1198 protected String testCreateNewSaveSubmit() throws Exception {
1199 selectFrameIframePortlet();
1200 waitAndCreateNew();
1201 String docId = verifyDocInitiated();
1202 createNewEnterDetails();
1203 waitAndClickSave();
1204
1205 int attempts = 0;
1206 while (hasDocError() && extractErrorText().contains("a record with the same primary key already exists.") &&
1207 ++attempts <= 3) {
1208 uniqueString = null;
1209 jGrowl("record with the same primary key already exists");
1210 createNewEnterDetails();
1211 waitAndClickSave();
1212 }
1213
1214 checkForDocError();
1215 waitForElementVisibleBy(By.xpath(SAVE_SUCCESSFUL_XPATH));
1216 waitAndClickSubmit();
1217 checkForDocError();
1218 waitForElementVisibleBy(By.xpath(DOC_SUBMIT_SUCCESS_MSG_XPATH));
1219 assertDocSearch(docId, "FINAL");
1220 waitAndClickRouteLogIcon();
1221 assertRouteStatus("FINAL");
1222 return docId;
1223 }
1224
1225 protected String verifyDocInitiated() throws InterruptedException {
1226 String docId = waitForDocId();
1227 assertEquals("INITIATED", waitForDocStatus());
1228 assertEquals(getUserName(), waitForDocInitiator());
1229 return docId;
1230 }
1231
1232 protected List<String> testCreateNewParameter(String docId, String parameterName) throws Exception {
1233 waitForPageToLoad();
1234 docId = waitForDocId();
1235
1236 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Parameter");
1237 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW");
1238 waitAndTypeByName("document.newMaintainableObject.componentCode", "ActionList");
1239 waitAndTypeByName("document.newMaintainableObject.applicationId", "KUALI");
1240 parameterName = "TestIndicator" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1241 waitAndTypeByName("document.newMaintainableObject.name", parameterName);
1242 waitAndTypeByName("document.newMaintainableObject.value", "Y");
1243 waitAndTypeByName("document.newMaintainableObject.description", "for testing");
1244 selectOptionByName("document.newMaintainableObject.parameterTypeCode", "HELP");
1245 waitAndClickByXpath("//input[@name='document.newMaintainableObject.evaluationOperatorCode' and @value='A']");
1246 waitAndClickSave();
1247 waitAndClickSubmit();
1248 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1249
1250
1251 assertDocSearch(docId, DOC_STATUS_FINAL);
1252 selectTopFrame();
1253 List<String> params = new ArrayList<String>();
1254 params.add(docId);
1255 params.add(parameterName);
1256
1257 return params;
1258 }
1259
1260 protected List<String> testCreateNewParameterType(String docId, String parameterType, String parameterCode)throws Exception {
1261 waitForPageToLoad();
1262 docId = waitForDocId();
1263
1264
1265 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Parameter Type");
1266 parameterCode = RandomStringUtils.randomAlphabetic(4).toLowerCase();
1267 waitAndTypeByName("document.newMaintainableObject.code", parameterCode);
1268 parameterType = "testing " + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1269 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
1270 waitAndClickSave();
1271 waitAndClickSubmit();
1272 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1273 assertDocSearch(docId, DOC_STATUS_FINAL);
1274 selectTopFrame();
1275 List<String> params = new ArrayList<String>();
1276 params.add(docId);
1277 params.add(parameterType);
1278 params.add(parameterCode);
1279
1280 return params;
1281 }
1282
1283 protected void testCreateNewSearchReturnValueCancelConfirmation() throws InterruptedException, Exception {
1284 selectFrameIframePortlet();
1285 waitAndCreateNew();
1286 waitAndClickSearch2();
1287 waitAndClickReturnValue();
1288 waitAndCancelConfirmation();
1289 passed();
1290 }
1291
1292 protected List<String> testCopyParameter(String docId, String parameterName) throws Exception {
1293 selectFrameIframePortlet();
1294 waitAndClickCopy();
1295 waitForPageToLoad();
1296 docId = waitForDocId();
1297 waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Parameter");
1298 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW");
1299 waitAndTypeByName("document.newMaintainableObject.componentCode", "ActionList");
1300 waitAndTypeByName("document.newMaintainableObject.applicationId", "KUALI");
1301 parameterName = "TestIndicator" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1302 waitAndTypeByName("document.newMaintainableObject.name", parameterName);
1303 waitAndClickSave();
1304 waitAndClickSubmit();
1305 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1306 assertDocSearch(docId, DOC_STATUS_FINAL);
1307 selectTopFrame();
1308 List<String> params = new ArrayList<String>();
1309 params.add(docId);
1310 params.add(parameterName);
1311
1312 return params;
1313 }
1314
1315 protected List<String> testCopyParameterType(String docId, String parameterType, String parameterCode) throws Exception {
1316 selectFrameIframePortlet();
1317 waitAndClickCopy();
1318 waitForPageToLoad();
1319 docId = waitForDocId();
1320 waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Parameter");
1321 parameterCode = RandomStringUtils.randomAlphabetic(4).toLowerCase();
1322 waitAndTypeByName("document.newMaintainableObject.code", parameterCode);
1323 clearTextByName("document.newMaintainableObject.name");
1324 parameterType = "testing " + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1325 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
1326 waitAndClickSave();
1327 waitAndClickSubmit();
1328 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1329 assertDocSearch(docId, DOC_STATUS_FINAL);
1330 selectTopFrame();
1331 List<String> params = new ArrayList<String>();
1332 params.add(docId);
1333 params.add(parameterType);
1334 params.add(parameterCode);
1335
1336 return params;
1337 }
1338
1339 protected void testDemoCustomRuleEventAndDocumentEventMethodInvocationAccountTypeChec() throws InterruptedException {
1340 String randomCode = org.apache.commons.lang3.RandomStringUtils.randomAlphabetic(9).toUpperCase();
1341 waitAndTypeByName("document.documentHeader.documentDescription","Travel Account Maintenance New Test Document " + randomCode);
1342 waitAndTypeByName("document.newMaintainableObject.dataObject.number",randomCode);
1343 waitAndTypeByName("document.newMaintainableObject.dataObject.name","Test Account Name " + randomCode);
1344 waitAndClickByXpath("//button[contains(text(),'Submit')]");
1345 assertTravelAccountTypeCodeRequired();
1346 }
1347
1348 protected void assertTravelAccountTypeCodeRequired() throws InterruptedException {
1349 waitForTextPresent("Travel Account Type Code: Required");
1350 fireEvent("document.newMaintainableObject.dataObject.accountTypeCode", "focus");
1351 waitForElementVisibleBy(By.xpath("//div[@class='popover top in uif-tooltip-error-cs']"));
1352 fireEvent("document.newMaintainableObject.dataObject.accountTypeCode", "blur");
1353 waitAndTypeByName("document.newMaintainableObject.dataObject.number", "a");
1354 if(isVisibleByXpath("//div[@class='popover top in uif-tooltip-error-cs']")){
1355 JiraAwareFailureUtils.fail("Required popup still present", this);
1356 }
1357 }
1358
1359 protected void testDocTypeLookup() throws Exception {
1360 selectFrameIframePortlet();
1361 waitAndClickByXpath("//input[@title='Search Parent Name']");
1362 waitAndClickByXpath(SAVE_XPATH_3);
1363 waitAndClickByXpath("//table[@id='row']/tbody/tr[contains(td[3],'RiceDocument')]/td[1]/a");
1364 waitAndClickByXpath(SAVE_XPATH_3);
1365 assertEquals("RiceDocument", getTextByXpath("//table[@id='row']/tbody/tr/td[4]/a"));
1366 waitAndClickByName("methodToCall.clearValues");
1367 waitAndTypeByName("name", "Kuali*D");
1368 waitAndClickByXpath(SAVE_XPATH_3);
1369 assertElementPresentByXpath("//table[@id='row']/tbody/tr[contains(td[3], 'KualiDocument')]");
1370 String docIdOld = getTextByXpath("//table[@id='row']/tbody/tr[contains(td[3], 'KualiDocument')]/td[2]/a");
1371 waitAndClickByName("methodToCall.clearValues");
1372 waitAndTypeByName("label", "KualiDocument");
1373 waitAndClickByXpath(SAVE_XPATH_3);
1374 assertElementPresentByXpath("//table[@id='row']/tbody/tr[contains(td[5], 'KualiDocument')]");
1375 waitAndClickByName("methodToCall.clearValues");
1376 waitAndTypeByName("documentTypeId", docIdOld);
1377 waitAndClickByXpath(SAVE_XPATH_3);
1378 assertElementPresentByXpath("//table[@id='row']/tbody/tr[contains(td[2], '" + docIdOld + "')]");
1379 }
1380
1381 protected void testEditCopy(String docId) throws InterruptedException {
1382 String desc = getDescriptionUnique();
1383 jiraAwareTypeByName("document.documentHeader.documentDescription", desc);
1384 String thisDocId = verifyDocInitiated();
1385 assertFalse("Document id should not be the same as original (" + docId + ").", docId.equals(thisDocId));
1386 waitAndClickSave();
1387 waitForElementVisibleBy(By.xpath(SAVE_SUCCESSFUL_XPATH));
1388 assertDocSearch(docId, "FINAL");
1389 waitAndClickRouteLogIcon();
1390 assertRouteStatus("FINAL");
1391 waitForElementPresentByXpath("//th[contains(.,'Title')]/../following-sibling::*/td[contains(.,'" + desc + "')]");
1392 }
1393
1394 protected List<String> testEditParameterType(String docId, String parameterType, String parameterCode) throws Exception {
1395 selectFrameIframePortlet();
1396 waitAndClickEdit();
1397 waitForPageToLoad();
1398 docId = waitForDocId();
1399 waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Parameter");
1400 clearTextByName("document.newMaintainableObject.name");
1401 parameterType = "testing " + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1402 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
1403 waitAndClickSave();
1404 waitAndClickSubmit();
1405 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1406 assertDocSearch(docId, DOC_STATUS_FINAL);
1407 selectTopFrame();
1408 List<String> params = new ArrayList<String>();
1409 params.add(docId);
1410 params.add(parameterType);
1411 params.add(parameterCode);
1412
1413 return params;
1414 }
1415
1416 protected List<String> testEditParameter(String docId, String parameterName) throws Exception {
1417 selectFrameIframePortlet();
1418 waitAndClickEdit();
1419 waitForPageToLoad();
1420 docId = waitForDocId();
1421 waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Parameter");
1422 clearTextByName("document.newMaintainableObject.value");
1423 waitAndTypeByName("document.newMaintainableObject.value", "N");
1424 waitAndClickSave();
1425 waitAndClickSubmit();
1426 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1427 assertDocSearch(docId, DOC_STATUS_FINAL);
1428 selectTopFrame();
1429 List<String> params = new ArrayList<String>();
1430 params.add(docId);
1431 params.add(parameterName);
1432 return params;
1433 }
1434
1435 protected void testEditRouteRulesDelegation() throws Exception {
1436 waitForPageToLoad();
1437 Thread.sleep(3000);
1438 assertEquals("Kuali Portal Index", getTitle());
1439 selectFrameIframePortlet();
1440 waitAndClickSearch();
1441 waitAndClickEdit();
1442 waitForPageToLoad();
1443 Thread.sleep(3000);
1444 assertTrue(isElementPresentByName(CANCEL_NAME));
1445 waitAndClickCancel();
1446 waitAndClickByName("methodToCall.processAnswer.button0");
1447 waitForPageToLoad();
1448 passed();
1449 }
1450
1451 protected void testFiscalOfficerInfoMaintenanceNew() throws Exception {
1452 selectFrameIframePortlet();
1453 checkForIncidentReport();
1454 String docId = getTextByXpath("//*[@id='u13_control']");
1455 waitAndTypeByXpath("//input[@name='document.documentHeader.documentDescription']", "New FO Doc");
1456 waitAndTypeByXpath("//input[@name='document.newMaintainableObject.dataObject.id']", "5");
1457 waitAndTypeByXpath("//input[@name='document.newMaintainableObject.dataObject.userName']", "Jigar");
1458 waitAndClickByXpath("//button[@id='usave']");
1459 Integer docIdInt = Integer.valueOf(docId).intValue();
1460 waitAndClickActionList();
1461 selectFrameIframePortlet();
1462
1463 if(isElementPresentByLinkText("Last")){
1464 waitAndClickByLinkText("Last");
1465 waitAndClickByLinkText(docIdInt.toString());
1466 } else {
1467 waitAndClickByLinkText(docIdInt.toString());
1468 }
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503 }
1504
1505 protected void testIdentityPersonBlanketApprove() throws Exception {
1506 selectFrameIframePortlet();
1507 waitAndCreateNew();
1508 String docId = waitForDocId();
1509 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Person");
1510 assertBlanketApproveButtonsPresent();
1511 waitAndTypeByXpath("//input[@id='document.principalName']", "principal" + RandomStringUtils.randomAlphabetic(3).toLowerCase());
1512 selectByName("newAffln.affiliationTypeCode", "Affiliate");
1513 selectByName("newAffln.campusCode", "BX - BLGTN OFF CAMPUS");
1514 selectByName("newAffln.campusCode", "BL - BLOOMINGTON");
1515 assertElementPresentByName("newAffln.dflt");
1516 waitAndClickByName("newAffln.dflt");
1517 waitAndClickByName("methodToCall.addAffln.anchor");
1518 waitAndClickByName("methodToCall.toggleTab.tabContact");
1519 selectByName("newName.namePrefix", "Mr");
1520 waitAndTypeByName("newName.firstName", "First");
1521 waitAndTypeByName("newName.lastName", "Last");
1522 selectByName("newName.nameSuffix", "Mr");
1523 waitAndClickByName("newName.dflt");
1524 waitAndClickByName("methodToCall.addName.anchor");
1525 waitForPageToLoad();
1526 blanketApproveTest(docId);
1527 }
1528
1529 protected void testIdentityRoleBlanketApprove() throws Exception {
1530 selectFrameIframePortlet();
1531 waitAndCreateNew();
1532 waitAndClickByXpath(SEARCH_XPATH, "No search button to click.");
1533 waitAndClickReturnValue();
1534 String docId = waitForDocId();
1535 String dtsTwo = AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomCharsNot9Digits();
1536 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Role " + dtsTwo);
1537 assertBlanketApproveButtonsPresent();
1538 selectByXpath("//select[@id='document.roleNamespace']", LABEL_KUALI_KUALI_SYSTEMS);
1539 waitAndTypeByXpath("//input[@id='document.roleName']", "Validation Test Role " + dtsTwo,
1540 "No Role Name input to type in.");
1541 waitAndClickByName(
1542 "methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalId:member.memberId,principalName:member.memberName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchorAssignees");
1543 waitAndClickByXpath(SEARCH_XPATH, "No search button to click.");
1544 waitAndClickReturnValue();
1545 waitAndClickByName("methodToCall.addMember.anchorAssignees");
1546 waitForPageToLoad();
1547 blanketApproveTest(docId);
1548 }
1549
1550 protected void finishBlanketApprovalTest(String docId) throws InterruptedException {
1551 assertBlanketApproveButtonsPresent();
1552 blanketApproveCheck();
1553 if (!hasDocError("same primary key already exists")) {
1554 blanketApproveAssert(docId);
1555 }
1556 }
1557
1558 protected void testLookUp() throws Exception {
1559 waitForPageToLoad();
1560 selectFrameIframePortlet();
1561
1562
1563 waitAndClick(By.xpath(SEARCH_XPATH_3));
1564 waitAndClickByLinkText(EDIT_LINK_TEXT, "edit button not present does user " + user + " have permission?");
1565 waitForTextPresent("ubmit");
1566 assertTextPresent("ave");
1567 assertTextPresent("pprove");
1568 assertTextPresent("lose");
1569 assertTextPresent("ancel");
1570 }
1571
1572 protected void testReferenceCampusTypeBlanketApprove() throws Exception {
1573 selectFrameIframePortlet();
1574 String randomCode = searchForAvailableCode(1);
1575
1576 waitAndCreateNew();
1577 String docId = waitForDocId();
1578 String dtsTwo = AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomCharsNot9Digits();
1579 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Campus Type " + randomCode + " " + dtsTwo);
1580 waitAndTypeByXpath(DOC_CODE_XPATH, randomCode);
1581 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", "Indianapolis" + randomCode + dtsTwo);
1582
1583 finishBlanketApprovalTest(docId);
1584 }
1585
1586 protected void performParameterInquiry(String parameterField) throws Exception {
1587 waitAndTypeByName("name", parameterField);
1588 waitAndClickSearch();
1589 isElementPresentByLinkText(parameterField);
1590 waitAndClickByLinkText(parameterField);
1591 waitForPageToLoad();
1592 Thread.sleep(2000);
1593 switchToWindow("Kuali :: Inquiry");
1594 Thread.sleep(2000);
1595 }
1596
1597 protected List<String> testLookUpParameterType(String docId, String parameterType, String parameterCode) throws Exception {
1598 performParameterInquiry(parameterType);
1599 assertEquals(parameterCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim().toLowerCase());
1600 assertEquals(parameterType, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim().toLowerCase());
1601 waitAndClickCloseWindow();
1602 switchToWindow("null");
1603 List<String> params = new ArrayList<String>();
1604 params.add(docId);
1605 params.add(parameterType);
1606 params.add(parameterCode);
1607
1608 return params;
1609 }
1610
1611 protected List<String> testLookUpParameter(String docId, String parameterName) throws Exception {
1612 performParameterInquiry(parameterName);
1613 assertEquals(parameterName, getTextByXpath(
1614 "//div[@class='tab-container']/table//span[@id='name.div']").trim());
1615 assertEquals("Y", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']")
1616 .trim());
1617 waitAndClickCloseWindow();
1618 switchToWindow("null");
1619 List<String> params = new ArrayList<String>();
1620 params.add(docId);
1621 params.add(parameterName);
1622
1623 return params;
1624 }
1625
1626 protected void testTermLookupAssertions() throws Exception {
1627 testLookUp();
1628 assertTextPresent("Term Parameters");
1629 waitAndClick(By.xpath(CANCEL2_XPATH));
1630 passed();
1631 }
1632
1633 protected void testTermSpecificationLookupAssertions() throws Exception {
1634 testLookUp();
1635 assertTextPresent("Context");
1636 waitAndClickCancelByText();
1637 passed();
1638 }
1639
1640 protected List<String> testVerifyModifiedParameter(String docId, String parameterName) throws Exception {
1641 performParameterInquiry(parameterName);
1642 assertEquals(parameterName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
1643 assertEquals("N", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']").trim());
1644 waitAndClickCloseWindow();
1645 switchToWindow("null");
1646 List<String> params = new ArrayList<String>();
1647 params.add(docId);
1648 params.add(parameterName);
1649
1650 return params;
1651 }
1652
1653 protected List<String> testVerifyCopyParameterType(String docId, String parameterType, String parameterCode) throws Exception
1654 {
1655 performParameterInquiry(parameterType);
1656 assertEquals(parameterType, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim().toLowerCase());
1657 waitAndClickCloseWindow();
1658 switchToWindow("null");
1659 List<String> params = new ArrayList<String>();
1660 params.add(docId);
1661 params.add(parameterType);
1662 params.add(parameterCode);
1663
1664 return params;
1665 }
1666
1667 protected List<String> testCreateNewPermission(String docId, String permissionName) throws Exception {
1668 waitForPageToLoad();
1669 Thread.sleep(2000);
1670 docId = waitForDocId();
1671 waitAndClickSave();
1672 waitForElementPresentByXpath("//div[contains(.,'Document Description (Description) is a required field.')]/img[@alt='error']");
1673 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Adding Permission removeme");
1674 waitAndClickSubmit();
1675 waitForElementPresentByXpath("//div[@class='error']");
1676 assertElementPresentByXpath("//div[contains(.,'Template (Template) is a required field.')]/img[@alt='error']");
1677 assertElementPresentByXpath("//div[contains(.,'Permission Namespace (Permission Namespace) is a required field.')]/img[@alt='error']");
1678 assertElementPresentByXpath("//div[contains(.,'Permission Name (Permission Name) is a required field.')]/img[@alt='error']");
1679 selectOptionByName("document.newMaintainableObject.templateId", "36");
1680 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-SYS");
1681 permissionName = "removeme" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1682 waitAndTypeByName("document.newMaintainableObject.name", permissionName);
1683 waitAndTypeByName("document.newMaintainableObject.description", "namespaceCode=KR*");
1684 checkByName("document.newMaintainableObject.active");
1685 waitAndClickSave();
1686 waitForElementPresentByXpath(SAVE_SUCCESSFUL_XPATH);
1687 assertEquals(DOC_STATUS_SAVED, getTextByXpath(DOC_STATUS_XPATH));
1688 waitAndClickSubmit();
1689 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1690 assertEquals(DOC_STATUS_ENROUTE, getTextByXpath(DOC_STATUS_XPATH));
1691 List<String> params = new ArrayList<String>();
1692 params.add(docId);
1693 params.add(permissionName);
1694
1695 return params;
1696 }
1697
1698 protected List<String> testLookUpPermission(String docId, String permissionName) throws Exception {
1699 waitAndTypeByName("name", permissionName);
1700 waitAndClickSearch();
1701 isElementPresentByLinkText(permissionName);
1702 List<String> params = new ArrayList<String>();
1703 params.add(docId);
1704 params.add(permissionName);
1705
1706 return params;
1707 }
1708
1709 protected List<String> testEditPermission(String docId, String permissionName) throws Exception {
1710 waitAndClickEdit();
1711 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Editing Permission removeme");
1712 uncheckByName("document.newMaintainableObject.active");
1713 waitAndClickSubmit();
1714 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1715 List<String> params = new ArrayList<String>();
1716 params.add(docId);
1717 params.add(permissionName);
1718
1719 return params;
1720 }
1721
1722 protected List<String> testVerifyPermission(String docId, String permissionName) throws Exception {
1723 waitAndTypeByName("name", permissionName);
1724 waitAndClickByXpath("//input[@title='Active Indicator - No']");
1725 waitAndClickSearch();
1726 isElementPresentByLinkText(permissionName);
1727 List<String> params = new ArrayList<String>();
1728 params.add(docId);
1729 params.add(permissionName);
1730
1731 return params;
1732 }
1733
1734 protected List<String> testCreateNewPerson(String docId, String personName) throws Exception {
1735 waitForPageToLoad();
1736 docId = waitForDocId();
1737 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Adding Charlie Brown");
1738 waitAndTypeByName("document.documentHeader.explanation", "I want to add Charlie Brown to test KIM");
1739
1740
1741 personName = "cbrown" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
1742 waitAndTypeByName("document.principalName", personName);
1743 waitAndClickSave();
1744 waitForElementPresentByXpath(SAVE_SUCCESSFUL_XPATH);
1745 assertEquals(DOC_STATUS_SAVED, getTextByXpath(DOC_STATUS_XPATH));
1746 waitAndClickSubmit();
1747 waitForElementPresentByXpath("//div[contains(.,'At least one affiliation must be entered.')]/img[@alt='error']");
1748 assertElementPresentByXpath("//div[contains(.,'At least one name must be entered.')]/img[@alt='error']");
1749 selectOptionByName("newAffln.affiliationTypeCode", "STDNT");
1750 selectOptionByName("newAffln.campusCode", "BL");
1751 checkByName("newAffln.dflt");
1752 waitAndClickByName("methodToCall.addAffln.anchor");
1753 waitAndSelectByName("newName.nameCode", "PRM");
1754 selectOptionByName("newName.namePrefix", "Mr");
1755 waitAndTypeByName("newName.firstName", "Charlie");
1756 waitAndTypeByName("newName.lastName", "Brown");
1757 checkByName("newName.dflt");
1758 waitAndClickByName("methodToCall.addName.anchor");
1759 waitAndClickSubmit();
1760 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1761 assertEquals(DOC_STATUS_ENROUTE, getTextByXpath(DOC_STATUS_XPATH));
1762 List<String> params = new ArrayList<String>();
1763 params.add(docId);
1764 params.add(personName);
1765
1766 return params;
1767 }
1768
1769 protected List<String> testLookUpPerson(String docId, String personName) throws Exception {
1770 waitAndTypeByName("principalName", personName);
1771 waitAndClickSearch();
1772 isElementPresentByLinkText(personName);
1773 waitAndClickByName("methodToCall.clearValues");
1774 waitAndTypeByName("firstName", "Charlie");
1775 waitAndClickSearch();
1776 isElementPresentByLinkText(personName);
1777 waitAndClickByName("methodToCall.clearValues");
1778 waitAndTypeByName("lastName", "Brown");
1779 waitAndClickSearch();
1780 isElementPresentByLinkText(personName);
1781 waitAndClickByName("methodToCall.clearValues");
1782 waitAndTypeByName("campusCode", "BL");
1783 waitAndClickSearch();
1784 isElementPresentByLinkText(personName);
1785 List<String> params = new ArrayList<String>();
1786 params.add(docId);
1787 params.add(personName);
1788
1789 return params;
1790 }
1791
1792 protected List<String> testVerifyPerson(String docId, String personName) throws Exception {
1793 waitAndClickByLinkText(personName);
1794 waitForPageToLoad();
1795 Thread.sleep(5000);
1796 switchToWindow("Kuali :: Person");
1797 Thread.sleep(2000);
1798 assertEquals(personName, getTextByXpath("//div[@class='tab-container']/table//tr[2]/td[1]/div").trim());
1799 assertEquals("BL - BLOOMINGTON", getTextByXpath("//div[@class='tab-container']/table[3]//tr[2]/td[2]/div").trim());
1800 assertEquals("Student", getTextByXpath("//select/option[@selected]").trim());
1801 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Overview']");
1802 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Contact']");
1803 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Privacy Preferences']");
1804 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Membership']");
1805 waitAndClickByName("methodToCall.showAllTabs");
1806 waitForElementPresentByXpath("//table[@class='tab']//input[@title='close Overview']");
1807 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Contact']");
1808 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Privacy Preferences']");
1809 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Membership']");
1810 waitAndClickByName("methodToCall.hideAllTabs");
1811 waitForElementPresentByXpath("//table[@class='tab']//input[@title='open Overview']");
1812 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Contact']");
1813 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Privacy Preferences']");
1814 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Membership']");
1815 waitAndClickCloseWindow();
1816 switchToWindow("null");
1817 List<String> params = new ArrayList<String>();
1818 params.add(docId);
1819 params.add(personName);
1820
1821 return params;
1822 }
1823
1824 protected void testConfigurationTestView(String idPrefix) throws Exception {
1825 waitForElementPresentByXpath("//label[@id='" + idPrefix + "TextInputField_label']");
1826
1827
1828 String styleValue = waitAndGetAttributeByXpath("//label[@id='" + idPrefix + "TextInputField_label']",
1829 "style");
1830
1831
1832 assertTrue(idPrefix + "textInputField label does not contain expected style", styleValue.replace(" ", "").contains("color:red"));
1833
1834
1835 String refreshTextSelectLocator = "//select[@id='" + idPrefix + "RefreshTextField_control']";
1836 String[] options1 = getSelectOptionsByXpath(refreshTextSelectLocator);
1837 String dropDownSelectLocator = "//select[@id='" + idPrefix + "DropDown_control']";
1838 selectByXpath(dropDownSelectLocator, "Vegetables");
1839 Thread.sleep(3000);
1840
1841
1842 String[] options2 = getSelectOptionsByXpath(refreshTextSelectLocator);
1843
1844
1845 assertFalse("Field 1 selection did not change Field 2 options https://jira.kuali.org/browse/KULRICE-8163 Configuration Test View Conditional Options doesn't change Field 2 options based on Field 1 selection",
1846 options1[options1.length - 1].equalsIgnoreCase(options2[options2.length - 1]));
1847
1848
1849 selectByXpath(dropDownSelectLocator, "None");
1850 Thread.sleep(3000);
1851 assertEquals("true", waitAndGetAttributeByXpath(refreshTextSelectLocator, "disabled"));
1852 }
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879 protected void testCategoryLookUp() throws Exception {
1880 waitForPageToLoad();
1881 selectFrameIframePortlet();
1882 waitAndClickByXpath("//button[contains(.,'earch')]");
1883 Thread.sleep(3000);
1884 waitForPageToLoad();
1885 findElement(By.tagName("body")).getText().contains("Actions");
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896 }
1897
1898 protected void testCreateSampleEDocLite() throws Exception {
1899 waitForPageToLoad();
1900 Thread.sleep(3000);
1901 assertEquals("Kuali Portal Index", getTitle());
1902 selectFrameIframePortlet();
1903 waitAndClickByXpath("//input[@name='methodToCall.search' and @alt='search']");
1904 waitForPageToLoad();
1905
1906
1907 waitAndClickByLinkText("Create Document");
1908 waitForPageToLoad();
1909 Thread.sleep(3000);
1910 String docId = getTextByXpath("//table/tbody/tr[4]/td[@class='datacell1']");
1911 waitAndTypeByName("userName", "Viral Chauhan");
1912 waitAndTypeByName("rqstDate", "12/03/2020");
1913 checkByName("fundedBy");
1914 waitAndTypeByName("addText", "Note Added.");
1915 waitAndClickByXpath("//td[@class='datacell']/div/img");
1916 waitAndClickByXpath("//input[@value='submit']");
1917 assertEquals(Boolean.FALSE, (Boolean) isElementPresentByXpath("//input[@value='submit']"));
1918 assertEquals(Boolean.FALSE, (Boolean) isElementPresentByXpath("//input[@value='save']"));
1919 assertEquals(Boolean.FALSE, (Boolean) isElementPresentByXpath("//input[@value='cancel']"));
1920 waitForPageToLoad();
1921 selectTopFrame();
1922 waitAndClickDocSearch();
1923 waitForPageToLoad();
1924 selectFrameIframePortlet();
1925 waitAndClickByXpath("//input[@name='methodToCall.search' and @alt='search']");
1926 waitForElementPresent(By.linkText(docId));
1927 }
1928
1929 protected void testTermLookUp() throws Exception {
1930 testLookUp();
1931 assertTextPresent("Term Parameters");
1932 waitAndClickCancelByText();
1933 passed();
1934 }
1935
1936 protected void testCreateNewRRDTravelRequestDestRouting() throws Exception {
1937 selectFrameIframePortlet();
1938
1939
1940 waitAndClick("img[alt=\"create new\"]");
1941
1942
1943 waitAndClickByName(
1944 "methodToCall.performLookup.(!!org.kuali.rice.kew.rule.RuleBaseValues!!).(((id:parentRuleId))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
1945
1946
1947 waitAndClickByXpath("//td[@class='infoline']/input[@name='methodToCall.search']");
1948
1949
1950 waitAndClick("a[title=\"return valueRule Id=1046 \"]");
1951
1952
1953 waitAndClickByName("parentResponsibilityId");
1954
1955
1956 waitAndClickByName("methodToCall.createDelegateRule");
1957
1958 waitAndClickCancel();
1959 waitAndClickByName("methodToCall.processAnswer.button0");
1960 waitForPageToLoad();
1961 driver.switchTo().defaultContent();
1962 waitAndClickByXpath("(//input[@name='imageField'])[2]");
1963 passed();
1964 }
1965
1966 protected void testWorkFlowRouteRulesCreateNew() throws Exception {
1967 waitForPageToLoad();
1968 Thread.sleep(5000);
1969 assertEquals("Kuali Portal Index", getTitle());
1970 selectFrameIframePortlet();
1971 waitAndClickCreateNew();
1972 waitAndClickByName(CANCEL_NAME, "https://jira.kuali.org/browse/KULRICE-8161 Work Flow Route Rules cancel new yields 404 not found");
1973
1974
1975 waitAndClickByName("methodToCall.processAnswer.button0");
1976 passed();
1977 }
1978
1979
1980
1981
1982
1983 protected void testWorkFlowRouteRulesEditRouteRules() throws Exception {
1984 waitForPageToLoad();
1985 assertEquals("Kuali Portal Index", getTitle());
1986 selectFrameIframePortlet();
1987 waitAndClickSearch();
1988 waitAndClickEdit();
1989 waitForPageToLoad();
1990 selectFrameIframePortlet();
1991 waitAndClickCancel();
1992 waitAndClickByName("methodToCall.processAnswer.button0");
1993 passed();
1994 }
1995
1996
1997
1998
1999
2000 protected void createNewEnterDetails() throws InterruptedException {
2001
2002 fail("createNewEnterDetails must be implemented by test class");
2003 }
2004
2005
2006
2007
2008
2009 protected void createNewLookupDetails() throws InterruptedException {
2010
2011 fail("createNewLookupDetails must be implemented by test class");
2012 }
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050 protected void waitAndClickActionList() throws InterruptedException {
2051 WebDriverUtils.jGrowl(driver, "Click Action List", false, "Click Action List");
2052 selectTopFrame();
2053 waitAndClickByXpath("//img[@alt='action list']");
2054 }
2055
2056 protected void testLookUpComponent(String docId, String componentName, String componentCode) throws Exception {
2057 selectFrameIframePortlet();
2058
2059 waitAndTypeByName("name", componentName);
2060 waitAndClickSearch();
2061 isElementPresentByLinkText(componentName);
2062 waitAndClickByLinkText(componentName);
2063 waitForPageToLoad();
2064 Thread.sleep(2000);
2065 switchToWindow("Kuali :: Inquiry");
2066 Thread.sleep(2000);
2067 assertEquals(componentName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
2068 assertEquals(componentCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim());
2069 waitAndClickCloseWindow();
2070 switchToWindow("null");
2071 }
2072
2073 protected void testEditComponent(String docId, String componentName, String componentCode) throws Exception {
2074 selectFrameIframePortlet();
2075 waitAndClickEdit();
2076 waitForPageToLoad();
2077 docId = waitForDocId();
2078 waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Component");
2079 clearTextByName("document.newMaintainableObject.name");
2080 waitAndTypeByName("document.newMaintainableObject.name", componentName);
2081 waitAndClickSave();
2082 waitAndClickSubmit();
2083 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
2084 assertDocSearch(docId, DOC_STATUS_FINAL);
2085 selectTopFrame();
2086 }
2087
2088 protected void testCopyComponent(String docId, String componentName, String componentCode) throws Exception {
2089 selectFrameIframePortlet();
2090 waitAndClickCopy();
2091 waitForPageToLoad();
2092 docId = waitForDocId();
2093 waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Component");
2094 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-IDM");
2095 waitAndTypeByName("document.newMaintainableObject.code", componentCode);
2096 clearTextByName("document.newMaintainableObject.name");
2097 waitAndTypeByName("document.newMaintainableObject.name", componentName);
2098 waitAndClickSave();
2099 waitAndClickSubmit();
2100 waitForPageToLoad();
2101 checkForDocError();
2102 waitForElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
2103 assertDocSearch(docId, DOC_STATUS_FINAL);
2104 selectTopFrame();
2105 }
2106
2107 protected void testVerifyCopyComponent(String docId, String componentName, String componentCode) throws Exception {
2108 selectFrameIframePortlet();
2109 waitAndTypeByName("name", componentName);
2110 waitAndClickSearch();
2111 isElementPresentByLinkText(componentName);
2112 waitAndClickByLinkText(componentName);
2113 waitForPageToLoad();
2114 Thread.sleep(2000);
2115 switchToWindow("Kuali :: Inquiry");
2116 Thread.sleep(2000);
2117 assertEquals(componentName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
2118 assertEquals(componentCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim());
2119 waitAndClickCloseWindow();
2120 switchToWindow("null");
2121 }
2122
2123 protected void testMultiValueSelectAllPages() throws InterruptedException {
2124 waitAndClickButtonByText(SEARCH);
2125 assertButtonDisabledByText(RETURN_SELECTED_BUTTON_TEXT);
2126
2127
2128 waitAndClickDropDown("select all items");
2129 if (!areAllMultiValueSelectsChecked()) {
2130 JiraAwareFailureUtils.fail("select all items failure", this);
2131 }
2132 assertButtonEnabledByText(RETURN_SELECTED_BUTTON_TEXT);
2133
2134 boolean anotherPageOfResults = false;
2135 if (Integer.parseInt(multiValueResultCount()) > 10) {
2136 anotherPageOfResults = true;
2137 }
2138
2139
2140 if (!anotherPageOfResults) {
2141 JiraAwareFailureUtils.fail("select all items server side paging failure not enough results for next page",
2142 this);
2143 }
2144 waitAndClickByLinkText("Next");
2145
2146 if (!areAllMultiValueSelectsChecked()) {
2147 JiraAwareFailureUtils.fail("select all items server side paging failure", this);
2148 }
2149 assertButtonEnabledByText(RETURN_SELECTED_BUTTON_TEXT);
2150
2151
2152 waitAndClickDropDown("deselect all items");
2153 if (!areNoMultiValueSelectsChecked()) {
2154 JiraAwareFailureUtils.fail("deselect all items failure", this);
2155 }
2156 assertButtonDisabledByText(RETURN_SELECTED_BUTTON_TEXT);
2157
2158 waitAndClickByLinkText("Previous");
2159 if (!areNoMultiValueSelectsChecked()) {
2160 JiraAwareFailureUtils.fail("deselect all items failure", this);
2161 }
2162 assertButtonDisabledByText(RETURN_SELECTED_BUTTON_TEXT);
2163 }
2164
2165 protected void acceptAlert() {
2166 if (!WebDriverUtils.isAlertPresent(driver)) {
2167 fail("Alert expected but not present for " + this.getClass().getName());
2168 }
2169 WebDriverUtils.alertAccept(driver);
2170 }
2171
2172 protected void testMultiValueSelectAllThisPage() throws InterruptedException {
2173 waitAndClickButtonByText(SEARCH);
2174 assertButtonDisabledByText(RETURN_SELECTED_BUTTON_TEXT);
2175
2176
2177 assertMultiValueSelectAllThisPage();
2178
2179 boolean anotherPageOfResults = false;
2180 if (Integer.parseInt(multiValueResultCount()) > 5) {
2181 anotherPageOfResults = true;
2182 }
2183
2184
2185 waitAndClickByLinkText("Next");
2186 if (!areNoMultiValueSelectsChecked()) {
2187 if (anotherPageOfResults) {
2188 JiraAwareFailureUtils.fail("select all items on this page failure", this);
2189 } else {
2190 JiraAwareFailureUtils.fail("select all items on this page failure not enough results for next page",
2191 this);
2192 }
2193 }
2194 assertButtonEnabledByText(RETURN_SELECTED_BUTTON_TEXT);
2195
2196
2197 waitAndClickByLinkText("Previous");
2198 if (!areAllMultiValueSelectsChecked()) {
2199 JiraAwareFailureUtils.fail("select all items on previous page failure", this);
2200 }
2201
2202
2203 assertMultiValueDeselectAllThisPage();
2204 }
2205
2206
2207
2208
2209 protected void testExternalHelp2() throws Exception {
2210
2211 assertPopUpWindowUrl(By.cssSelector("input[title=\"Help for External Help\"]"), "HelpWindow",
2212 "http://www.kuali.org/?section");
2213
2214
2215 assertPopUpWindowUrl(By.xpath("//div[@id='field-label-left-external-help']/fieldset/input[@title='Help for Field Label']"), "HelpWindow",
2216 "http://www.kuali.org/?label_left");
2217
2218
2219 assertPopUpWindowUrl(By.xpath("//div[@id='field-label-right-external-help']/fieldset/input[@title='Help for Field Label']"), "HelpWindow",
2220 "http://www.kuali.org/?label_right");
2221
2222
2223 assertPopUpWindowUrl(By.xpath("//div[@id='field-label-top-external-help']/fieldset/input[@title='Help for Field Label']"), "HelpWindow",
2224 "http://www.kuali.org/?system_parm");
2225
2226
2227 assertPopUpWindowUrl(By.id("standalone-external-help"), "HelpWindow", "http://www.kuali.org/?widget_only");
2228 }
2229
2230
2231
2232
2233
2234 protected void testDisplayOnlyExternalHelp2() throws Exception {
2235
2236 assertPopUpWindowUrl(By.cssSelector("input[title=\"Help for Display only fields\"]"), "HelpWindow", "http://www.kuali.org/?sub_section");
2237
2238
2239 assertPopUpWindowUrl(By.xpath(
2240 "//div[@id='display-field-external-help']/fieldset/input[@title='Help for Field Label']"), "HelpWindow",
2241 "http://www.kuali.org/?display_field");
2242 }
2243
2244
2245
2246
2247
2248 protected void testMissingExternalHelp2() throws Exception {
2249
2250 assertFalse(isElementPresent(By.cssSelector("input[title=\"Help for Missing External Help\"]")));
2251
2252
2253 assertFalse(isElementPresentByXpath("//div[@id='external-help-externalHelpUrl-empty']/*[@class='uif-helpImage']"));
2254
2255
2256 assertFalse(isElementPresentByXpath("//div[@id='external-help-helpdefinition-empty']/*[@class='uif-helpImage']"));
2257
2258
2259 assertFalse(isElementPresentByXpath("//div[@id='external-help-system-parm-missing']/*[@class='uif-helpImage']"));
2260
2261
2262 assertFalse(isElementPresentByXpath("//div[@id='standalone-external-help-missing']"));
2263 }
2264
2265 private String searchForAvailableCode(int codeLength) throws InterruptedException {
2266 String randomCode = RandomStringUtils.randomAlphabetic(codeLength).toUpperCase();
2267 waitAndTypeByName("code", randomCode);
2268 waitAndClickSearch();
2269 int attemptCount = 1;
2270 waitForTextPresent("You have entered the primary key for this table");
2271 while (!isTextPresent("No values match this search.") && attemptCount < 25) {
2272 randomCode = Character.toString((char) (randomCode.toCharArray()[0] + attemptCount++));
2273 clearTextByName("code");
2274 waitAndTypeByName("code", randomCode);
2275 waitAndClickSearch();
2276 waitForTextPresent("You have entered the primary key for this table");
2277 }
2278 return randomCode;
2279 }
2280
2281 protected void testSearchEditCancel() throws InterruptedException {
2282 selectFrameIframePortlet();
2283 waitAndClickSearch2();
2284 waitAndClickEdit();
2285 testCancelConfirmation();
2286 }
2287
2288 protected void testServerErrorsIT() throws Exception {
2289 waitAndClickByXpath("//button[contains(.,'Get Error Messages')]");
2290 waitForElementPresent("div[data-messages_for=\"Demo-ValidationLayout-SectionsPage\"] .uif-errorMessageItem-field");
2291 waitIsVisibleByXpath("//header[@data-header_for='Demo-ValidationLayout-Section1']");
2292 assertElementPresentByXpath("//*[@data-messageitemfor='Demo-ValidationLayout-Section1' and @class='uif-errorMessageItem']");
2293 assertElementPresent("div[data-role=\"InputField\"] img[alt=\"Error\"]");
2294 assertElementPresentByXpath("//a[contains(.,'Section 1 Title')]");
2295 fireMouseOverEventByXpath("//a[contains(.,'Field 1')]");
2296 assertElementPresent(".uif-errorMessageItem-field");
2297 waitAndClickByXpath("//a[contains(.,'Field 1')]");
2298 waitIsVisible(".popover");
2299 waitIsVisible(".popover-content > .uif-serverMessageItems");
2300 waitIsVisible(".popover-content > .uif-serverMessageItems .uif-errorMessageItem-field");
2301 waitAndTypeByName("field1", "");
2302 fireEvent("field1", "blur");
2303 fireEvent("field1", "focus");
2304 waitIsVisible(".popover");
2305 waitIsVisible(".popover-content > .uif-serverMessageItems .uif-errorMessageItem-field");
2306 waitIsVisible(".popover-content > .uif-clientMessageItems");
2307 waitIsVisible(".popover-content > .uif-clientMessageItems .uif-errorMessageItem-field");
2308 waitAndTypeByName("field1", "t");
2309
2310 for (int second = 0;; second++) {
2311 if (second >= waitSeconds) {
2312 jiraAwareFail(TIMEOUT_MESSAGE);
2313 }
2314 try {
2315 if (!isElementPresent(".popover-content > .uif-clientMessageItems")) {
2316 break;
2317 }
2318 } catch (Exception e) {}
2319 Thread.sleep(1000);
2320 }
2321
2322 waitIsVisible(".popover-content > .uif-serverMessageItems .uif-errorMessageItem-field");
2323 assertFalse(isElementPresent(".popover-content > .uif-clientMessageItems"));
2324 }
2325
2326 protected void testServerInfoIT() throws Exception {
2327 waitAndClickByXpath("//button[contains(.,'Get Info Messages')]");
2328 waitIsVisibleByXpath("//div[@data-messages_for='Demo-ValidationLayout-SectionsPage']");
2329 waitForProgressLoading();
2330 assertTrue(isVisibleByXpath("//div[@data-messages_for='Demo-ValidationLayout-SectionsPage']"));
2331 assertTrue(isElementPresent(
2332 "div[data-messages_for=\"Demo-ValidationLayout-SectionsPage\"] .uif-infoMessageItem"));
2333 assertTrue(isVisible("div[data-messages_for=\"Demo-ValidationLayout-Section1\"]"));
2334 assertTrue(isElementPresent("div[data-messages_for=\"Demo-ValidationLayout-Section1\"] .uif-infoMessageItem"));
2335 assertTrue(isElementPresentByXpath("//div[@data-role='InputField']//img[@alt='Information']"));
2336 fireMouseOverEventByXpath("//a[contains(.,'Field 1')]");
2337 assertTrue(isElementPresent(".uif-infoHighlight"));
2338 waitAndClickByXpath("//a[contains(.,'Field 1')]");
2339 waitForElementPresentByXpath("//div[@class='popover top in uif-tooltip-info-ss']");
2340 waitAndTypeByName("field1", "");
2341 fireEvent("field1", "blur");
2342 fireEvent("field1", "focus");
2343 waitForElementPresentByXpath("//div[@class='popover uif-tooltip-info-ss top in uif-tooltip-error-ss']");
2344 waitAndTypeByName("field1", "b");
2345 fireEvent("field1", "blur");
2346 fireEvent("field1", "focus");
2347 waitForElementPresentByXpath("//div[@class='popover uif-tooltip-error-ss top in uif-tooltip-info-ss']");
2348 fireEvent("field1", "focus");
2349 clearTextByName("field1");
2350 fireEvent("field1", "blur");
2351 waitForElementPresentByXpath("//div[@class='popover uif-tooltip-info-ss top in uif-tooltip-error-ss']");
2352 }
2353
2354 protected void testServerWarningsIT() throws Exception {
2355 waitAndClickByXpath("//button[contains(.,'Get Warning Messages')]");
2356 waitForElementPresentByXpath("//div[@id='Demo-ValidationLayout-SectionsPage_messages']");
2357 waitForElementPresentByXpath("//div[@id='Demo-ValidationLayout-Section1_messages']");
2358 waitForElementPresentByXpath("//a[contains(.,'Field 1')]");
2359 fireMouseOverEventByXpath("//a[contains(.,'Field 1')]");
2360 waitForElementPresentByXpath(
2361 "//div[@class='uif-inputField uif-boxLayoutHorizontalItem uif-hasWarning uif-warningHighlight']");
2362 waitAndClickByXpath("//a[contains(.,'Field 1')]");
2363 waitForElementPresentByXpath("//div[@class='popover uif-tooltip-warning-ss top in uif-tooltip-error-ss']");
2364 waitAndTypeByName("field1", "");
2365 fireEvent("field1", "blur");
2366 fireMouseOverEventByName("field1");
2367 waitForElementPresentByXpath("//div[@class='popover uif-tooltip-warning-ss top in uif-tooltip-error-ss']");
2368 waitAndTypeByName("field1", "b");
2369 fireEvent("field1", "blur");
2370 fireMouseOverEventByName("field1");
2371 waitForElementPresentByXpath("//div[@class='popover uif-tooltip-warning-ss top in uif-tooltip-error-ss']");
2372 clearTextByName("field1");
2373 fireEvent("field1", "blur");
2374 fireMouseOverEventByName("field1");
2375 waitForElementPresentByXpath("//div[@class='popover uif-tooltip-warning-ss top in uif-tooltip-error-ss']");
2376 passed();
2377 }
2378
2379
2380
2381
2382 protected void testViewHelp2() throws Exception {
2383
2384 if (isElementPresentByXpath("//td[@class='jquerybubblepopup-innerHtml']")) {
2385 assertFalse(findElement(By.cssSelector("td.jquerybubblepopup-innerHtml")).isDisplayed());
2386 }
2387
2388
2389 fireMouseOverEventByXpath("//h1/span[@class='uif-headerText-span']");
2390 Thread.sleep(2000);
2391 assertTrue(isVisibleByXpath("//td[contains(text(),'View help')]"));
2392 assertPopUpWindowUrl(By.cssSelector("input[title=\"Help for Configuration Test View\"]"), "HelpWindow", "http://www.kuali.org/");
2393 }
2394
2395 protected void testVerifyAddDeleteFiscalOfficerLegacy() throws Exception {
2396 selectFrameIframePortlet();
2397 waitAndTypeByName("document.documentHeader.documentDescription", AutomatedFunctionalTestUtils
2398 .createUniqueDtsPlusTwoRandomChars());
2399 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.fiscalOfficer.accounts'].number","1234567890");
2400 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.fiscalOfficer.accounts'].foId", "2");
2401 waitAndClickByXpath("//button[@data-loadingmessage='Adding Line...']");
2402 waitForElementPresentByName("document.newMaintainableObject.dataObject.fiscalOfficer.accounts[0].number");
2403 assertEquals("1234567890", waitAndGetAttributeByName(
2404 "document.newMaintainableObject.dataObject.fiscalOfficer.accounts[0].number", "value"));
2405 assertEquals("2", waitAndGetAttributeByName(
2406 "document.newMaintainableObject.dataObject.fiscalOfficer.accounts[0].foId", "value"));
2407 waitAndClickByXpath("//button[@data-loadingmessage='Deleting Line...']");
2408 Thread.sleep(3000);
2409 assertEquals(Boolean.FALSE, (Boolean) isElementPresentByName(
2410 "document.newMaintainableObject.dataObject.fiscalOfficer.accounts[0].number"));
2411 passed();
2412 }
2413
2414 protected void testVerifyAddDeleteNoteLegacy() throws Exception {
2415 selectFrameIframePortlet();
2416 waitAndClick(
2417 "div.tableborders.wrap.uif-boxLayoutVerticalItem.clearfix span.uif-headerText-span > img.uif-disclosure-image");
2418 waitForElementPresent("button[title='Add a Note'].uif-action.uif-primaryActionButton.uif-smallActionButton");
2419 waitAndClickByName("newCollectionLines['document.notes'].noteText");
2420 waitAndTypeByName("newCollectionLines['document.notes'].noteText", "Test note");
2421 waitAndClick("button[title='Add a Note'].uif-action.uif-primaryActionButton.uif-smallActionButton");
2422
2423 assertEquals("Test note", getTextByXpath("//pre"));
2424 waitAndClick("button[title='Delete a Note'].uif-action.uif-primaryActionButton.uif-smallActionButton");
2425 assertEquals(Boolean.FALSE, (Boolean) isElementPresentByName("document.notes[0].noteText"));
2426 passed();
2427 }
2428
2429 protected void testVerifyAdHocRecipientsLegacy() throws Exception {
2430 selectFrameIframePortlet();
2431 waitAndClickByLinkText("Fiscal Officer Accounts");
2432 assertElementPresentByXpath(
2433 "//select[@name=\"newCollectionLines['document.adHocRoutePersons'].actionRequested\"]");
2434 assertElementPresentByXpath(
2435 "//input[@name=\"newCollectionLines['document.adHocRoutePersons'].name\" and @type=\"text\"]");
2436 assertElementPresentByXpath(
2437 "//select[@name=\"newCollectionLines['document.adHocRouteWorkgroups'].actionRequested\"]");
2438 assertElementPresentByXpath(
2439 "//input[@name=\"newCollectionLines['document.adHocRouteWorkgroups'].recipientNamespaceCode\" and @type='text']");
2440 assertElementPresentByXpath(
2441 "//input[@name=\"newCollectionLines['document.adHocRouteWorkgroups'].recipientName\" and @type='text']");
2442 passed();
2443 }
2444
2445 protected void testVerifyButtonsLegacy() throws Exception {
2446 selectFrameIframePortlet();
2447 assertElementPresentByXpath("//button[contains(.,'ubmit')]");
2448 assertElementPresentByXpath("//button[contains(.,'ave')]");
2449 assertElementPresentByXpath("//button[contains(.,'lanket approve')]");
2450 assertElementPresentByXpath("//button[contains(.,'lose')]");
2451 assertElementPresentByXpath("//a[contains(.,'ancel')]");
2452 passed();
2453 }
2454
2455 protected void testVerifyConstraintText() throws Exception {
2456 selectFrameIframePortlet();
2457 assertEquals("* indicates required field", getText(
2458 "div.uif-boxLayout.uif-horizontalBoxLayout.clearfix > span.uif-message.uif-requiredInstructionsMessage.uif-boxLayoutHorizontalItem"));
2459 assertEquals("Must not be more than 10 characters", getText(
2460 "div.uif-group.uif-gridGroup.uif-gridSection.uif-disclosure.uif-boxLayoutVerticalItem.clearfix div[data-label='Travel Account Number'].uif-field.uif-inputField span.uif-message.uif-constraintMessage"));
2461 assertEquals("Must not be more than 10 characters", getText(
2462 "div.uif-group.uif-gridGroup.uif-gridSection.uif-disclosure.uif-boxLayoutVerticalItem.clearfix div[data-label='Travel Sub Account Number'].uif-field.uif-inputField span.uif-message.uif-constraintMessage"));
2463 assertEquals("Must not be more than 10 characters", getText(
2464 "div.uif-group.uif-gridGroup.uif-collectionItem.uif-gridCollectionItem.uif-collectionAddItem div[data-label='Travel Account Number'].uif-field.uif-inputField span.uif-message.uif-constraintMessage"));
2465 passed();
2466 }
2467
2468 protected void testVerifyEditedComponent(String docId, String componentName, String componentCode) throws Exception {
2469 selectFrameIframePortlet();
2470 waitAndTypeByName("name", componentName);
2471 waitAndClickSearch();
2472 isElementPresentByLinkText(componentName);
2473 waitAndClickByLinkText(componentName);
2474 waitForPageToLoad();
2475 Thread.sleep(2000);
2476 switchToWindow("Kuali :: Inquiry");
2477 Thread.sleep(2000);
2478 assertEquals(componentName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
2479 assertEquals(componentCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim());
2480 waitAndClickCloseWindow();
2481 switchToWindow("null");
2482 List<String> parameterList=new ArrayList<String>();
2483 }
2484
2485 protected void testVerifyDisclosures() throws Exception {
2486 selectFrameIframePortlet();
2487 assertElementPresentByXpath("//span[contains(text(),'Document Overview')]");
2488 assertElementPresentByXpath("//span[contains(text(),'Document Overview')]");
2489 assertElementPresentByXpath("//span[contains(text(),'Account Information')]");
2490 assertElementPresentByXpath("//span[contains(text(),'Fiscal Officer Accounts')]");
2491 assertElementPresentByXpath("//span[contains(text(),'Notes and Attachments')]");
2492 assertElementPresentByXpath("//span[contains(text(),'Ad Hoc Recipients')]");
2493 assertElementPresentByXpath("//span[contains(text(),'Route Log')]");
2494 colapseExpandByXpath("//span[contains(text(),'Document Overview')]//img",
2495 "//label[contains(text(),'Organization Document Number')]");
2496 colapseExpandByXpath("//span[contains(text(),'Account Information')]//img",
2497 "//label[contains(text(),'Travel Account Type Code')]");
2498 colapseExpandByXpath("//span[contains(text(),'Fiscal Officer Accounts')]//img",
2499 "//a[contains(text(),'Lookup/Add Multiple Lines')]");
2500 expandColapseByXpath("//span[contains(text(),'Notes and Attachments')]//img",
2501 "//label[contains(text(),'Note Text')]");
2502 expandColapseByXpath("//span[contains(text(),'Ad Hoc Recipients')]",
2503 "//span[contains(text(),'Ad Hoc Group Requests')]");
2504
2505
2506 waitAndClickByXpath("//span[contains(text(),'Route Log')]//img");
2507 selectFrame("routeLogIFrame");
2508 waitIsVisibleByXpath("//img[@alt='refresh']");
2509
2510
2511 selectTopFrame();
2512 selectFrameIframePortlet();
2513 waitAndClickByXpath("//span[contains(text(),'Route Log')]//img");
2514 selectFrame("routeLogIFrame");
2515 waitNotVisibleByXpath("//img[@alt='refresh']");
2516 passed();
2517 }
2518
2519 protected void testVerifyDocumentOverviewLegacy() throws Exception {
2520 selectFrameIframePortlet();
2521 assertTextPresent("Document Overview");
2522 assertElementPresentByXpath("//input[@name='document.documentHeader.documentDescription']");
2523 assertElementPresentByXpath("//input[@name='document.documentHeader.organizationDocumentNumber']");
2524 assertElementPresentByXpath("//textarea[@name='document.documentHeader.explanation']");
2525 passed();
2526 }
2527
2528 protected void testVerifyExpandCollapse() throws Exception {
2529 selectFrameIframePortlet();
2530 assertElementPresentByXpath("//button[contains(@class, 'uif-expandDisclosuresButton')]");
2531 assertElementPresentByXpath("//button[contains(@class, 'uif-collapseDisclosuresButton')]");
2532 passed();
2533 }
2534
2535 protected void testVerifyFieldsLegacy() throws Exception {
2536 selectFrameIframePortlet();
2537 assertElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.number' and @type='text' and @size=10 and @maxlength=10]");
2538 assertElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.extension.accountTypeCode' and @type='text' and @size=2 and @maxlength=3]");
2539 assertElementPresentByXpath(
2540 "//input[@name='document.newMaintainableObject.dataObject.subAccount' and @type='text' and @size=10 and @maxlength=10]");
2541 assertElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.subsidizedPercent' and @type='text' and @size=6 and @maxlength=20]");
2542 assertElementPresentByXpath(
2543 "//input[@name='document.newMaintainableObject.dataObject.foId' and @type='text' and @size=5 and @maxlength=10]");
2544 assertElementPresentByXpath(
2545 "//input[@name=\"newCollectionLines['document.newMaintainableObject.dataObject.fiscalOfficer.accounts'].number\" and @type='text' and @size=10 and @maxlength=10]");
2546 assertElementPresentByXpath(
2547 "//input[@name=\"newCollectionLines['document.newMaintainableObject.dataObject.fiscalOfficer.accounts'].foId\" and @type='text' and @size=5 and @maxlength=10]");
2548 passed();
2549 }
2550
2551 protected void testVerifyHeaderFieldsLegacy() throws Exception {
2552 selectFrameIframePortlet();
2553 assertElementPresentByXpath("//div[contains(@class, 'uif-documentNumber')]");
2554 assertElementPresentByXpath("//div[contains(@class, 'uif-documentInitiatorNetworkId')]");
2555 assertElementPresentByXpath("//div[contains(@class, 'uif-documentStatus')]");
2556 assertElementPresentByXpath("//div[contains(@class, 'uif-documentCreateDate')]");
2557 passed();
2558 }
2559
2560 protected void testVerifyLookupAddMultipleLinesLegacy() throws Exception {
2561 selectFrameIframePortlet();
2562 assertElementPresentByXpath("//a[contains(text(),'Lookup/Add Multiple Lines')]");
2563 passed();
2564 }
2565
2566 protected void testVerifyNotesAndAttachments() throws Exception {
2567 selectFrameIframePortlet();
2568 waitAndClickByXpath("//span[contains(text(),'Notes and Attachments')]");
2569 waitForElementPresentByXpath("//button[@title='Add a Note']");
2570 assertElementPresentByXpath("//span[contains(text(),'Notes and Attachments')]");
2571 assertElementPresentByXpath("//textarea[@name=\"newCollectionLines['document.notes'].noteText\"]");
2572 assertElementPresentByXpath("//input[@name='attachmentFile']");
2573
2574
2575 passed();
2576 }
2577
2578 protected void testVerifyQuickfinderIconsLegacy() throws Exception {
2579 selectFrameIframePortlet();
2580 assertTextPresent("Document Overview");
2581 assertElementPresentByXpath("//*[@id='quickfinder1']");
2582 assertElementPresentByXpath("//*[@id='quickfinder2']");
2583 assertElementPresentByXpath("//*[@id='quickfinder3']");
2584 assertElementPresentByXpath("//*[@id='quickfinder4_add']");
2585
2586
2587 passed();
2588 }
2589
2590 protected void testVerifyRouteLog() throws Exception {
2591 selectFrameIframePortlet();
2592 waitAndClickByLinkText("Route Log");
2593 waitForElementPresent("//iframe[contains(@src,'RouteLog.do')]");
2594 passed();
2595 }
2596
2597 protected void testVerifySave() throws Exception {
2598 selectFrameIframePortlet();
2599 waitAndTypeByName("document.documentHeader.documentDescription",
2600 "Test Document " + AutomatedFunctionalTestUtils.DTS);
2601 waitAndClickByName("document.newMaintainableObject.dataObject.number");
2602 waitAndTypeByName("document.newMaintainableObject.dataObject.number", "1234567890");
2603 waitAndTypeByName("document.newMaintainableObject.dataObject.extension.accountTypeCode", "EAT");
2604 waitAndTypeByName("document.newMaintainableObject.dataObject.subAccount", "a1");
2605 waitAndClick(
2606 "button[data-loadingmessage='Saving...'].uif-action.uif-primaryActionButton.uif-boxLayoutHorizontalItem");
2607 Thread.sleep(2000);
2608
2609
2610 passed();
2611 }
2612
2613 protected void testVerifySubsidizedPercentWatermarkLegacy() throws Exception {
2614 selectFrameIframePortlet();
2615
2616
2617
2618 assertElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.subsidizedPercent']");
2619 passed();
2620 }
2621
2622 protected void typeEnter() {
2623 jGrowl("Press Enter");
2624 driver.switchTo().activeElement().sendKeys(Keys.ENTER);
2625 }
2626
2627 protected void typeTab() {
2628 jGrowl("Press Tab");
2629 driver.switchTo().activeElement().sendKeys(Keys.TAB);
2630 }
2631
2632 protected void uncheck(By by) throws InterruptedException {
2633 WebElement element = findElement(by);
2634 if (element.isSelected()) {
2635 element.click();
2636 }
2637 }
2638
2639 protected void uncheckByName(String name) throws InterruptedException {
2640 uncheck(By.name(name));
2641 }
2642
2643 protected void uncheckByXpath(String locator) throws InterruptedException {
2644 uncheck(By.xpath(locator));
2645 }
2646
2647 protected void verifyRichMessagesValidationBasicFunctionality() throws Exception {
2648 assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field1']"));
2649 assertTrue(isElementPresentByXpath("//a[contains(text(), 'Kuali')]"));
2650 assertTrue(isElementPresentByXpath("//input[@type='checkbox' and @name='field2']"));
2651 Thread.sleep(3000);
2652 }
2653
2654 protected void verifyRichMessagesValidationAdvancedFunctionality() throws Exception {
2655
2656 assertTrue(isElementPresentByXpath("//span[@style='color: green;']"));
2657 assertTrue(isElementPresentByXpath("//span[@style='color: blue;']"));
2658
2659
2660 assertTrue(isElementPresentByXpath("//span[@class='uif-text-underline uif-text-larger']"));
2661
2662
2663 assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field3']"));
2664 assertTrue(isElementPresentByXpath("//select[@name='field4']"));
2665 assertTrue(isElementPresentByXpath("//button[contains(text(), 'Action Button')]"));
2666
2667
2668 assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/span[contains(., 'Color')]"));
2669 assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/i/b[contains(., 'Html')]"));
2670 assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/img[@class='uif-image inlineBlock']"));
2671 Thread.sleep(3000);
2672 }
2673
2674 protected void verifyRichMessagesValidationLettersNumbersValidation() throws Exception {
2675
2676 assertTrue(isElementPresentByXpath("//div[@data-parent='Demo-AdvancedMessagesSection']/div/input[@type='text' and @name='field5']"));
2677 waitAndTypeByXpath(
2678 "//div[@data-parent='Demo-AdvancedMessagesSection']/div/input[@type='text' and @name='field5']", "abc");
2679 assertFalse(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
2680 clearTextByXpath(
2681 "//div[@data-parent='Demo-AdvancedMessagesSection']/div/input[@type='text' and @name='field5']");
2682 waitAndTypeByXpath("//div[@data-parent='Demo-AdvancedMessagesSection']/div/input[@type='text' and @name='field5']","abc12");
2683 waitAndTypeByXpath("//input[@name= 'field6']", "");
2684 waitForElementPresentByXpath("//div[@class='uif-inputField inlineBlock uif-hasError']");
2685 Thread.sleep(3000);
2686 clearTextByXpath("//div[@data-parent='Demo-AdvancedMessagesSection']/div/input[@type='text' and @name='field5']");
2687 waitAndTypeByXpath("//div[@data-parent='Demo-AdvancedMessagesSection']/div/input[@type='text' and @name='field5']","abc");
2688 waitAndTypeByXpath("//input[@name= 'field6']", "");
2689
2690
2691 waitAndTypeByXpath("//input[@name= 'field6']", "123");
2692 assertFalse(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
2693 clearTextByXpath("//input[@name='field6']");
2694 waitAndTypeByXpath("//input[@name='field6']", "123ab");
2695 fireEvent("field6", "blur");
2696 waitForElementPresentByXpath("//div[@class='uif-inputField inlineBlock uif-hasError']");
2697 }
2698
2699 protected void verifyRichMessagesValidationRadioAndCheckBoxGroupFunctionality() throws Exception {
2700
2701 assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='1']"));
2702 assertTrue(isElementPresentByXpath(
2703 "//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='2']"));
2704 assertTrue(isElementPresentByXpath(
2705 "//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='3']"));
2706 assertTrue(isElementPresentByXpath(
2707 "//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='4']"));
2708
2709
2710 assertTrue(isElementPresentByXpath(
2711 "//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='1']"));
2712 assertTrue(isElementPresentByXpath(
2713 "//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='2']"));
2714 assertTrue(isElementPresentByXpath(
2715 "//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='3']"));
2716 assertTrue(isElementPresentByXpath(
2717 "//fieldset[@class='uif-verticalCheckboxesFieldset']/span/label/div/select[@name='field4']"));
2718
2719
2720 assertTrue(isElementPresentByXpath("//input[@type='checkbox' and @name='bField1']"));
2721 assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field103']"));
2722 }
2723
2724 protected void verifyRichMessagesValidationLinkDeclarationsFunctionality() throws Exception {
2725
2726 waitAndClickByLinkText("Kuali Site");
2727 Thread.sleep(9000);
2728 switchToWindow("Open Source Software | www.kuali.org");
2729 switchToWindow(RICH_MESSAGES_WINDOW_TITLE);
2730
2731
2732 waitAndClickByXpath("//p[contains(., 'Testing methodToCall action')]/a");
2733 Thread.sleep(3000);
2734 assertTrue(isElementPresentByXpath(
2735 "//div[@class='alert alert-danger']"));
2736
2737
2738 waitAndClickByXpath("//p[contains(., 'Testing methodToCall action (no client validation check)')]/a");
2739 assertTrue(isElementPresentByXpath("//div[@id='Demo-BasicMessagesSection_messages' and @class='alert alert-danger']"));
2740 assertTrue(isElementPresentByXpath("//div[@id='Demo-AdvancedMessagesSection_messages' and @class='alert alert-danger']"));
2741 Thread.sleep(3000);
2742 }
2743
2744 protected void waitAndClickAdministration() throws InterruptedException {
2745 waitAndClickByLinkText(ADMINISTRATION_LINK_TEXT, this);
2746 }
2747
2748 protected void waitAndClickClearValues() throws InterruptedException {
2749 waitAndClickButtonByText("Clear Values");
2750 }
2751
2752 protected void waitAndClickConfirmationOk() throws InterruptedException {
2753 jGrowl("Click OK Confirmation");
2754 String xpath = "//div[@data-parent='ConfirmSubmitDialog']/button[contains(text(),'OK')]";
2755 waitForElementVisibleBy(By.xpath(xpath)).click();
2756 }
2757
2758 protected void waitAndClickConfirmBlanketApproveOk() throws InterruptedException {
2759 jGrowl("Click OK Confirmation");
2760 String xpath = "//div[@data-parent='ConfirmBlanketApproveDialog']/button[contains(text(),'OK')]";
2761 waitForElementVisibleBy(By.xpath(xpath)).click();
2762 }
2763
2764 protected void waitAndClickConfirmSaveOnClose() throws InterruptedException {
2765 jGrowl("Click OK Confirmation");
2766 waitForElementVisibleBy(By.xpath("//div[@data-parent='ConfirmSaveOnCloseDialog']/button[contains(text(),'Yes')]"));
2767 waitAndClickByXpath("//div[@data-parent='ConfirmSaveOnCloseDialog']/button[contains(text(),'Yes')]");
2768 }
2769
2770
2771
2772
2773
2774
2775 private void waitAndClickAdministration(JiraAwareFailable failable) throws InterruptedException {
2776 waitAndClickByLinkText(ADMINISTRATION_LINK_TEXT, failable);
2777 }
2778
2779 protected void waitAndCancelConfirmation() throws InterruptedException {
2780 waitAndClickCancel();
2781 waitAndClickByName("methodToCall.processAnswer.button0");
2782 }
2783
2784
2785 protected void waitAndClickAdHocPersonAdd() throws InterruptedException {
2786 jGrowl("Click AdHoc Person add");
2787 waitAndClickByXpath("//div[@data-parent='Uif-AdHocPersonCollection']/div/div/button");
2788 }
2789
2790 protected void waitAndClickAdHocGroupAdd() throws InterruptedException {
2791 jGrowl("Click AdHoc Group add");
2792 waitAndClickByXpath("//div[@data-parent='CollectionGroup_AdHocWorkgroup']/div/div/button");
2793 }
2794
2795 protected void waitAndClickBlanketApprove() throws InterruptedException {
2796 waitAndClickButtonByText("Blanket Approve");
2797 }
2798
2799
2800
2801
2802
2803 protected void waitAndClickCancel() throws InterruptedException {
2804 waitAndClickByName(CANCEL_NAME);
2805 }
2806
2807 protected void waitAndClickCancelByText() throws InterruptedException {
2808 waitAndClickButtonByText("Cancel");
2809 }
2810
2811
2812
2813
2814
2815 protected void waitAndClickCloseWindow() throws InterruptedException {
2816 waitAndClickByXpath(CLOSE_WINDOW_XPATH_TITLE);
2817 }
2818
2819
2820
2821
2822
2823 protected void waitAndClickCopy() throws InterruptedException {
2824 waitAndClickByLinkText(COPY_LINK_TEXT);
2825 }
2826
2827 protected void waitAndClickDemoLink() throws InterruptedException {
2828 jGrowl("Click Demo Link");
2829 waitAndClickById("Demo-DemoLink", "");
2830 }
2831
2832
2833
2834
2835
2836 protected void waitAndClickDocSearch() throws InterruptedException {
2837 waitAndClickByXpath(DOC_SEARCH_XPATH);
2838 }
2839
2840
2841
2842
2843
2844 protected void waitAndClickDocSearchTitle() throws InterruptedException {
2845 waitAndClickByXpath(DOC_SEARCH_XPATH_TITLE);
2846 }
2847
2848 protected void waitAndClickLibraryLink() throws InterruptedException {
2849 jGrowl("Click Library Link");
2850 waitAndClickById("Demo-LibraryLink", "");
2851 }
2852
2853
2854
2855
2856
2857 protected void waitAndClickLogout() throws InterruptedException {
2858 waitAndClickLogout(this);
2859 }
2860
2861
2862
2863
2864
2865
2866 protected void waitAndClickLogout(JiraAwareFailable failable) throws InterruptedException {
2867 jGrowl("Logging out");
2868 selectTopFrame();
2869 waitAndClickByXpath(LOGOUT_XPATH, failable);
2870 }
2871
2872 protected void waitAndClickMainMenu() throws InterruptedException {
2873 waitAndClickByLinkText(MAIN_MENU_LINK_TEXT, this);
2874 }
2875
2876
2877
2878
2879
2880
2881 private void waitAndClickMainMenu(JiraAwareFailable failable) throws InterruptedException {
2882 waitAndClickByLinkText(MAIN_MENU_LINK_TEXT, failable);
2883 }
2884
2885 protected void waitAndClickRouteLogIcon() throws InterruptedException {
2886 jGrowl("Click Route Log link");
2887 waitAndClickByXpath("//img[@alt=\"Route Log for Document\"]");
2888 }
2889
2890
2891
2892
2893
2894 protected void waitAndClickSave() throws InterruptedException {
2895 waitAndClickByXpath(SAVE_XPATH);
2896 }
2897
2898 protected void waitAndClickSaveByText() throws InterruptedException {
2899 waitAndClickButtonByText("Save");
2900 }
2901
2902
2903
2904
2905
2906 protected void waitAndClickSubmit() throws InterruptedException {
2907 jGrowl("Click Submit");
2908 waitAndClickByXpath(SUBMIT_XPATH);
2909 }
2910
2911 protected void waitAndClickSubmitByText() throws InterruptedException {
2912 waitAndClickButtonByText("Submit");
2913 }
2914
2915
2916
2917
2918
2919 protected void waitAndClickApprove() throws InterruptedException {
2920 jGrowl("Click Approve");
2921 waitAndClickByXpath(APPROVE_XPATH);
2922 }
2923
2924 protected void waitAndClickApproveByText() throws InterruptedException {
2925 waitAndClickButtonByText("Approve");
2926 }
2927
2928
2929
2930
2931
2932 protected void waitAndClickDisapprove() throws InterruptedException {
2933 jGrowl("Click Disapprove");
2934 waitAndClickByXpath(DISAPPROVE_XPATH);
2935 }
2936
2937 protected void waitAndClickDisapproveByText() throws InterruptedException {
2938 waitAndClickButtonByText("Disapprove");
2939 }
2940
2941
2942
2943
2944
2945 protected void waitAndClickAcknowledge() throws InterruptedException {
2946 jGrowl("Click Acknowledge");
2947 waitAndClickByXpath(ACKNOWLEDGE_XPATH);
2948 }
2949
2950 protected void waitAndClickAcknowledgeByText() throws InterruptedException {
2951 waitAndClickButtonByText("Acknowledge");
2952 }
2953
2954
2955
2956
2957
2958 protected void waitAndClickClose() throws InterruptedException {
2959 jGrowl("Click Close");
2960 waitAndClickByXpath(CLOSE_XPATH);
2961 }
2962
2963 protected void waitAndClickCloseByText() throws InterruptedException {
2964 waitAndClickButtonByText("Close");
2965 }
2966
2967
2968
2969
2970
2971
2972 protected void waitAndClickXMLIngester(JiraAwareFailable failable) throws InterruptedException {
2973 waitAndClickByLinkText(XML_INGESTER_LINK_TEXT, failable);
2974 }
2975
2976 protected void waitAndCreateNew() throws InterruptedException {
2977 waitAndCreateNew(this.getClass().toString());
2978 }
2979
2980 protected void waitAndCreateNew(String message) throws InterruptedException {
2981 selectFrameIframePortlet();
2982 jGrowl("Create New");
2983 waitAndClickCreateNew(message);
2984 }
2985
2986
2987
2988
2989
2990 protected void waitAndClickCreateNew() throws InterruptedException {
2991 waitAndClickCreateNew(this.getClass().toString());
2992 }
2993
2994 protected void waitAndClickCreateNew(String message) throws InterruptedException {
2995 jGrowl("Click Create New");
2996 if (WebDriverUtils.waitFors(driver, By.xpath(CREATE_NEW_XPATH)).size() > 0) {
2997 waitAndClickByXpath(CREATE_NEW_XPATH, message);
2998 } else {
2999 System.out.println("waitAndClickByXpath(" + CREATE_NEW_XPATH + ") wasn't found trying " + CREATE_NEW_XPATH2);
3000 waitAndClickByXpath(CREATE_NEW_XPATH2, message);
3001 }
3002 }
3003
3004 protected void waitAndClickEdit() throws InterruptedException {
3005 waitAndClickByLinkText(EDIT_LINK_TEXT);
3006 }
3007
3008
3009
3010
3011
3012 protected void waitAndClickSearch() throws InterruptedException {
3013 jGrowl("Click Search");
3014 waitAndClickByXpath(SEARCH_XPATH);
3015 }
3016
3017 protected void waitAndClickSearch2() throws InterruptedException {
3018 jGrowl("Click Search");
3019 waitAndClickByXpath(SEARCH_XPATH_2);
3020 }
3021
3022 protected void waitAndClickSearchSecond() throws InterruptedException {
3023 jGrowl("Click Search");
3024 waitAndClickByXpath(SEARCH_SECOND);
3025 }
3026
3027 protected void waitAndClickSearchByText() throws InterruptedException {
3028 waitAndClickButtonByText("Search");
3029 }
3030
3031 protected String waitForAgendaDocId() throws InterruptedException {
3032 return waitForElementPresentByXpath("//div[@data-label=\"Document Number\"]").getText();
3033 }
3034
3035 protected String waitForDocId() throws InterruptedException {
3036 checkForDocError();
3037 waitForElementPresentByXpath(DOC_ID_XPATH);
3038
3039 return findElement(By.xpath(DOC_ID_XPATH)).getText();
3040 }
3041
3042 protected String waitForDocIdKrad() throws InterruptedException {
3043 failOnErrorMessageItem();
3044 waitForElementPresentByXpath(DOC_ID_KRAD_XPATH);
3045 String docId = findElement(By.xpath(DOC_ID_KRAD_XPATH)).getText();
3046 jGrowl("Document Number is " + docId);
3047
3048 return docId;
3049 }
3050
3051 protected String waitForDocInitiator() throws InterruptedException {
3052 waitForElementPresentByXpath(DOC_INITIATOR_XPATH);
3053
3054 return findElement(By.xpath(DOC_INITIATOR_XPATH)).getText();
3055 }
3056
3057 protected String waitForDocStatus() throws InterruptedException {
3058 waitForElementPresentByXpath(DOC_STATUS_XPATH);
3059
3060 return findElement(By.xpath(DOC_STATUS_XPATH)).getText();
3061 }
3062
3063 protected void waitForTitleToEqualKualiPortalIndex() throws InterruptedException {
3064 waitForTitleToEqualKualiPortalIndex(this.getClass().toString());
3065 }
3066
3067 protected void waitForToolTipTextPresent(String tooltipText) throws InterruptedException {
3068 assertEquals("ToolTip text not as expected", tooltipText, waitForToolTipPresent().getText());
3069 }
3070
3071 protected WebElement waitForToolTipPresent() throws InterruptedException {
3072 WebElement tooltip = waitForElementPresent("[class='popover top in']");
3073 jGrowl("ToolTip " + tooltip.getText());
3074 return tooltip;
3075 }
3076
3077 protected void waitForTitleToEqualKualiPortalIndex(String message) throws InterruptedException {
3078 Thread.sleep(2000);
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090 }
3091
3092
3093
3094
3095
3096 protected void waitAndClickKRAD() throws InterruptedException {
3097 waitAndClickByLinkText(KRAD_XPATH);
3098 }
3099
3100
3101
3102
3103
3104
3105 protected boolean isKrad(){
3106 return (AutomatedFunctionalTestUtils.REMOTE_UIF_KRAD.equalsIgnoreCase(getUiFramework()));
3107 }
3108
3109
3110
3111
3112
3113
3114 public String getUiFramework() {
3115 return uiFramework;
3116 }
3117
3118
3119
3120
3121 public void setUiFramework(String uiFramework) {
3122 this.uiFramework = uiFramework;
3123 }
3124
3125
3126
3127
3128 public void pressEnterByName(String locator){
3129 pressEnter(By.name(locator));
3130 }
3131
3132
3133
3134
3135 public void pressEnterByXpath(String locator){
3136 pressEnter(By.xpath(locator));
3137 }
3138
3139
3140
3141
3142 public void pressEnter(By by){
3143 findElement(by).sendKeys(Keys.ENTER);
3144 }
3145 }