1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.common;
17
18 import com.thoughtworks.selenium.SeleneseTestBase;
19 import edu.samplu.admin.test.AdminTmplMthdSTNavBase;
20 import org.apache.commons.lang.RandomStringUtils;
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23 import org.junit.After;
24 import org.junit.Before;
25 import org.junit.BeforeClass;
26 import org.junit.Rule;
27 import org.junit.rules.TestName;
28 import org.openqa.selenium.Alert;
29 import org.openqa.selenium.By;
30 import org.openqa.selenium.JavascriptExecutor;
31 import org.openqa.selenium.NoSuchElementException;
32 import org.openqa.selenium.WebDriver;
33 import org.openqa.selenium.WebElement;
34 import org.openqa.selenium.chrome.ChromeDriverService;
35 import org.openqa.selenium.interactions.Actions;
36 import org.openqa.selenium.remote.RemoteWebDriver;
37 import org.openqa.selenium.support.ui.Select;
38 import org.testng.annotations.AfterMethod;
39 import org.testng.annotations.BeforeMethod;
40
41 import java.lang.reflect.Method;
42 import java.util.ArrayList;
43 import java.util.Calendar;
44 import java.util.LinkedList;
45 import java.util.List;
46 import java.util.Set;
47 import java.util.concurrent.TimeUnit;
48
49 import static org.junit.Assert.assertEquals;
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 public abstract class WebDriverLegacyITBase implements Failable {
69
70
71
72
73 public static final String ADMINISTRATION_LINK_TEXT = "Administration";
74
75
76
77
78 public static final String AGENDA_LOOKUP_LINK_TEXT = "Agenda Lookup";
79
80
81
82
83 public static final String ARIA_INVALID_XPATH = "//input[@aria-invalid]";
84
85
86
87
88 public static final String BLANKET_APPROVE_NAME = "methodToCall.blanketApprove";
89
90
91
92
93
94 public static final String CANCEL_NAME = "methodToCall.cancel";
95
96
97
98
99
100 public static final String CANCEL2_XPATH = "//a[contains(text(), 'ancel')]";
101
102
103
104
105 public static final String CLOSE_WINDOW_XPATH_TITLE = "//*[@title='close this window']";
106
107
108
109
110 public static final String COLLECTIONS_LINK_TEXT = "Collections";
111
112
113
114
115 public static final String CONFIGURATION_VIEW_WINDOW_TITLE = "Kuali :: Configuration Test View";
116
117
118
119
120 public static final String CONFIGURATION_VIEW_XPATH = "(//a[contains(text(),'Configuration Test View')])[3]";
121
122
123
124
125 public static final String COPY_LINK_TEXT = "copy";
126
127
128
129
130 public static final String CREATE_NEW_DOCUMENT_NOT_SUBMITTED_SUCCESSFULLY_MESSAGE_TEXT = "New Document not submitted successfully";
131
132
133
134
135 public static final String CREATE_NEW_XPATH = "//img[@alt='create new']";
136
137
138
139
140 public static final int DEFAULT_WAIT_SEC = 30;
141
142
143
144
145 public static final String DIV_LEFT_ERRMSG = "//div[@class='left-errmsg-tab']/div/div";
146
147
148
149
150 public static final String DOC_CODE_XPATH = "//input[@id='document.newMaintainableObject.code']";
151
152
153
154
155 public static final String DOC_ID_XPATH = "//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]";
156
157
158
159
160 public static final String DOC_ID_XPATH_2 = "//table[@id='row']/tbody/tr[1]/td[1]";
161
162
163
164
165 public static final String DOC_ID_XPATH_3 ="//table[@id='row']/tbody/tr[1]/td[1]/a";
166
167
168
169
170 public static final String DOC_DESCRIPTION_XPATH ="//input[@id='document.documentHeader.documentDescription']";
171
172
173
174
175 public static final String DOC_SEARCH_XPATH = "//img[@alt='doc search']";
176
177
178
179
180 public static final String DOC_SEARCH_XPATH_TITLE = "//a[@title='Document Search']";
181
182
183
184
185 public static final String DOC_STATUS_ENROUTE = "ENROUTE";
186
187
188
189
190 public static final String DOC_STATUS_FINAL = "FINAL";
191
192
193
194
195 public static final String DOC_STATUS_SAVED = "SAVED";
196
197
198
199
200 public static final String DOC_STATUS_XPATH = "//table[@class='headerinfo']//tr[1]/td[2]";
201
202
203
204
205 public static final String DOC_STATUS_XPATH_2 = "//table[@id='row']/tbody/tr[1]/td[4]";
206
207
208
209
210 public static final String DOC_SUBMIT_SUCCESS_MSG_XPATH ="//div[contains(div,'Document was successfully submitted.')]";
211
212
213
214
215 public static final String EDIT_LINK_TEXT = "edit";
216
217
218
219
220 public static final String IFRAMEPORTLET_NAME = "iframeportlet";
221
222
223
224
225 public static final String KITCHEN_SINK_XPATH = "(//a[contains(text(),'Uif Components (Kitchen Sink)')])[2]";
226
227
228
229
230 public static final String KRAD_XPATH = "KRAD";
231
232
233
234
235 public static final String KUALI_UIF_COMPONENTS_WINDOW_XPATH = "Kuali :: Uif Components";
236
237
238
239
240 public static final String KUALI_VIEW_WINDOW_TITLE = "Kuali :: View Title";
241
242
243
244
245 public static final String LOGOUT_XPATH = "//input[@name='imageField' and @value='Logout']";
246
247
248
249
250 public static final String MAIN_MENU_LINK_TEXT = "Main Menu";
251
252
253
254
255 public static final String REGEX_ERROR = "^[\\s\\S]*error[\\s\\S]*$";
256
257
258
259
260 public static final String REGEX_VALID = "^.*\\bvalid\\b.*$";
261
262
263
264
265 public static final String REMOTE_PUBLIC_USER_PROPERTY = "remote.public.user";
266
267
268
269
270 public static final String REMOTE_PUBLIC_USERPOOL_PROPERTY = "remote.public.userpool";
271
272
273
274
275 public static final String REMOTE_LOGIN_UIF = "remote.login.uif";
276
277
278
279
280 public static final String REMOTE_PUBLIC_WAIT_SECONDS_PROPERTY = "remote.public.wait.seconds";
281
282
283
284
285 public static final String RETURN_VALUE_LINK_TEXT = "return value";
286
287
288
289
290 public static final String RICH_MESSAGES_WINDOW_TITLE = "Kuali :: Rich Messages";
291
292
293
294
295 public static final String SAVE_SUCCESSFUL_XPATH = "//div[contains(div,'Document was successfully saved.')]";
296
297
298
299
300 public static final String SAVE_XPATH="//input[@name='methodToCall.save' and @alt='save']";
301
302
303
304
305
306 public static final String SAVE_XPATH_2 = "//*[@name='methodToCall.save' and @alt='save']";
307
308
309
310
311 public static final String SAVE_XPATH_3 = "//input[@title='search' and @name='methodToCall.search']";
312
313
314
315
316 public static final String SEARCH_XPATH="//input[@name='methodToCall.search' and @value='search']";
317
318
319
320
321 public static final String SUBMIT_XPATH="//input[@name='methodToCall.route' and @alt='submit']";
322
323
324
325
326 public static final String SEARCH_XPATH_2 = "//input[@value='search']";
327
328
329
330
331 public static final String SEARCH_XPATH_3 = "//button[contains(text(),'earch')]";
332
333
334
335
336 public static final String SUB_COLLECTION_UIF_DISCLOSURE_SPAN_UIF_HEADER_TEXT_SPAN_XPATH =
337 "div.uif-group.uif-collectionGroup.uif-tableCollectionGroup.uif-tableSubCollection.uif-disclosure span.uif-headerText-span";
338
339
340
341
342 public static final String TIMEOUT_MESSAGE = "timeout";
343
344
345
346
347 public static final String TRAVEL_ACCOUNT_LOOKUP_LINK_TEXT = "Travel Account Lookup";
348
349
350
351
352 public static final String UIF_COMPONENTS_KITCHEN_SINK_LINK_TEXT = "Uif Components (Kitchen Sink)";
353
354
355
356
357 public static final String VALIDATION_FRAMEWORK_DEMO_XPATH = "(//a[contains(text(),'Validation Framework Demo')])[2]";
358
359
360
361
362 public static final String KUALI_COLLECTION_TOTALLING_WINDOW_XPATH = "Kuali :: Collection Totaling";
363
364
365
366
367 public static final String KUALI_COLLECTION_TOTALLING_XPATH = "//a[text()='Collection Totaling']";
368
369
370
371
372 public static final String XML_INGESTER_LINK_TEXT = "XML Ingester";
373
374
375
376
377 public static final String FISCAL_OFFICER_INFO_MAINTENANCE_NEW_XPATH = "//a[@title='FiscalOfficerInfo Maintenance (New)']";
378
379 static ChromeDriverService chromeDriverService;
380
381 protected WebDriver driver;
382 protected String user = "admin";
383 protected int waitSeconds = DEFAULT_WAIT_SEC;
384 protected boolean passed = false;
385 protected String uiFramework = ITUtil.REMOTE_UIF_KNS;
386
387 private Log log = LogFactory.getLog(getClass());
388
389 public @Rule
390 TestName testName = new TestName();
391
392 protected String testMethodName;
393
394 protected String jGrowlHeader;
395
396 String sessionId = null;
397
398
399
400
401
402
403 @BeforeClass
404 public static void chromeDriverService() throws Exception {
405 chromeDriverService = WebDriverUtil.chromeDriverCreateCheck();
406 if (chromeDriverService != null)
407 chromeDriverService.start();
408 }
409
410
411
412
413
414
415
416 public abstract String getTestUrl();
417
418 protected void navigateInternal() throws Exception {
419
420 }
421
422 @BeforeMethod
423 protected void startSession(Method method) throws Exception {
424 testMethodName = method.getName();
425 }
426
427
428
429
430
431
432
433
434 @Before
435 @BeforeMethod
436 public void testSetUp() {
437 try {
438
439 if (testName != null && testName.getMethodName() != null) {
440 testMethodName = testName.getMethodName();
441 }
442
443 waitSeconds = Integer.parseInt(System.getProperty(REMOTE_PUBLIC_WAIT_SECONDS_PROPERTY, DEFAULT_WAIT_SEC + ""));
444 String givenUser = WebDriverUtil.determineUser(this.toString());
445 if (givenUser != null) {
446 user = givenUser;
447 }
448
449 driver = WebDriverUtil.setUp(getUserName(), getTestUrl(), getClass().getSimpleName(), testMethodName);
450 this.sessionId = ((RemoteWebDriver) driver).getSessionId().toString();
451
452
453 if (isKradLogin()){
454 WebDriverUtil.kradLogin(driver, user, this);
455 } else {
456 WebDriverUtil.login(driver, user, this);
457 }
458
459 jGrowlHeader = getClass().getSimpleName() + "." + testMethodName;
460 System.out.println(jGrowlHeader + " sessionId is " + sessionId);
461 jGrowl("setUp");
462
463 navigateInternal();
464
465 } catch (Throwable t) {
466 System.out.println("Throwable " + t.getMessage() + " in Before annotated method is very bad, ignoring and letting first method of test class to fail.");
467 t.printStackTrace();
468 System.out.println("Throwable " + t.getMessage() + " in Before annotated method is very bad, ignoring and letting first method of test class to fail.");
469 }
470 }
471
472
473
474
475
476
477
478
479 @After
480 @AfterMethod
481 public void tearDown() {
482 try {
483 if (!passed) {
484 jGrowlSticky("FAILURE!");
485 }
486
487 WebDriverUtil.tearDown(passed, sessionId, this.toString().trim(), user);
488 }
489
490 catch (Throwable t) {
491 System.out.println("Exception in tearDown " + t.getMessage());
492 t.printStackTrace();
493 }
494
495 finally {
496 try {
497 closeAndQuitWebDriver();
498 }
499
500 catch (Throwable t) {
501 System.out.println(t.getMessage() + " occured during tearDown, ignoring to avoid killing test run.");
502 t.printStackTrace();
503 System.out.println(t.getMessage() + " occured during tearDown, ignoring to avoid killing test run.");
504 }
505 }
506 }
507
508 private void closeAndQuitWebDriver() {
509 if (driver != null) {
510 if (ITUtil.dontTearDownPropertyNotSet()) {
511 driver.close();
512 driver.quit();
513 }
514 }
515
516 else {
517 System.out.println("WebDriver is null for " + this.getClass().toString() + ", if using saucelabs, has" +
518 " sauceleabs been uncommented in WebDriverUtil.java? If using a remote hub did you include the port?");
519 }
520 }
521
522
523
524
525 protected void passed() {
526 passed = true;
527 jGrowlSticky("Passed");
528 }
529
530 protected void agendaLookupAssertions() throws Exception {
531 testLookUp();
532 assertTextPresent("Rules");
533 waitAndClick(By.xpath(CANCEL2_XPATH));
534 }
535
536
537
538
539
540 protected void alertAccept() {
541 Alert alert = driver.switchTo().alert();
542
543 alert.accept();
544 }
545
546
547
548
549
550 protected void alertDismiss() {
551 Alert alert = driver.switchTo().alert();
552
553 alert.dismiss();
554 }
555
556 protected void assertAttributeClassRegexDoesntMatch(String field, String regex) throws InterruptedException {
557 String attribute = getAttributeByName(field, "class");
558 SeleneseTestBase.assertTrue("getAttributeByName(" + field + ", \"class\") should not be null", attribute != null);
559 SeleneseTestBase.assertFalse("attribute " + attribute + " matches regex " + regex + " and it should not",
560 attribute.matches(regex));
561 }
562
563 protected void assertAttributeClassRegexMatches(String field, String regex) throws InterruptedException {
564 String attribute = getAttributeByName(field, "class");
565 SeleneseTestBase.assertTrue("getAttributeByName(" + field + ", \"class\") should not be null", attribute != null);
566 SeleneseTestBase.assertTrue("attribute " + attribute + " doesn't match regex " + regex, attribute.matches(
567 regex));
568 }
569
570 protected void assertBlanketApproveButtonsPresent() {
571 assertElementPresentByName("methodToCall.route");
572 assertElementPresentByName("methodToCall.save");
573 assertElementPresentByName(BLANKET_APPROVE_NAME, "Blanket Approve button not present does " + user + " have permssion?");
574 assertElementPresentByName("methodToCall.close");
575 assertElementPresentByName(CANCEL_NAME);
576 }
577
578 protected void assertCancelConfirmation() throws InterruptedException {
579 waitAndClickByLinkText("Cancel");
580 alertDismiss();
581 }
582
583 protected void assertDocFinal(String docId) throws InterruptedException {
584 jiraAwareWaitFor(By.linkText("spreadsheet"), "");
585
586 if (isElementPresent(By.linkText(docId))) {
587 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getDocStatus());
588 } else {
589 SeleneseTestBase.assertEquals(docId,driver.findElement(By.xpath(DOC_ID_XPATH_2)));
590 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getDocStatus());
591 }
592 }
593
594 protected void assertElementPresentByName(String name) {
595 driver.findElement(By.name(name));
596 }
597
598 protected void assertElementPresentByName(String name, String message) {
599 try {
600 driver.findElement(By.name(name));
601 } catch (Exception e) {
602 failableFail(name + " not present " + message);
603 }
604 }
605
606 protected void assertElementPresentByXpath(String locator) {
607 driver.findElement(By.xpath(locator));
608 }
609
610 protected void assertElementPresentByXpath(String locator, String message) {
611 try {
612 driver.findElement(By.xpath(locator));
613 } catch (Exception e) {
614 jiraAwareFail(By.xpath(locator), message, e);
615 }
616 }
617
618 protected void assertElementPresentByLinkText(String linkText) {
619 driver.findElement(By.linkText(linkText));
620 }
621
622 protected void assertElementPresent(String locator) {
623 driver.findElement(By.cssSelector(locator));
624 }
625
626 protected void assertFocusTypeBlurError(String field, String textToType) throws InterruptedException {
627 fireEvent(field, "focus");
628 waitAndTypeByName(field, textToType);
629 fireEvent(field, "blur");
630 Thread.sleep(200);
631 assertAttributeClassRegexMatches(field, REGEX_ERROR);
632 }
633
634 protected void assertFocusTypeBlurError(String field, String[] errorInputs) throws InterruptedException {
635 for (String errorInput: errorInputs) {
636 assertFocusTypeBlurError(field, errorInput);
637 clearTextByName(field);
638 }
639 }
640
641 protected void assertFocusTypeBlurValid(String field, String textToType) throws InterruptedException {
642 fireEvent(field, "focus");
643 waitAndTypeByName(field, textToType);
644 fireEvent(field, "blur");
645 Thread.sleep(200);
646 assertAttributeClassRegexMatches(field, REGEX_VALID);
647 assertAttributeClassRegexDoesntMatch(field, REGEX_ERROR);
648 }
649
650 protected void assertFocusTypeBlurValid(String field, String[] validInputs) throws InterruptedException {
651 for (String validInput: validInputs) {
652 assertFocusTypeBlurValid(field, validInput);
653 clearTextByName(field);
654 }
655 }
656
657 protected void assertIsVisibleByXpath(String xpath, String message) {
658 if (!isVisibleByXpath(xpath)) {
659 failableFail(xpath + " not visible " + message);
660 }
661 }
662
663 protected void assertIsNotVisibleByXpath(String xpath, String message) {
664 if (isVisibleByXpath(xpath)) {
665 failableFail(xpath + " visible " + message);
666 }
667 }
668
669 protected void assertIsVisible(String locator) {
670 if (!isVisible(locator)) {
671 failableFail(locator + " is not visible and should be");
672 }
673 }
674
675 protected void assertIsNotVisible(String locator) {
676 if (isVisible(locator)) {
677 failableFail(locator + " is visible and should not be");
678 }
679 }
680
681
682
683
684
685
686
687
688 protected void assertPopUpWindowUrl(By by, String windowName, String url) {
689 driver.findElement(by).click();
690 String parentWindowHandle = driver.getWindowHandle();
691
692 driver.switchTo().window(windowName).findElements(By.tagName("head"));
693 SeleneseTestBase.assertEquals(url, driver.getCurrentUrl());
694 driver.switchTo().window(parentWindowHandle);
695 }
696
697 protected void assertTableLayout() {
698 String pageSource = driver.getPageSource();
699 SeleneseTestBase.assertTrue(pageSource.contains("Table Layout"));
700 SeleneseTestBase.assertTrue(pageSource.contains("Field 1"));
701 SeleneseTestBase.assertTrue(pageSource.contains("Field 2"));
702 SeleneseTestBase.assertTrue(pageSource.contains("Field 3"));
703 SeleneseTestBase.assertTrue(pageSource.contains("Field 4"));
704 SeleneseTestBase.assertTrue(pageSource.contains("Actions"));
705 }
706
707 protected void assertTextPresent(String text) {
708 assertTextPresent(text, "");
709 }
710
711 protected void assertTextPresent(String text, String message) {
712 if (!driver.getPageSource().contains(text)) {
713 failableFail(text + " not present " + message);
714 }
715 }
716
717 protected void assertTextPresent(String text, String cssSelector, String message){
718 WebElement element = driver.findElement(By.cssSelector(cssSelector));
719 if (!element.getText().contains(text)){
720 failableFail(text + " for " + cssSelector + " not present " + message);
721 }
722 }
723
724
725
726
727
728 protected void assertTextNotPresent(String text) {
729 assertTextNotPresent(text, "");
730 }
731
732
733
734
735
736
737 protected void assertTextNotPresent(String text, String message) {
738 if (driver.getPageSource().contains(text)) {
739 failableFail(text + " not present " + message);
740 }
741 }
742
743 protected void back() {
744 driver.navigate().back();
745 }
746
747 private void blanketApproveAssert() throws InterruptedException {
748 checkForDocError();
749 ITUtil.checkForIncidentReport(driver.getPageSource(), DOC_SEARCH_XPATH, this, "Blanket Approve failure");
750 waitAndClickDocSearch();
751 SeleneseTestBase.assertEquals("Kuali Portal Index", driver.getTitle());
752 selectFrameIframePortlet();
753 waitAndClickSearch();
754 }
755
756
757
758
759
760
761
762
763 protected void blanketApproveTest() throws InterruptedException {
764 ITUtil.checkForIncidentReport(driver.getPageSource(), BLANKET_APPROVE_NAME, this, "");
765 waitAndClickByName(BLANKET_APPROVE_NAME,
766 "No blanket approve button does the user " + getUserName() + " have permission?");
767 Thread.sleep(2000);
768
769 blanketApproveAssert();
770 }
771
772 protected void check(By by) throws InterruptedException {
773 WebElement element = driver.findElement(by);
774
775 if (!element.isSelected()) {
776 element.click();
777 }
778 }
779
780 protected void checkByName(String name) throws InterruptedException {
781 check(By.name(name));
782 }
783
784 protected void checkByXpath(String locator) throws InterruptedException {
785 check(By.xpath(locator));
786 }
787
788 protected void checkErrorMessageItem(String message) {
789 final String error_locator = "//li[@class='uif-errorMessageItem']";
790 assertElementPresentByXpath(error_locator);
791 String errorText = null;
792
793 try {
794 errorText = getTextByXpath(error_locator);
795 } catch (InterruptedException e) {
796 e.printStackTrace();
797 }
798
799 if (errorText != null && errorText.contains("errors")) {
800 failableFail(errorText + message);
801 }
802 }
803
804
805
806
807 public void checkForDocError() {
808 if (hasDocError()) {
809 String errorText = driver.findElement(By.xpath(ITUtil.DIV_ERROR_LOCATOR)).getText();
810 errorText = ITUtil.blanketApprovalCleanUpErrorText(errorText);
811 if (driver.findElements(By.xpath(ITUtil.DIV_EXCOL_LOCATOR)).size() > 0) {
812 errorText = ITUtil.blanketApprovalCleanUpErrorText(driver.findElement(
813 By.xpath(ITUtil.DIV_EXCOL_LOCATOR)).getText());
814 }
815 if (driver.findElements(By.xpath(DIV_LEFT_ERRMSG)).size() > 0) {
816 errorText = errorText + ITUtil.blanketApprovalCleanUpErrorText(driver.findElement(By.xpath(DIV_LEFT_ERRMSG)).getText());
817 }
818 failableFail(errorText);
819 }
820 }
821
822
823
824
825
826 public boolean hasDocError() {
827 if (driver.findElements(By.xpath(ITUtil.DIV_ERROR_LOCATOR)).size() > 0) {
828 String errorText = driver.findElement(By.xpath(ITUtil.DIV_ERROR_LOCATOR)).getText();
829 if (errorText != null && errorText.contains("error(s) found on page.")) {
830 return true;
831 }
832 }
833 return false;
834 }
835
836
837
838
839
840
841 public boolean hasDocError(String errorTextToMatch) {
842 if (driver.findElements(By.xpath(ITUtil.DIV_ERROR_LOCATOR)).size() > 0) {
843 String errorText = driver.findElement(By.xpath(ITUtil.DIV_ERROR_LOCATOR)).getText();
844 if (errorText != null && errorText.contains("error(s) found on page.")) {
845 return errorText.contains(errorTextToMatch);
846 }
847 }
848 return false;
849 }
850
851 protected void checkForIncidentReport() {
852 checkForIncidentReport("", "");
853 }
854
855 protected void checkForIncidentReport(String locator) {
856 checkForIncidentReport(locator, "");
857 }
858
859 protected void checkForIncidentReport(String locator, String message) {
860 ITUtil.checkForIncidentReport(driver.getPageSource(), locator, this, message);
861 }
862
863 protected void checkForIncidentReport(String locator, Failable failable, String message) {
864 ITUtil.checkForIncidentReport(driver.getPageSource(), locator, failable, message);
865 }
866
867 protected void clearText(By by) throws InterruptedException {
868 driver.findElement(by).clear();
869 }
870
871 protected void clearText(String selector) throws InterruptedException {
872 clearText(By.cssSelector(selector));
873 }
874
875 protected void clearTextByName(String name) throws InterruptedException {
876 clearText(By.name(name));
877 }
878
879 protected void clearTextByXpath(String locator) throws InterruptedException {
880 clearText(By.xpath(locator));
881 }
882
883 protected void close() {
884 driver.close();
885 }
886
887 protected void colapseExpandByXpath(String clickLocator, String visibleLocator) throws InterruptedException {
888 waitAndClickByXpath(clickLocator);
889 waitNotVisibleByXpath(visibleLocator);
890 waitAndClickByXpath(clickLocator);
891 waitIsVisibleByXpath(visibleLocator);
892 }
893
894 protected String configNameSpaceBlanketApprove() throws Exception {
895 String docId = waitForDocId();
896 String dtsPlusTwoChars = ITUtil.createUniqueDtsPlusTwoRandomChars();
897 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Namespace " + dtsPlusTwoChars);
898 assertBlanketApproveButtonsPresent();
899 waitAndTypeByXpath(DOC_CODE_XPATH, "VTN" + dtsPlusTwoChars);
900 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']",
901 "Validation Test NameSpace " + dtsPlusTwoChars);
902 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.applicationId']", "RICE");
903
904 return docId;
905 }
906
907 protected void contextLookupAssertions() throws Exception {
908 testLookUp();
909 assertTextPresent("Notes and Attachments");
910 waitAndClick(By.xpath(CANCEL2_XPATH));
911 passed();
912 }
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944 protected void expandColapseByXpath(String clickLocator, String visibleLocator) throws InterruptedException {
945 waitAndClickByXpath(clickLocator);
946 waitIsVisibleByXpath(visibleLocator);
947 waitAndClickByXpath(clickLocator);
948 waitNotVisibleByXpath(visibleLocator);
949 }
950
951
952
953
954
955
956 public String[] getAllWindowTitles() {
957 return (String[]) driver.getWindowHandles().toArray();
958 }
959
960 protected String getAttribute(By by, String attribute) throws InterruptedException {
961 jiraAwareWaitFor(by, "");
962
963 return driver.findElement(by).getAttribute(attribute);
964 }
965
966
967
968
969
970
971
972 protected String getAttributeByName(String name, String attribute) throws InterruptedException {
973 return getAttribute(By.name(name), attribute);
974 }
975
976
977
978
979
980
981
982 protected String getAttributeByXpath(String locator, String attribute) throws InterruptedException {
983 return getAttribute(By.xpath(locator), attribute);
984 }
985
986 protected String getBaseUrlString() {
987 return ITUtil.getBaseUrlString();
988 }
989
990 protected int getCssCount(String selector) {
991 return getCssCount(By.cssSelector(selector));
992 }
993
994
995
996
997
998
999 protected int getCssCount(By by) {
1000 return (driver.findElements(by)).size();
1001 }
1002
1003 protected String getDocStatus() {
1004 return driver.findElement(By.xpath(DOC_STATUS_XPATH_2)).getText();
1005 }
1006
1007
1008
1009
1010
1011
1012
1013 protected String[] getSelectOptions(By by) throws InterruptedException {
1014 WebElement select1 = driver.findElement(by);
1015 List<WebElement> options = select1.findElements(By.tagName("option"));
1016 String[] optionValues = new String[options.size()];
1017 int counter = 0;
1018
1019 for (WebElement option : options) {
1020 optionValues[counter] = option.getAttribute("value");
1021 counter++;
1022 }
1023
1024 return optionValues;
1025 }
1026
1027 protected String[] getSelectOptionsByName(String name) throws InterruptedException {
1028 return getSelectOptions(By.name(name));
1029 }
1030
1031 protected String[] getSelectOptionsByXpath(String locator) throws InterruptedException {
1032 return getSelectOptions(By.xpath(locator));
1033 }
1034
1035
1036
1037
1038
1039 public String getSessionId() {
1040 return sessionId;
1041 }
1042
1043 protected String getText(By by) throws InterruptedException {
1044 return driver.findElement(by).getText();
1045 }
1046
1047 protected String getTextByClassName(String className) throws InterruptedException {
1048 return getText(By.className(className));
1049 }
1050
1051 protected String getTextById(String id) throws InterruptedException {
1052 return getText(By.id(id));
1053 }
1054
1055 protected String getTextByName(String name) throws InterruptedException {
1056 return getText(By.name(name));
1057 }
1058
1059 protected String getText(String locator) throws InterruptedException {
1060 return getText(By.cssSelector(locator));
1061 }
1062
1063 protected String getTextByXpath(String locator) throws InterruptedException {
1064 return getText(By.xpath(locator));
1065 }
1066
1067 protected String getTitle() {
1068 return driver.getTitle();
1069 }
1070
1071
1072
1073
1074
1075 public String getUserName() {
1076 return user;
1077 }
1078
1079
1080
1081
1082
1083
1084 protected void gotoNestedFrame() {
1085 driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
1086 driver.switchTo().defaultContent();
1087
1088 if (driver.findElements(By.xpath("//iframe")).size() > 0) {
1089 WebElement containerFrame = driver.findElement(By.xpath("//iframe"));
1090 driver.switchTo().frame(containerFrame);
1091 }
1092
1093 if (driver.findElements(By.xpath("//iframe")).size() > 0) {
1094 WebElement contentFrame = driver.findElement(By.xpath("//iframe"));
1095 driver.switchTo().frame(contentFrame);
1096 }
1097
1098 driver.manage().timeouts().implicitlyWait(waitSeconds, TimeUnit.SECONDS);
1099 }
1100
1101
1102
1103
1104
1105 public void failableFail(String message) {
1106 jGrowlSticky(message);
1107 fail(message);
1108 }
1109
1110 protected List<WebElement> findVisibleElements(By by) {
1111 List<WebElement> webElements = driver.findElements(by);
1112 List<WebElement> visibleWebElements = new LinkedList<WebElement>();
1113 for (WebElement webElement: webElements) {
1114 if (webElement.isDisplayed()) {
1115 visibleWebElements.add(webElement);
1116 }
1117 }
1118
1119 return visibleWebElements;
1120 }
1121
1122 protected void fireEvent(String name, String event) {
1123 ((JavascriptExecutor) driver).executeScript("var elements=document.getElementsByName(\"" + name + "\");" +
1124 "for (var i = 0; i < elements.length; i++){" +
1125 "elements[i]." + event + "();}");
1126 }
1127
1128 protected void fireEvent(String name, String value, String event) {
1129 ((JavascriptExecutor) driver).executeScript("var elements=document.getElementsByName(\"" + name + "\");" +
1130 "for (var i = 0; i < elements.length; i++){" +
1131 "if(elements[i].value=='" + value + "')" +
1132 "elements[i]." + event + "();}");
1133 }
1134
1135
1136
1137
1138
1139 public void fireMouseOverEventByName(String name) {
1140 this.fireMouseOverEvent(By.name(name));
1141 }
1142
1143
1144
1145
1146
1147 public void fireMouseOverEventByXpath(String locator) {
1148 this.fireMouseOverEvent(By.xpath(locator));
1149 }
1150
1151
1152
1153
1154
1155 public void fireMouseOverEvent(By by) {
1156 Actions builder = new Actions(driver);
1157 Actions hover = builder.moveToElement(driver.findElement(by));
1158 hover.perform();
1159 }
1160
1161 protected int howManyAreVisible(By by) throws InterruptedException {
1162 int count = 0;
1163 if (by == null) {
1164
1165 return count;
1166 }
1167
1168 List<WebElement> webElementsFound = driver.findElements(by);
1169 for (WebElement webElement: webElementsFound) {
1170 if (webElement.isDisplayed()) {
1171 count++;
1172 }
1173 }
1174
1175 return count;
1176 }
1177
1178
1179
1180
1181
1182
1183 protected boolean isElementPresent(By by) {
1184 return (driver.findElements(by)).size() > 0;
1185 }
1186
1187
1188
1189
1190
1191
1192 protected boolean isElementPresent(String locator) {
1193 return (driver.findElements(By.cssSelector(locator))).size() > 0;
1194 }
1195
1196 protected boolean isElementPresentByName(String name) {
1197 return isElementPresent(By.name(name));
1198 }
1199
1200 protected boolean isElementPresentByXpath(String locator) {
1201 return isElementPresent(By.xpath(locator));
1202 }
1203
1204 protected boolean isElementPresentByLinkText(String locator) {
1205 return isElementPresent(By.linkText(locator));
1206 }
1207
1208 protected boolean isElementPresentByDataAttributeValue(String dataAttributeName, String dataAttributeValue) {
1209 return isElementPresent(By.cssSelector("[data-" + dataAttributeName +"='"+ dataAttributeValue +"']"));
1210 }
1211
1212 protected Boolean isTextPresent(String text) {
1213 if (driver.getPageSource().contains(text)) {
1214 return Boolean.TRUE;
1215 }
1216
1217 return Boolean.FALSE;
1218 }
1219
1220 protected boolean isVisible(String locator) {
1221 return driver.findElement(By.cssSelector(locator)).isDisplayed();
1222 }
1223
1224 protected boolean isVisible(By by) {
1225 return driver.findElement(by).isDisplayed();
1226 }
1227
1228 protected boolean isVisibleById(String id) {
1229 return isVisible(By.id(id));
1230 }
1231
1232 protected boolean isVisibleByXpath(String locator) {
1233 return isVisible(By.xpath(locator));
1234 }
1235
1236 protected void jGrowl(String message) {
1237 WebDriverUtil.jGrowl(driver, jGrowlHeader, false, message);
1238 }
1239
1240
1241
1242
1243
1244 protected void jGrowlSticky(String message) {
1245 WebDriverUtil.jGrowl(driver, jGrowlHeader, true, message);
1246 }
1247
1248 private void jiraAwareFail(By by, String message, Throwable t) {
1249 JiraAwareFailureUtil.failOnMatchedJira(by.toString(), message, this);
1250
1251 checkForIncidentReport(by.toString(), message);
1252 failableFail(t.getMessage() + " " + by.toString() + " " + message + " " + driver.getCurrentUrl());
1253 }
1254
1255 protected void jiraAwareWaitAndClick(By by, String message) throws InterruptedException {
1256 try {
1257 jiraAwareWaitFor(by, message);
1258 (driver.findElement(by)).click();
1259 } catch (Exception e) {
1260 jiraAwareFail(by, message, e);
1261 }
1262 }
1263
1264 protected void jiraAwareWaitAndClick(By by, String message, Failable failable) throws InterruptedException {
1265 try {
1266 jiraAwareWaitFor(by, message, failable);
1267 (driver.findElement(by)).click();
1268 } catch (Exception e) {
1269 jiraAwareFail(by, message, e);
1270 }
1271 }
1272
1273 protected void jiraAwareWaitFor(By by, String message) throws InterruptedException {
1274 try {
1275 WebDriverUtil.waitFor(this.driver, this.waitSeconds, by, message);
1276 } catch (Throwable t) {
1277 jiraAwareFail(by, message, t);
1278 }
1279 }
1280
1281 protected void jiraAwareWaitFor(By by, String message, Failable failable) throws InterruptedException {
1282 try {
1283 WebDriverUtil.waitFor(this.driver, this.waitSeconds, by, message);
1284 } catch (Throwable t) {
1285 jiraAwareFail(by, message, t);
1286 }
1287 }
1288
1289 protected void open(String url) {
1290 driver.get(url);
1291 }
1292
1293 protected void selectFrameIframePortlet() {
1294 selectFrame(IFRAMEPORTLET_NAME);
1295 }
1296
1297 protected void selectFrame(String locator) {
1298
1299 if (IFRAMEPORTLET_NAME.equals(locator)) {
1300 gotoNestedFrame();
1301 } else {
1302 WebDriverUtil.selectFrameSafe(driver, locator);
1303 }
1304 }
1305
1306 protected void selectTopFrame() {
1307 driver.switchTo().defaultContent();
1308 }
1309
1310 protected void selectWindow(String locator) {
1311 driver.switchTo().window(locator);
1312 }
1313
1314 protected void selectByXpath(String locator, String selectText) throws InterruptedException {
1315 select(By.xpath(locator), selectText);
1316 }
1317
1318 protected void selectByName(String name, String selectText) throws InterruptedException {
1319 select(By.name(name), selectText);
1320 }
1321
1322
1323
1324
1325
1326
1327
1328 protected void select(By by, String selectText) throws InterruptedException {
1329 WebElement select1 = driver.findElement(by);
1330 List<WebElement> options = select1.findElements(By.tagName("option"));
1331
1332 for (WebElement option : options) {
1333 if (option.getText().equals(selectText)) {
1334 option.click();
1335 break;
1336 }
1337 }
1338 }
1339
1340 protected void selectOptionByName(String name, String optionValue) throws InterruptedException {
1341 selectOption(By.name(name), optionValue);
1342 }
1343
1344 protected void selectOptionByXpath(String locator, String optionValue) throws InterruptedException {
1345 selectOption(By.name(locator), optionValue);
1346 }
1347
1348
1349
1350
1351
1352
1353
1354 protected void selectOption(By by, String optionValue) throws InterruptedException {
1355 WebElement select1 = driver.findElement(by);
1356 List<WebElement> options = select1.findElements(By.tagName("option"));
1357
1358 if (options == null || options.size() == 0) {
1359 failableFail("No options for select " + select1.toString() + " was looking for value " + optionValue + " using " + by.toString());
1360 }
1361
1362 for (WebElement option : options) {
1363 if (option.getAttribute("value").equals(optionValue)) {
1364 option.click();
1365 break;
1366 }
1367 }
1368 }
1369
1370
1371
1372
1373
1374 public void switchToWindow(String title) {
1375 Set<String> windows = driver.getWindowHandles();
1376
1377 for (String window : windows) {
1378 driver.switchTo().window(window);
1379 if (driver.getTitle().contains(title)) {
1380 return;
1381 }
1382 }
1383 }
1384
1385
1386 protected void testAddingNamespace() throws Exception {
1387 testAddingNamespace(this);
1388 }
1389
1390
1391 protected void testAddingNamespace(Failable failable) throws Exception {
1392 selectFrameIframePortlet();
1393 waitAndCreateNew();
1394 waitForPageToLoad();
1395 assertElementPresentByXpath(SAVE_XPATH_2, "save button does not exist on the page");
1396
1397
1398 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Adding PEANUTS");
1399 waitAndTypeByXpath("//*[@id='document.documentHeader.explanation']", "I want to add PEANUTS to test KIM");
1400 waitAndTypeByXpath(DOC_CODE_XPATH, "PEANUTS");
1401 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", "The Peanuts Gang");
1402 checkByXpath("//input[@id='document.newMaintainableObject.active']");
1403 waitAndClickByXpath(SAVE_XPATH_2);
1404 waitForPageToLoad();
1405 checkForIncidentReport();
1406 assertDocumentStatusSaved();
1407
1408
1409 SeleneseTestBase.assertEquals(DOC_STATUS_SAVED, driver.findElement(By.xpath(
1410 "//table[@class='headerinfo']/tbody/tr[1]/td[2]")).getText());
1411 SeleneseTestBase.assertEquals("admin", driver.findElement(By.xpath(
1412 "//table[@class='headerinfo']/tbody/tr[2]/td[1]/a")).getText());
1413 }
1414
1415 protected void assertDocumentStatusSaved() {
1416 assertElementPresentByXpath(SAVE_SUCCESSFUL_XPATH,
1417 "Document is not saved successfully");
1418 }
1419
1420 protected void testAddingBrownGroup() throws Exception {
1421 selectFrameIframePortlet();
1422 waitAndCreateNew();
1423 waitForPageToLoad();
1424 String docId = waitForDocId();
1425
1426
1427 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Brown Group");
1428 waitAndTypeByName("document.documentHeader.explanation", "I want to add Brown Group to test KIM");
1429 selectOptionByName("document.groupNamespace", "KR-IDM");
1430 waitForPageToLoad();
1431 String groupName = "BrownGroup " + ITUtil.createUniqueDtsPlusTwoRandomChars();
1432 waitAndTypeByName("document.groupName", groupName);
1433 checkByName("document.active");
1434 waitAndClickByXpath(SAVE_XPATH_2);
1435 waitForPageToLoad();
1436 assertElementPresentByXpath(SAVE_SUCCESSFUL_XPATH,"Document is not saved successfully");
1437 checkForIncidentReport();
1438
1439
1440 SeleneseTestBase.assertEquals(DOC_STATUS_SAVED, driver.findElement(By.xpath("//table[@class='headerinfo']/tbody/tr[1]/td[2]")).getText());
1441 SeleneseTestBase.assertEquals("admin", driver.findElement(By.xpath("//table[@class='headerinfo']/tbody/tr[2]/td[1]/a")).getText());
1442 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalId:member.memberId,principalName:member.memberName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchorAssignees");
1443 waitForPageToLoad();
1444 waitAndClickSearch();
1445 waitForPageToLoad();
1446 waitAndClickReturnValue();
1447 waitForPageToLoad();
1448 waitAndClickByName("methodToCall.addMember.anchorAssignees");
1449 waitForPageToLoad();
1450 waitAndClickSave();
1451 waitAndClickSubmit();
1452 waitForPageToLoad();
1453 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH,"Document is not submitted successfully");
1454 selectTopFrame();
1455 waitAndClickByLinkText("Administration");
1456 waitForPageToLoad();
1457 waitAndClickByLinkText("Group");
1458 waitForPageToLoad();
1459 selectFrameIframePortlet();
1460 waitAndTypeByName("name", groupName);
1461 waitAndClickSearch();
1462 isElementPresentByLinkText(groupName);
1463 }
1464
1465 protected void testAgendaEditRuleRefreshIT() throws Exception {
1466 selectFrameIframePortlet();
1467 waitAndClickByXpath("//div[@class='uif-boxLayout uif-horizontalBoxLayout clearfix']/button[1]"); // jiraAwareWaitAndClick("id=32");
1468 Thread.sleep(3000);
1469 waitAndClickByXpath("//a[@title='edit Agenda Definition with Agenda Id=T1000']",
1470 "Does user have edit permissions?");
1471 checkForIncidentReport("");
1472 Thread.sleep(3000);
1473 waitAndClickByXpath("//li/a[@class='agendaNode ruleNode']"); // jiraAwareWaitAndClick("//li[@id='473_node_0_parent_root']/a");
1474 waitAndClickByXpath("//li/a[@class='agendaNode logicNode whenTrueNode']");
1475 waitAndClickByLinkText("[-] collapse all");
1476
1477
1478 for (int i = 0; i < 6; i++) {
1479 for (int second = 0;; second++) {
1480 if (second >= waitSeconds)
1481 failableFail(TIMEOUT_MESSAGE);
1482 try {
1483 if (isElementPresent(".kr-refresh-button"))
1484 break;
1485 } catch (Exception e) {}
1486 Thread.sleep(1000);
1487 }
1488 waitAndClick("button.kr-refresh-button");
1489 }
1490 }
1491
1492 protected void testAttributeDefinitionLookUp() throws Exception {
1493 waitForPageToLoad();
1494 selectFrameIframePortlet();
1495 checkForIncidentReport("testAttributeDefinitionLookUp");
1496 waitAndClickByXpath("//button[contains(.,'earch')]");
1497 Thread.sleep(3000);
1498 waitForPageToLoad();
1499 driver.findElement(By.tagName("body")).getText().contains("Actions");
1500 waitAndClickByLinkText("1000");
1501 waitForPageToLoad();
1502 driver.findElement(By.tagName("body")).getText().contains("Attribute Inquiry");
1503 driver.findElement(By.tagName("body")).getText().contains("KRMS Attributes");
1504 driver.findElement(By.tagName("body")).getText().contains("Attribute Label");
1505 driver.findElement(By.tagName("body")).getText().contains("1000");
1506 driver.findElement(By.tagName("body")).getText().contains("peopleFlowId");
1507 driver.findElement(By.tagName("body")).getText().contains("KR-RULE");
1508 driver.findElement(By.tagName("body")).getText().contains("PeopleFlow");
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522 passed();
1523 }
1524
1525 protected void testCancelConfirmation() throws InterruptedException {
1526 waitAndCancelConfirmation();
1527 passed();
1528 }
1529
1530 protected void testConfigParamaterBlanketApprove() throws Exception {
1531 selectFrameIframePortlet();
1532 waitAndCreateNew();
1533 String docId = waitForDocId();
1534 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Parameter ");
1535 assertBlanketApproveButtonsPresent();
1536 SeleneseTestBase.assertEquals("", getTextByName(CANCEL_NAME));
1537 selectByXpath("//select[@id='document.newMaintainableObject.namespaceCode']", "KR-NS - Kuali Nervous System");
1538 String componentLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.coreservice.impl.component.ComponentBo!!).(((code:document.newMaintainableObject.componentCode,namespaceCode:document.newMaintainableObject.namespaceCode,))).((`document.newMaintainableObject.componentCode:code,document.newMaintainableObject.namespaceCode:namespaceCode,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
1539 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
1540 waitAndClickByXpath(componentLookUp);
1541 waitAndClickSearch();
1542 waitAndClickReturnValue();
1543 String dtsTwo = ITUtil.createUniqueDtsPlusTwoRandomChars();
1544 String parameterName = "ValidationTestParameter" + dtsTwo;
1545 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", parameterName);
1546 waitAndTypeByXpath("//textarea[@id='document.newMaintainableObject.description']",
1547 "Validation Test Parameter Description" + dtsTwo);
1548 selectByXpath("//select[@id='document.newMaintainableObject.parameterTypeCode']", "Document Validation");
1549 waitAndClickByXpath("//input[@id='document.newMaintainableObject.evaluationOperatorCodeAllowed']");
1550 waitForPageToLoad();
1551 blanketApproveTest();
1552 assertDocFinal(docId);
1553 }
1554
1555 protected void testCreateNewAgenda() throws Exception {
1556 selectFrameIframePortlet();
1557 selectByName("document.newMaintainableObject.dataObject.namespace", "Kuali Rules Test");
1558 String agendaName = "Agenda Date :" + Calendar.getInstance().getTime().toString();
1559 waitAndTypeByName("document.newMaintainableObject.dataObject.agenda.name", "Agenda " + agendaName);
1560 waitAndTypeByName("document.newMaintainableObject.dataObject.contextName", "Context1");
1561 fireEvent("document.newMaintainableObject.dataObject.contextName", "blur");
1562 fireEvent("document.newMaintainableObject.dataObject.contextName", "focus");
1563 waitForElementPresentByName("document.newMaintainableObject.dataObject.agenda.typeId");
1564 selectByName("document.newMaintainableObject.dataObject.agenda.typeId", "Campus Agenda");
1565 waitForElementPresentByName("document.newMaintainableObject.dataObject.customAttributesMap[Campus]");
1566 waitAndTypeByName("document.newMaintainableObject.dataObject.customAttributesMap[Campus]", "BL");
1567 waitAndClickByXpath("//div[2]/button");
1568 waitForPageToLoad();
1569 waitAndClickByXpath("//div[2]/button[3]");
1570 waitForPageToLoad();
1571 selectTopFrame();
1572 waitAndClickByXpath("(//input[@name='imageField'])[2]");
1573 passed();
1574 }
1575
1576 protected void testCreateDocType() throws Exception {
1577 selectFrameIframePortlet();
1578 waitAndCreateNew();
1579 assertElementPresentByXpath("//*[@name='methodToCall.route' and @alt='submit']","save button does not exist on the page");
1580
1581
1582
1583 String docId = waitForDocId();
1584 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Creating new Document Type");
1585 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,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
1586 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
1587 waitAndClickByXpath(parentDocType);
1588 waitForPageToLoad();
1589 Thread.sleep(2000);
1590 waitAndClickSearch();
1591 waitForPageToLoad();
1592 waitAndClickReturnValue();
1593 String docTypeName = "TestDocType" + ITUtil.createUniqueDtsPlusTwoRandomChars();
1594 waitForElementPresentByXpath("//input[@id='document.newMaintainableObject.name']");
1595 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", docTypeName);
1596 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.unresolvedDocHandlerUrl']","${kr.url}/maintenance.do?methodToCall=docHandler");
1597
1598
1599 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.label']", "TestDocument Label");
1600 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.unresolvedHelpDefinitionUrl']","default.htm?turl=WordDocuments%2Fdocumenttype.htm");
1601 waitAndClickByXpath("//*[@name='methodToCall.route' and @alt='submit']");
1602 checkForIncidentReport();
1603 waitForPageToLoad();
1604 driver.switchTo().defaultContent();
1605 waitAndClickDocSearchTitle();
1606 waitForPageToLoad();
1607 selectFrameIframePortlet();
1608 waitAndClickSearch();
1609 Thread.sleep(2000);
1610 SeleneseTestBase.assertEquals(docId, driver.findElement(By.xpath(DOC_ID_XPATH_2)).getText());
1611 }
1612
1613 protected void testCreateNewCancel() throws Exception {
1614 selectFrameIframePortlet();
1615 waitAndCreateNew();
1616 testCancelConfirmation();
1617 }
1618
1619 protected List<String> testCreateNewParameter(String docId, String parameterName) throws Exception {
1620 waitForPageToLoad();
1621 docId = waitForDocId();
1622
1623 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Parameter");
1624 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW");
1625 waitAndTypeByName("document.newMaintainableObject.componentCode", "ActionList");
1626 waitAndTypeByName("document.newMaintainableObject.applicationId", "KUALI");
1627 parameterName = "TestIndicator" + ITUtil.createUniqueDtsPlusTwoRandomChars();
1628 waitAndTypeByName("document.newMaintainableObject.name", parameterName);
1629 waitAndTypeByName("document.newMaintainableObject.value", "Y");
1630 waitAndTypeByName("document.newMaintainableObject.description", "for testing");
1631 selectOptionByName("document.newMaintainableObject.parameterTypeCode", "HELP");
1632 waitAndClickByXpath("//input[@name='document.newMaintainableObject.evaluationOperatorCode' and @value='A']");
1633 waitAndClickSave();
1634 waitAndClickSubmit();
1635 waitForPageToLoad();
1636 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH,"Document is not submitted successfully");
1637 selectTopFrame();
1638 waitAndClickDocSearchTitle();
1639 waitForPageToLoad();
1640 selectFrameIframePortlet();
1641 waitAndClickSearch();
1642 Thread.sleep(2000);
1643 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
1644 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
1645 selectTopFrame();
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> testCreateNewParameterType(String docId, String parameterType, String parameterCode)throws Exception {
1654 waitForPageToLoad();
1655 docId = waitForDocId();
1656
1657
1658 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Parameter Type");
1659 parameterCode = RandomStringUtils.randomAlphabetic(4).toLowerCase();
1660 waitAndTypeByName("document.newMaintainableObject.code", parameterCode);
1661 parameterType = "testing " + ITUtil.createUniqueDtsPlusTwoRandomChars();
1662 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
1663 waitAndClickSave();
1664 waitAndClickSubmit();
1665 waitForPageToLoad();
1666 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1667 selectTopFrame();
1668 waitAndClickDocSearchTitle();
1669 waitForPageToLoad();
1670 selectFrameIframePortlet();
1671 waitAndClickSearch();
1672 Thread.sleep(2000);
1673 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
1674 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
1675 selectTopFrame();
1676 List<String> params = new ArrayList<String>();
1677 params.add(docId);
1678 params.add(parameterType);
1679 params.add(parameterCode);
1680
1681 return params;
1682 }
1683
1684 protected void testCreateNewSearchReturnValueCancelConfirmation() throws InterruptedException, Exception {
1685 selectFrameIframePortlet();
1686 waitAndCreateNew();
1687 waitAndClickSearch2();
1688 waitAndClickReturnValue();
1689 waitAndCancelConfirmation();
1690 passed();
1691 }
1692
1693 protected List<String> testCopyParameter(String docId, String parameterName) throws Exception {
1694 selectFrameIframePortlet();
1695 waitAndClickCopy();
1696 waitForPageToLoad();
1697 docId = waitForDocId();
1698 waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Parameter");
1699 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW");
1700 waitAndTypeByName("document.newMaintainableObject.componentCode", "ActionList");
1701 waitAndTypeByName("document.newMaintainableObject.applicationId", "KUALI");
1702 parameterName = "TestIndicator" + ITUtil.createUniqueDtsPlusTwoRandomChars();
1703 waitAndTypeByName("document.newMaintainableObject.name", parameterName);
1704 waitAndClickSave();
1705 waitAndClickSubmit();
1706 waitForPageToLoad();
1707 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH,"Document is not submitted successfully");
1708 selectTopFrame();
1709 waitAndClickDocSearchTitle();
1710 waitForPageToLoad();
1711 selectFrameIframePortlet();
1712 waitAndClickSearch();
1713 Thread.sleep(2000);
1714 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
1715 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
1716 selectTopFrame();
1717 List<String> params = new ArrayList<String>();
1718 params.add(docId);
1719 params.add(parameterName);
1720
1721 return params;
1722 }
1723
1724 protected List<String> testCopyParameterType(String docId, String parameterType, String parameterCode) throws Exception {
1725 selectFrameIframePortlet();
1726 waitAndClickCopy();
1727 waitForPageToLoad();
1728 docId = waitForDocId();
1729 waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Parameter");
1730 parameterCode = RandomStringUtils.randomAlphabetic(4).toLowerCase();
1731 waitAndTypeByName("document.newMaintainableObject.code", parameterCode);
1732 clearTextByName("document.newMaintainableObject.name");
1733 parameterType = "testing " + ITUtil.createUniqueDtsPlusTwoRandomChars();
1734 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
1735 waitAndClickSave();
1736 waitAndClickSubmit();
1737 waitForPageToLoad();
1738 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1739 selectTopFrame();
1740 waitAndClickDocSearchTitle();
1741 waitForPageToLoad();
1742 selectFrameIframePortlet();
1743 waitAndClickSearch();
1744 Thread.sleep(2000);
1745 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
1746 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
1747 selectTopFrame();
1748 List<String> params = new ArrayList<String>();
1749 params.add(docId);
1750 params.add(parameterType);
1751 params.add(parameterCode);
1752
1753 return params;
1754 }
1755
1756
1757 protected void testDocTypeLookup() throws Exception {
1758 selectFrameIframePortlet();
1759 waitAndClickByXpath("//input[@title='Search Parent Name']");
1760 waitForPageToLoad();
1761 waitAndClickByXpath(SAVE_XPATH_3);
1762 waitAndClickByXpath("//table[@id='row']/tbody/tr[contains(td[3],'RiceDocument')]/td[1]/a");
1763 waitForPageToLoad();
1764 waitAndClickByXpath(SAVE_XPATH_3);
1765 SeleneseTestBase.assertEquals("RiceDocument", getTextByXpath("//table[@id='row']/tbody/tr/td[4]/a"));
1766 waitAndClickByName("methodToCall.clearValues");
1767 waitAndTypeByName("name", "Kuali*D");
1768 waitAndClickByXpath(SAVE_XPATH_3);
1769 assertElementPresentByXpath("//table[@id='row']/tbody/tr[contains(td[3], 'KualiDocument')]");
1770 String docIdOld = getTextByXpath("//table[@id='row']/tbody/tr[contains(td[3], 'KualiDocument')]/td[2]/a");
1771 waitAndClickByName("methodToCall.clearValues");
1772 waitAndTypeByName("label", "KualiDocument");
1773 waitAndClickByXpath(SAVE_XPATH_3);
1774 assertElementPresentByXpath("//table[@id='row']/tbody/tr[contains(td[5], 'KualiDocument')]");
1775 waitAndClickByName("methodToCall.clearValues");
1776 waitAndTypeByName("documentTypeId", docIdOld);
1777 waitAndClickByXpath(SAVE_XPATH_3);
1778 assertElementPresentByXpath("//table[@id='row']/tbody/tr[contains(td[2], '" + docIdOld + "')]");
1779 }
1780
1781
1782 protected List<String> testEditParameterType(String docId, String parameterType, String parameterCode) throws Exception {
1783 selectFrameIframePortlet();
1784 waitAndClickEdit();
1785 waitForPageToLoad();
1786 docId = waitForDocId();
1787 waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Parameter");
1788 clearTextByName("document.newMaintainableObject.name");
1789 parameterType = "testing " + ITUtil.createUniqueDtsPlusTwoRandomChars();
1790 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
1791 waitAndClickSave();
1792 waitAndClickSubmit();
1793 waitForPageToLoad();
1794 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1795 selectTopFrame();
1796 waitAndClickDocSearchTitle();
1797 waitForPageToLoad();
1798 selectFrameIframePortlet();
1799 waitAndClickSearch();
1800 Thread.sleep(2000);
1801 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
1802 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
1803 selectTopFrame();
1804 List<String> params = new ArrayList<String>();
1805 params.add(docId);
1806 params.add(parameterType);
1807 params.add(parameterCode);
1808
1809 return params;
1810 }
1811
1812 protected List<String> testEditParameter(String docId, String parameterName) throws Exception
1813 {
1814 selectFrameIframePortlet();
1815 waitAndClickEdit();
1816 waitForPageToLoad();
1817 docId = waitForDocId();
1818 waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Parameter");
1819 clearTextByName("document.newMaintainableObject.value");
1820 waitAndTypeByName("document.newMaintainableObject.value", "N");
1821 waitAndClickSave();
1822 waitAndClickSubmit();
1823 waitForPageToLoad();
1824 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
1825 selectTopFrame();
1826 waitAndClickDocSearchTitle();
1827 waitForPageToLoad();
1828 selectFrameIframePortlet();
1829 waitAndClickSearch();
1830 Thread.sleep(2000);
1831 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
1832 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
1833 selectTopFrame();
1834 List<String> params = new ArrayList<String>();
1835 params.add(docId);
1836 params.add(parameterName);
1837 return params;
1838 }
1839
1840 protected void testEditRouteRulesDelegation() throws Exception {
1841 waitForPageToLoad();
1842 Thread.sleep(3000);
1843 SeleneseTestBase.assertEquals("Kuali Portal Index", getTitle());
1844 selectFrameIframePortlet();
1845 waitAndClickSearch();
1846 waitForPageToLoad();
1847 Thread.sleep(3000);
1848 waitAndClickEdit();
1849 waitForPageToLoad();
1850 Thread.sleep(3000);
1851 SeleneseTestBase.assertTrue(isElementPresentByName(CANCEL_NAME));
1852 waitAndClickCancel();
1853 waitForPageToLoad();
1854 Thread.sleep(3000);
1855 waitAndClickByName("methodToCall.processAnswer.button0");
1856 waitForPageToLoad();
1857 passed();
1858 }
1859
1860 protected void testFiscalOfficerInfoMaintenanceNew() throws Exception {
1861 selectFrameIframePortlet();
1862 checkForIncidentReport("", "https://jira.kuali.org/browse/KULRICE-7723 FiscalOfficerInfoMaintenanceNewIT.testUntitled need a better name and user permission error");
1863 String docId = getTextByXpath("//*[@id='u13_control']");
1864 waitAndTypeByXpath("//input[@name='document.documentHeader.documentDescription']", "New FO Doc");
1865 waitAndTypeByXpath("//input[@name='document.newMaintainableObject.dataObject.id']", "5");
1866 waitAndTypeByXpath("//input[@name='document.newMaintainableObject.dataObject.userName']", "Jigar");
1867 waitAndClickByXpath("//button[@id='usave']");
1868 Integer docIdInt = Integer.valueOf(docId).intValue();
1869 selectTopFrame();
1870 waitAndClickByXpath("//img[@alt='action list']");
1871 selectFrameIframePortlet();
1872
1873 if(isElementPresentByLinkText("Last")){
1874 waitAndClickByLinkText("Last");
1875 waitAndClickByLinkText(docIdInt.toString());
1876 } else {
1877 waitAndClickByLinkText(docIdInt.toString());
1878 }
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913 }
1914
1915 protected void testIdentityGroupBlanketApprove() throws Exception {
1916 selectFrameIframePortlet();
1917 waitAndCreateNew();
1918 String docId = waitForDocId();
1919 String dtsTwo = ITUtil.createUniqueDtsPlusTwoRandomChars();
1920 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Group " + dtsTwo);
1921 assertBlanketApproveButtonsPresent();
1922 selectByXpath("//select[@id='document.groupNamespace']", AdminTmplMthdSTNavBase.LABEL_KUALI_KUALI_SYSTEMS);
1923 waitAndTypeByXpath("//input[@id='document.groupName']", "Validation Test Group1 " + dtsTwo);
1924 waitAndClickByName(
1925 "methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalId:member.memberId,principalName:member.memberName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchorAssignees");
1926 waitAndClickSearch();
1927 waitAndClickReturnValue();
1928 waitAndClickByName("methodToCall.addMember.anchorAssignees");
1929 waitForPageToLoad();
1930 blanketApproveTest();
1931 assertDocFinal(docId);
1932 }
1933
1934 protected void testIdentityPermissionBlanketApprove() throws Exception {
1935 selectFrameIframePortlet();
1936 waitAndCreateNew();
1937 String docId = waitForDocId();
1938 String dtsTwo = ITUtil.createUniqueDtsPlusTwoRandomChars();
1939 waitAndTypeByXpath("//input[@name='document.documentHeader.documentDescription']",
1940 "Validation Test Permission " + dtsTwo);
1941 assertBlanketApproveButtonsPresent();
1942 waitAndTypeByXpath("//input[@name='document.documentHeader.organizationDocumentNumber']", "10012");
1943 selectByXpath("//select[@name='document.newMaintainableObject.namespaceCode']",
1944 AdminTmplMthdSTNavBase.LABEL_KUALI_KUALI_SYSTEMS);
1945 selectByXpath("//select[@name='document.newMaintainableObject.templateId']",
1946 AdminTmplMthdSTNavBase.LABEL_KUALI_DEFAULT);
1947 waitAndTypeByXpath("//input[@name='document.newMaintainableObject.name']",
1948 "ValidationTestPermission" + dtsTwo);
1949 blanketApproveTest();
1950 assertDocFinal(docId);
1951 }
1952
1953 protected void testIdentityPersonBlanketApprove() throws Exception {
1954 selectFrameIframePortlet();
1955 waitAndCreateNew();
1956 String docId = waitForDocId();
1957 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Person");
1958 assertBlanketApproveButtonsPresent();
1959 waitAndTypeByXpath("//input[@id='document.principalName']", "principal" + RandomStringUtils.randomAlphabetic(3).toLowerCase());
1960 selectByName("newAffln.affiliationTypeCode", "Affiliate");
1961 selectByName("newAffln.campusCode", "BX - BLGTN OFF CAMPUS");
1962 selectByName("newAffln.campusCode", "BL - BLOOMINGTON");
1963 assertElementPresentByName("newAffln.dflt");
1964 waitAndClickByName("newAffln.dflt");
1965 waitAndClickByName("methodToCall.addAffln.anchor");
1966 waitAndClickByName("methodToCall.toggleTab.tabContact");
1967 selectByName("newName.namePrefix", "Mr");
1968 waitAndTypeByName("newName.firstName", "First");
1969 waitAndTypeByName("newName.lastName", "Last");
1970 selectByName("newName.nameSuffix", "Mr");
1971 waitAndClickByName("newName.dflt");
1972 waitAndClickByName("methodToCall.addName.anchor");
1973 waitForPageToLoad();
1974 blanketApproveTest();
1975 assertDocFinal(docId);
1976 }
1977
1978 protected void testIdentityResponsibilityBlanketApprove() throws Exception {
1979 selectFrameIframePortlet();
1980 waitAndCreateNew();
1981 String docId = waitForDocId();
1982 String dtsTwo = ITUtil.createUniqueDtsPlusTwoRandomChars();
1983 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Responsibility " + dtsTwo);
1984 assertBlanketApproveButtonsPresent();
1985 selectByXpath("//select[@id='document.newMaintainableObject.namespaceCode']",
1986 AdminTmplMthdSTNavBase.LABEL_KUALI_KUALI_SYSTEMS);
1987 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']",
1988 "Validation Test Responsibility " + dtsTwo);
1989 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.documentTypeName']", "Test " + dtsTwo);
1990 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.routeNodeName']", "Test " + dtsTwo);
1991 waitAndClickByXpath("//input[@id='document.newMaintainableObject.actionDetailsAtRoleMemberLevel']");
1992 waitAndClickByXpath("//input[@id='document.newMaintainableObject.required']");
1993 blanketApproveTest();
1994 assertDocFinal(docId);
1995 }
1996
1997 protected void testIdentityRoleBlanketApprove() throws Exception {
1998 selectFrameIframePortlet();
1999 waitAndCreateNew();
2000 waitAndClickByXpath(SEARCH_XPATH, "No search button to click.");
2001 waitAndClickByLinkText(RETURN_VALUE_LINK_TEXT, "No return value link");
2002 String docId = waitForDocId();
2003 String dtsTwo = ITUtil.createUniqueDtsPlusTwoRandomChars();
2004 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Role " + dtsTwo);
2005 assertBlanketApproveButtonsPresent();
2006 selectByXpath("//select[@id='document.roleNamespace']", AdminTmplMthdSTNavBase.LABEL_KUALI_KUALI_SYSTEMS);
2007 waitAndTypeByXpath("//input[@id='document.roleName']", "Validation Test Role " + dtsTwo,
2008 "No Role Name input to type in.");
2009 waitAndClickByName(
2010 "methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalId:member.memberId,principalName:member.memberName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchorAssignees");
2011 waitAndClickByXpath(SEARCH_XPATH, "No search button to click.");
2012 waitAndClickByLinkText(RETURN_VALUE_LINK_TEXT, "No return value link");
2013 waitAndClickByName("methodToCall.addMember.anchorAssignees");
2014 waitForPageToLoad();
2015 blanketApproveTest();
2016 assertDocFinal(docId);
2017 }
2018
2019 protected void testLocationCampusBlanketApprove() throws Exception {
2020 selectFrameIframePortlet();
2021 waitAndCreateNew();
2022 String docId = waitForDocId();
2023 String twoLetters = RandomStringUtils.randomAlphabetic(2);
2024 waitAndTypeByName("document.documentHeader.documentDescription", "Validation Test Campus " + twoLetters);
2025 assertBlanketApproveButtonsPresent();
2026 waitAndTypeByName("document.newMaintainableObject.code", RandomStringUtils.randomAlphabetic(2));
2027 waitAndTypeByName("document.newMaintainableObject.name", "Validation Test Campus" + ITUtil.createUniqueDtsPlusTwoRandomChars());
2028 waitAndTypeByName("document.newMaintainableObject.shortName", "VTC " + twoLetters);
2029 selectByName("document.newMaintainableObject.campusTypeCode", "B - BOTH");
2030 blanketApproveTest();
2031 assertDocFinal(docId);
2032 }
2033
2034 protected void testLocationCountryBlanketApprove() throws InterruptedException {
2035 selectFrameIframePortlet();
2036 waitAndCreateNew();
2037 String docId = waitForDocId();
2038 assertBlanketApproveButtonsPresent();
2039 String twoUpperCaseLetters = RandomStringUtils.randomAlphabetic(2).toUpperCase();
2040 String countryName = "Validation Test Country " + ITUtil.DTS + " " + twoUpperCaseLetters;
2041 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, countryName);
2042 waitAndTypeByXpath(DOC_CODE_XPATH, twoUpperCaseLetters);
2043 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", countryName);
2044 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.alternateCode']", "V" + twoUpperCaseLetters);
2045 blanketApproveTest();
2046 assertDocFinal(docId);
2047 }
2048
2049 protected void testLocationCountyBlanketApprove() throws Exception {
2050 selectFrameIframePortlet();
2051 waitAndCreateNew();
2052 String docId = waitForDocId();
2053 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test County");
2054 assertBlanketApproveButtonsPresent();
2055 String countryLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.country.CountryBo!!).(((code:document.newMaintainableObject.countryCode,))).((`document.newMaintainableObject.countryCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
2056 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
2057 waitAndClickByXpath(countryLookUp);
2058 waitAndTypeByName("code", "US");
2059 waitAndClickSearch();
2060 waitAndClickReturnValue();
2061 waitAndTypeByXpath(DOC_CODE_XPATH, RandomStringUtils.randomAlphabetic(2).toUpperCase());
2062 String stateLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.state.StateBo!!).(((countryCode:document.newMaintainableObject.countryCode,code:document.newMaintainableObject.stateCode,))).((`document.newMaintainableObject.countryCode:countryCode,document.newMaintainableObject.stateCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
2063 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
2064 waitAndClickByXpath(stateLookUp);
2065 waitAndTypeByName("code", RandomStringUtils.randomAlphabetic(2));
2066 waitAndClickSearch();
2067 waitAndClickReturnValue();
2068 String countyName = "Validation Test County" + ITUtil.createUniqueDtsPlusTwoRandomChars();
2069 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", countyName);
2070 waitAndClickByXpath("//input[@id='document.newMaintainableObject.active']");
2071 blanketApproveTest();
2072 assertDocFinal(docId);
2073 }
2074
2075 protected void testLocationPostBlanketApprove() throws Exception {
2076 selectFrameIframePortlet();
2077 waitAndCreateNew();
2078 String docId = waitForDocId();
2079 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Postal Code");
2080 assertBlanketApproveButtonsPresent();
2081 String countryLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.country.CountryBo!!).(((code:document.newMaintainableObject.countryCode,))).((`document.newMaintainableObject.countryCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
2082 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
2083 waitAndClickByXpath(countryLookUp);
2084 waitAndTypeByName("code", "US");
2085 waitAndClickSearch();
2086 waitAndClickReturnValue();
2087 String code = RandomStringUtils.randomNumeric(5);
2088 waitAndTypeByXpath(DOC_CODE_XPATH, code);
2089 String stateLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.state.StateBo!!).(((countryCode:document.newMaintainableObject.countryCode,code:document.newMaintainableObject.stateCode,))).((`document.newMaintainableObject.countryCode:countryCode,document.newMaintainableObject.stateCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
2090 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
2091 waitAndClickByXpath(stateLookUp);
2092 waitAndClickSearch();
2093 waitAndClickByXpath("//table[@id='row']/tbody/tr[4]/td[1]/a");
2094 String cityName = "Validation Test Postal Code " + code;
2095 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.cityName']", cityName);
2096 blanketApproveTest();
2097 assertDocFinal(docId);
2098 }
2099
2100 protected void testLocationStateBlanketApprove() throws Exception {
2101 selectFrameIframePortlet();
2102 waitAndCreateNew();
2103 String docId = waitForDocId();
2104 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test State");
2105 assertBlanketApproveButtonsPresent();
2106
2107
2108 String countryLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.location.impl.country.CountryBo!!).(((code:document.newMaintainableObject.countryCode,))).((`document.newMaintainableObject.countryCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
2109 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
2110 waitAndClickByXpath(countryLookUp);
2111 waitAndClickSearch();
2112 waitAndClickReturnValue();
2113 String code = RandomStringUtils.randomAlphabetic(2).toUpperCase();
2114 waitAndTypeByXpath(DOC_CODE_XPATH, code);
2115 String state = "Validation Test State " + code;
2116 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", state);
2117 waitAndClickByXpath("//input[@id='document.newMaintainableObject.active']");
2118 blanketApproveTest();
2119 assertDocFinal(docId);
2120 }
2121
2122 protected void testLookUp() throws Exception {
2123 waitForPageToLoad();
2124 selectFrameIframePortlet();
2125
2126
2127 waitAndClick(By.xpath(SEARCH_XPATH_3));
2128 waitAndClickByLinkText(EDIT_LINK_TEXT, "edit button not present does user " + user + " have permission?");
2129 checkForIncidentReport("submit");
2130 assertTextPresent("ubmit");
2131 assertTextPresent("ave");
2132 assertTextPresent("pprove");
2133 assertTextPresent("lose");
2134 assertTextPresent("ancel");
2135 }
2136
2137 protected void performParameterInquiry(String parameterField) throws Exception {
2138 waitAndTypeByName("name", parameterField);
2139 waitAndClickSearch();
2140 isElementPresentByLinkText(parameterField);
2141 waitAndClickByLinkText(parameterField);
2142 waitForPageToLoad();
2143 Thread.sleep(2000);
2144 switchToWindow("Kuali :: Inquiry");
2145 Thread.sleep(2000);
2146 }
2147
2148 protected List<String> testLookUpParameterType(String docId, String parameterType, String parameterCode) throws Exception {
2149 performParameterInquiry(parameterType);
2150 SeleneseTestBase.assertEquals(parameterCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim().toLowerCase());
2151 SeleneseTestBase.assertEquals(parameterType, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim().toLowerCase());
2152 waitAndClickCloseWindow();
2153 switchToWindow("null");
2154 List<String> params = new ArrayList<String>();
2155 params.add(docId);
2156 params.add(parameterType);
2157 params.add(parameterCode);
2158
2159 return params;
2160 }
2161
2162 protected List<String> testLookUpParameter(String docId, String parameterName) throws Exception {
2163 performParameterInquiry(parameterName);
2164 SeleneseTestBase.assertEquals(parameterName, getTextByXpath(
2165 "//div[@class='tab-container']/table//span[@id='name.div']").trim());
2166 SeleneseTestBase.assertEquals("Y", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']")
2167 .trim());
2168 waitAndClickCloseWindow();
2169 switchToWindow("null");
2170 List<String> params = new ArrayList<String>();
2171 params.add(docId);
2172 params.add(parameterName);
2173
2174 return params;
2175 }
2176
2177 protected void testPeopleFlow() throws Exception {
2178 selectFrameIframePortlet();
2179
2180
2181
2182
2183 jGrowl("Create New");
2184 waitAndClickByLinkText("Create New");
2185
2186
2187
2188 waitForElementPresent("div[data-header_for='PeopleFlow-MaintenanceView'] div[data-label='Document Number'] > span");
2189 String docId = getText("div[data-header_for='PeopleFlow-MaintenanceView'] div[data-label='Document Number'] > span");
2190 jGrowlSticky("Doc Id is " + docId);
2191 driver.findElement(By.name("document.documentHeader.documentDescription")).clear();
2192 driver.findElement(By.name("document.documentHeader.documentDescription")).sendKeys("Description for Document");
2193 new Select(driver.findElement(By.name("document.newMaintainableObject.dataObject.namespaceCode"))).selectByVisibleText("KUALI - Kuali Systems");
2194 driver.findElement(By.name("document.newMaintainableObject.dataObject.name")).clear();
2195 driver.findElement(By.name("document.newMaintainableObject.dataObject.name")).sendKeys("Document Name" + ITUtil.DTS);
2196
2197 jGrowl("Add Member kr");
2198 driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
2199 driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).sendKeys("kr");
2200 driver.findElement(By.cssSelector("button[data-loadingmessage='Adding Line...']")).click();
2201 Thread.sleep(3000);
2202
2203 jGrowl("Add Member admin");
2204 driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
2205 driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).sendKeys("admin");
2206 driver.findElement(By.cssSelector("button[data-loadingmessage='Adding Line...']")).click();
2207 Thread.sleep(3000);
2208
2209 driver.findElement(By.cssSelector("div[data-parent='PeopleFlow-MaintenanceView'] > div.uif-footer button~button~button")).click();
2210 jGrowl("Blanket Approve");
2211 Thread.sleep(5000);
2212
2213
2214
2215
2216 driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
2217 driver.findElement(By.cssSelector("img[alt=\"doc search\"]")).click();
2218 Thread.sleep(5000);
2219 jGrowl("Document Search is " + docId + " present?");
2220 selectFrameIframePortlet();
2221 driver.findElement(By.cssSelector("td.infoline > input[name=\"methodToCall.search\"]")).click();
2222 Thread.sleep(5000);
2223 jGrowl("Is doc status final?");
2224 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, driver.findElement(By.xpath("//table[@id='row']/tbody/tr/td[4]")).getText());
2225 driver.switchTo().defaultContent();
2226 driver.findElement(By.name("imageField")).click();
2227 Thread.sleep(5000);
2228
2229 }
2230
2231 protected void testTermLookupAssertions() throws Exception {
2232 testLookUp();
2233 assertTextPresent("Term Parameters");
2234 waitAndClick(By.xpath(CANCEL2_XPATH));
2235 passed();
2236 }
2237
2238 protected void testTermSpecificationLookupAssertions() throws Exception {
2239 testLookUp();
2240 assertTextPresent("Context");
2241 waitAndClick(By.xpath(CANCEL2_XPATH));
2242 passed();
2243 }
2244
2245 protected List<String> testVerifyModifiedParameter(String docId, String parameterName) throws Exception {
2246 performParameterInquiry(parameterName);
2247 SeleneseTestBase.assertEquals(parameterName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
2248 SeleneseTestBase.assertEquals("N", getTextByXpath("//div[@class='tab-container']/table//span[@id='value.div']").trim());
2249 waitAndClickCloseWindow();
2250 switchToWindow("null");
2251 List<String> params = new ArrayList<String>();
2252 params.add(docId);
2253 params.add(parameterName);
2254
2255 return params;
2256 }
2257
2258 protected List<String> testVerifyCopyParameterType(String docId, String parameterType, String parameterCode) throws Exception
2259 {
2260 performParameterInquiry(parameterType);
2261 SeleneseTestBase.assertEquals(parameterType, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim().toLowerCase());
2262 waitAndClickCloseWindow();
2263 switchToWindow("null");
2264 List<String> params = new ArrayList<String>();
2265 params.add(docId);
2266 params.add(parameterType);
2267 params.add(parameterCode);
2268
2269 return params;
2270 }
2271
2272 protected List<String> testCreateNewPermission(String docId, String permissionName) throws Exception
2273 {
2274 waitForPageToLoad();
2275 Thread.sleep(2000);
2276 docId = waitForDocId();
2277 waitAndClickSave();
2278 waitForPageToLoad();
2279 assertElementPresentByXpath("//div[contains(.,'Document Description (Description) is a required field.')]/img[@alt='error']");
2280 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Adding Permission removeme");
2281 waitAndClickSubmit();
2282 waitForPageToLoad();
2283 assertElementPresentByXpath("//div[@class='error']");
2284 assertElementPresentByXpath("//div[contains(.,'Template (Template) is a required field.')]/img[@alt='error']");
2285 assertElementPresentByXpath("//div[contains(.,'Permission Namespace (Permission Namespace) is a required field.')]/img[@alt='error']");
2286 assertElementPresentByXpath("//div[contains(.,'Permission Name (Permission Name) is a required field.')]/img[@alt='error']");
2287 selectOptionByName("document.newMaintainableObject.templateId", "36");
2288 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-SYS");
2289 permissionName = "removeme" + ITUtil.createUniqueDtsPlusTwoRandomChars();
2290 waitAndTypeByName("document.newMaintainableObject.name", permissionName);
2291 waitAndTypeByName("document.newMaintainableObject.description", "namespaceCode=KR*");
2292 checkByName("document.newMaintainableObject.active");
2293 waitAndClickSave();
2294 waitForPageToLoad();
2295 assertElementPresentByXpath(SAVE_SUCCESSFUL_XPATH);
2296 SeleneseTestBase.assertEquals(DOC_STATUS_SAVED, getTextByXpath(DOC_STATUS_XPATH));
2297 waitAndClickSubmit();
2298 waitForPageToLoad();
2299 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH,"Document is not submitted successfully");
2300 SeleneseTestBase.assertEquals(DOC_STATUS_ENROUTE, getTextByXpath(DOC_STATUS_XPATH));
2301 List<String> params = new ArrayList<String>();
2302 params.add(docId);
2303 params.add(permissionName);
2304
2305 return params;
2306 }
2307
2308 protected List<String> testLookUpPermission(String docId, String permissionName) throws Exception
2309 {
2310 waitForPageToLoad();
2311 waitAndTypeByName("name", permissionName);
2312 waitAndClickSearch();
2313 isElementPresentByLinkText(permissionName);
2314 List<String> params = new ArrayList<String>();
2315 params.add(docId);
2316 params.add(permissionName);
2317
2318 return params;
2319 }
2320
2321 protected List<String> testEditPermission(String docId, String permissionName) throws Exception
2322 {
2323 waitAndClickEdit();
2324 waitForPageToLoad();
2325 Thread.sleep(2000);
2326 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Editing Permission removeme");
2327 uncheckByName("document.newMaintainableObject.active");
2328 waitAndClickSubmit();
2329 waitForPageToLoad();
2330 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
2331 List<String> params = new ArrayList<String>();
2332 params.add(docId);
2333 params.add(permissionName);
2334
2335 return params;
2336 }
2337
2338 protected List<String> testVerifyPermission(String docId, String permissionName) throws Exception
2339 {
2340 waitForPageToLoad();
2341 waitAndTypeByName("name", permissionName);
2342 waitAndClickByXpath("//input[@title='Active Indicator - No']");
2343 waitAndClickSearch();
2344 isElementPresentByLinkText(permissionName);
2345 List<String> params = new ArrayList<String>();
2346 params.add(docId);
2347 params.add(permissionName);
2348
2349 return params;
2350 }
2351
2352 protected List<String> testCreateNewPerson(String docId, String personName) throws Exception
2353 {
2354 waitForPageToLoad();
2355 docId = waitForDocId();
2356 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Adding Charlie Brown");
2357 waitAndTypeByName("document.documentHeader.explanation", "I want to add Charlie Brown to test KIM");
2358
2359
2360 personName = "cbrown" + ITUtil.createUniqueDtsPlusTwoRandomChars();
2361 waitAndTypeByName("document.principalName", personName);
2362 waitAndClickSave();
2363 waitForPageToLoad();
2364 assertElementPresentByXpath(SAVE_SUCCESSFUL_XPATH);
2365 SeleneseTestBase.assertEquals(DOC_STATUS_SAVED, getTextByXpath(DOC_STATUS_XPATH));
2366 waitAndClickSubmit();
2367 waitForPageToLoad();
2368 assertElementPresentByXpath("//div[contains(.,'At least one affiliation must be entered.')]/img[@alt='error']");
2369 assertElementPresentByXpath("//div[contains(.,'At least one name must be entered.')]/img[@alt='error']");
2370 selectOptionByName("newAffln.affiliationTypeCode", "STDNT");
2371 selectOptionByName("newAffln.campusCode", "BL");
2372 checkByName("newAffln.dflt");
2373 waitAndClickByName("methodToCall.addAffln.anchor");
2374 waitForPageToLoad();
2375 Thread.sleep(3000);
2376 selectOptionByName("newName.nameCode", "PRM");
2377 selectOptionByName("newName.namePrefix", "Mr");
2378 waitAndTypeByName("newName.firstName", "Charlie");
2379 waitAndTypeByName("newName.lastName", "Brown");
2380 checkByName("newName.dflt");
2381 waitAndClickByName("methodToCall.addName.anchor");
2382 waitForPageToLoad();
2383 waitAndClickSubmit();
2384 waitForPageToLoad();
2385 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, "Document is not submitted successfully");
2386 SeleneseTestBase.assertEquals(DOC_STATUS_ENROUTE, getTextByXpath(DOC_STATUS_XPATH));
2387 List<String> params = new ArrayList<String>();
2388 params.add(docId);
2389 params.add(personName);
2390
2391 return params;
2392 }
2393
2394 protected List<String> testLookUpPerson(String docId, String personName) throws Exception
2395 {
2396 waitForPageToLoad();
2397 waitAndTypeByName("principalName", personName);
2398 waitAndClickSearch();
2399 isElementPresentByLinkText(personName);
2400 waitAndClickByName("methodToCall.clearValues");
2401 waitAndTypeByName("firstName", "Charlie");
2402 waitAndClickSearch();
2403 isElementPresentByLinkText(personName);
2404 waitAndClickByName("methodToCall.clearValues");
2405 waitAndTypeByName("lastName", "Brown");
2406 waitAndClickSearch();
2407 isElementPresentByLinkText(personName);
2408 waitAndClickByName("methodToCall.clearValues");
2409 waitAndTypeByName("campusCode", "BL");
2410 waitAndClickSearch();
2411 isElementPresentByLinkText(personName);
2412 List<String> params = new ArrayList<String>();
2413 params.add(docId);
2414 params.add(personName);
2415
2416 return params;
2417 }
2418
2419 protected List<String> testVerifyPerson(String docId, String personName) throws Exception
2420 {
2421 waitAndClickByLinkText(personName);
2422 waitForPageToLoad();
2423 Thread.sleep(5000);
2424 switchToWindow("Kuali :: Person");
2425 Thread.sleep(2000);
2426 SeleneseTestBase.assertEquals(personName, getTextByXpath("//div[@class='tab-container']/table//tr[2]/td[1]/div").trim());
2427 SeleneseTestBase.assertEquals("BL - BLOOMINGTON", getTextByXpath("//div[@class='tab-container']/table[3]//tr[2]/td[2]/div").trim());
2428 SeleneseTestBase.assertEquals("Student", getTextByXpath("//select/option[@selected]").trim());
2429 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Overview']");
2430 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Contact']");
2431 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Privacy Preferences']");
2432 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Membership']");
2433 waitAndClickByName("methodToCall.showAllTabs");
2434 Thread.sleep(3000);
2435 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Overview']");
2436 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Contact']");
2437 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Privacy Preferences']");
2438 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Membership']");
2439 waitAndClickByName("methodToCall.hideAllTabs");
2440 Thread.sleep(3000);
2441 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Overview']");
2442 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Contact']");
2443 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Privacy Preferences']");
2444 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Membership']");
2445 waitAndClickCloseWindow();
2446 switchToWindow("null");
2447 List<String> params = new ArrayList<String>();
2448 params.add(docId);
2449 params.add(personName);
2450
2451 return params;
2452 }
2453
2454 protected void testUifTooltip(String NAME_FIELD_1, String NAME_FIELD_2) throws Exception {
2455
2456 fireEvent(NAME_FIELD_1, "focus");
2457 fireMouseOverEventByName(NAME_FIELD_1);
2458
2459
2460 SeleneseTestBase.assertEquals("This tooltip is triggered by focus or and mouse over.", getText(
2461 "td.jquerybubblepopup-innerHtml"));
2462
2463
2464 fireEvent(NAME_FIELD_1, "blur");
2465 SeleneseTestBase.assertFalse(isVisible("div.jquerybubblepopup.jquerybubblepopup-black") && isVisible(
2466 "td.jquerybubblepopup-innerHtml"));
2467 Thread.sleep(5000);
2468 fireEvent("field119", "focus");
2469
2470
2471 fireMouseOverEventByName(NAME_FIELD_2);
2472 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(.,\"This is a tool-tip with different position and tail options\")]"));
2473
2474
2475 waitAndTypeByName(NAME_FIELD_2, "a");
2476 Thread.sleep(5000);
2477 SeleneseTestBase.assertFalse(isVisibleByXpath(
2478 "//td[contains(.,\"This is a tool-tip with different position and tail options\")]"));
2479
2480
2481 waitAndTypeByName(NAME_FIELD_1, "1");
2482 fireEvent(NAME_FIELD_1, "blur");
2483 fireMouseOverEventByName(NAME_FIELD_1);
2484 Thread.sleep(10000);
2485 SeleneseTestBase.assertTrue("https://jira.kuali.org/browse/KULRICE-8141 Investigate why UifTooltipIT.testTooltip fails around jquerybubblepopup",
2486 isVisibleByXpath("//div[@class='jquerybubblepopup jquerybubblepopup-kr-error-cs']") &&
2487 !(isVisibleByXpath("//div[@class='jquerybubblepopup jquerybubblepopup-black']")));
2488
2489
2490 passed();
2491 }
2492
2493 protected void testValidCharsConstraintIT() throws Exception {
2494 assertFocusTypeBlurValidation("field50", new String[]{"12.333", "-123.33"}, new String[]{"123.33"});
2495 assertFocusTypeBlurValidation("field51", new String[]{"A"}, new String[]{"-123.33"});
2496
2497
2498 assertFocusTypeBlurValidation("field77", new String[]{"1.1"},new String[]{"12"});
2499 assertFocusTypeBlurValidation("field52", new String[]{"5551112222"},new String[]{"555-111-1111"});
2500 assertFocusTypeBlurValidation("field53", new String[]{"1ClassName.java"},new String[]{"ClassName.java"});
2501 assertFocusTypeBlurValidation("field54", new String[]{"aaaaa"},new String[]{"aaaaa@kuali.org"});
2502 assertFocusTypeBlurValidation("field84", new String[]{"aaaaa"},new String[]{"http://www.kuali.org"});
2503 assertFocusTypeBlurValidation("field55", new String[]{"023512"},new String[]{"022812"});
2504 assertFocusTypeBlurValidation("field75", new String[]{"02/35/12"},new String[]{"02/28/12"});
2505 assertFocusTypeBlurValidation("field82", new String[]{"13:22"},new String[]{"02:33"});
2506 assertFocusTypeBlurValidation("field83", new String[]{"25:22"},new String[]{"14:33"});
2507 assertFocusTypeBlurValidation("field57", new String[]{"0"},new String[]{"2020"});
2508 assertFocusTypeBlurValidation("field58", new String[]{"13"},new String[]{"12"});
2509 assertFocusTypeBlurValidation("field61", new String[]{"5555-444"},new String[]{"55555-4444"});
2510 assertFocusTypeBlurValidation("field62", new String[]{"aa5bb6_a"},new String[]{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"});
2511 assertFocusTypeBlurValidation("field63", new String[]{"fff555"},new String[]{"aa22 _/"});
2512 assertFocusTypeBlurValidation("field64", new String[]{"AABB55"},new String[]{"ABCDEFGHIJKLMNOPQRSTUVWXY,Z abcdefghijklmnopqrstuvwxy,z"});
2513 assertFocusTypeBlurValidation("field76", new String[]{"AA~BB%"},new String[]{"abcABC %$#@&<>\\{}[]*-+!=.()/\"\"',:;?"});
2514 assertFocusTypeBlurValidation("field65", new String[]{"sdfs$#$# dsffs"},new String[]{"sdfs$#$#sffs"});
2515 assertFocusTypeBlurValidation("field66", new String[]{"abcABCD"},new String[]{"ABCabc"});
2516 assertFocusTypeBlurValidation("field67", new String[]{"(111)B-(222)A"},new String[]{"(12345)-(67890)"});
2517 assertFocusTypeBlurValidation("field68", new String[]{"A.66"},new String[]{"a.4"});
2518 assertFocusTypeBlurValidation("field56", new String[]{"2020-06-02"},new String[]{"2020-06-02 03:30:30.22"});
2519 }
2520
2521 protected void assertFocusTypeBlurValidation(String field, String[] errorInputs, String[] validInputs) throws InterruptedException {
2522 assertFocusTypeBlurError(field, errorInputs);
2523 clearTextByName(field);
2524 assertFocusTypeBlurValid(field, validInputs);
2525 }
2526
2527 protected void testSubCollectionSize() throws Exception {
2528 checkForIncidentReport(COLLECTIONS_LINK_TEXT);
2529
2530
2531 waitAndClickByLinkText(COLLECTIONS_LINK_TEXT);
2532
2533
2534 for (int second = 0;; second++) {
2535 if (second >= waitSeconds)
2536 failableFail(TIMEOUT_MESSAGE);
2537 try {
2538 if (getText(SUB_COLLECTION_UIF_DISCLOSURE_SPAN_UIF_HEADER_TEXT_SPAN_XPATH).equals("SubCollection - (3 lines)"))
2539 {
2540 break;
2541 }
2542 } catch (Exception e) {}
2543 Thread.sleep(1000);
2544 }
2545
2546
2547 SeleneseTestBase.assertEquals("SubCollection - (3 lines)", getText(SUB_COLLECTION_UIF_DISCLOSURE_SPAN_UIF_HEADER_TEXT_SPAN_XPATH));
2548 SeleneseTestBase.assertEquals("SubCollection - (2 lines)", getTextByXpath(
2549 "//a[@id='subCollection1_line1_toggle']/span"));
2550 }
2551
2552 protected void testDefaultTestsTableLayout() throws Exception {
2553 assertTableLayout();
2554 waitAndTypeByName("newCollectionLines['list1'].field1", "asdf1");
2555 waitAndTypeByName("newCollectionLines['list1'].field2", "asdf2");
2556 waitAndTypeByName("newCollectionLines['list1'].field3", "asdf3");
2557 waitAndTypeByName("newCollectionLines['list1'].field4", "asdf4");
2558 waitAndClickByXpath("//button[contains(.,'add')]"); // the first button is the one we want
2559
2560 for (int second = 0;; second++) {
2561 if (second >= waitSeconds)
2562 failableFail(TIMEOUT_MESSAGE);
2563 try {
2564 if (getAttributeByName("newCollectionLines['list1'].field1", "value").equals(""))
2565 break;
2566 } catch (Exception e) {}
2567 Thread.sleep(1000);
2568 }
2569
2570 SeleneseTestBase.assertEquals("", getAttributeByName("newCollectionLines['list1'].field1", "value"));
2571 SeleneseTestBase.assertEquals("", getAttributeByName("newCollectionLines['list1'].field2", "value"));
2572 SeleneseTestBase.assertEquals("", getAttributeByName("newCollectionLines['list1'].field3", "value"));
2573 SeleneseTestBase.assertEquals("", getAttributeByName("newCollectionLines['list1'].field4", "value"));
2574 SeleneseTestBase.assertEquals("asdf1", getAttributeByName("list1[0].field1", "value"));
2575 SeleneseTestBase.assertEquals("asdf2", getAttributeByName("list1[0].field2", "value"));
2576 SeleneseTestBase.assertEquals("asdf3", getAttributeByName("list1[0].field3", "value"));
2577 SeleneseTestBase.assertEquals("asdf4", getAttributeByName("list1[0].field4", "value"));
2578 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@id='Collections-Base-TableLayout_disclosureContent']/div/table/tbody/tr[2]/td[6]/div/fieldset/div/div[@class='uif-boxLayout uif-horizontalBoxLayout clearfix']/button"));
2579 }
2580
2581
2582
2583 protected void testAddBlankLine() throws Exception {
2584 waitAndClickByLinkText("Add Blank Line");
2585 waitAndClickByXpath("//button[contains(.,'Add Line')]");
2586 Thread.sleep(3000);
2587 assertElementPresentByName("list1[0].field1");
2588 assertTableLayout();
2589 SeleneseTestBase.assertEquals("", getAttributeByName("list1[0].field1", "value"));
2590 SeleneseTestBase.assertEquals("", getAttributeByName("list1[0].field2", "value"));
2591 SeleneseTestBase.assertEquals("", getAttributeByName("list1[0].field3", "value"));
2592 SeleneseTestBase.assertEquals("", getAttributeByName("list1[0].field4", "value"));
2593 SeleneseTestBase.assertEquals("5", getAttributeByName("list1[1].field1", "value"));
2594 SeleneseTestBase.assertEquals("6", getAttributeByName("list1[1].field2", "value"));
2595 SeleneseTestBase.assertEquals("7", getAttributeByName("list1[1].field3", "value"));
2596 SeleneseTestBase.assertEquals("8", getAttributeByName("list1[1].field4", "value"));
2597 SeleneseTestBase.assertEquals("Total: 419", driver.findElement(By.xpath("//fieldset/div/div[2]/div[2]")).getText());
2598 waitAndTypeByName("list1[0].field1", "1");
2599 waitAndTypeByName("list1[0].field2", "1");
2600 waitAndTypeByName("list1[0].field3", "1");
2601 waitAndTypeByName("list1[0].field4", "1");
2602 SeleneseTestBase.assertEquals("Total: 420", driver.findElement(By.xpath("//fieldset/div/div[2]/div[2]")).getText());
2603 }
2604
2605
2606
2607
2608 protected void testActionColumnPlacement() throws Exception {
2609
2610
2611
2612 waitAndClickByLinkText("Column Sequence");
2613 Thread.sleep(2000);
2614
2615
2616
2617
2618 for (int second = 0;; second++) {
2619 if (second >= waitSeconds)
2620 failableFail(TIMEOUT_MESSAGE);
2621 try {
2622 if (isElementPresentByXpath("//tr[2]/td[6]/div/fieldset/div/div[2]/button"))
2623 break;
2624 } catch (Exception e) {}
2625 Thread.sleep(1000);
2626 }
2627 SeleneseTestBase.assertTrue(isElementPresentByXpath("//tr[2]/td[6]/div/fieldset/div/div[2]/button"));
2628
2629
2630
2631 for (int second = 0;; second++) {
2632 if (second >= waitSeconds)
2633 failableFail(TIMEOUT_MESSAGE);
2634 try {
2635 if (isElementPresentByXpath("//div[2]/div[2]/div[2]/table/tbody/tr[2]/td/div/fieldset/div/div[2]/button"))
2636 break;
2637 } catch (Exception e) {}
2638 Thread.sleep(1000);
2639 }
2640 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[2]/div[2]/div[2]/table/tbody/tr[2]/td/div/fieldset/div/div[2]/button"));
2641
2642
2643
2644 for (int second = 0;; second++) {
2645 if (second >= waitSeconds)
2646 failableFail(TIMEOUT_MESSAGE);
2647 try {
2648 if (isElementPresentByXpath("//tr[2]/td[3]/div/fieldset/div/div[2]/button"))
2649 break;
2650 } catch (Exception e) {}
2651 Thread.sleep(1000);
2652 }
2653 SeleneseTestBase.assertTrue(isElementPresentByXpath("//tr[2]/td[3]/div/fieldset/div/div[2]/button"));
2654 }
2655
2656 protected void testAddViaLightbox() throws Exception {
2657 waitAndClickByLinkText("Add Via Lightbox");
2658 SeleneseTestBase.assertEquals("Total: 419", driver.findElement(By.xpath("//fieldset/div/div[2]/div[2]")).getText());
2659 waitAndClickByXpath("//button[contains(.,'Add Line')]");
2660 Thread.sleep(3000);
2661 waitAndTypeByXpath("//form/div/table/tbody/tr/td/div/input", "1");
2662 waitAndTypeByXpath("//form/div/table/tbody/tr[2]/td/div/input", "1");
2663 waitAndTypeByXpath("//form/div/table/tbody/tr[3]/td/div/input", "1");
2664 waitAndTypeByXpath("//form/div/table/tbody/tr[4]/td/div/input", "1");
2665 waitAndClickByXpath("//button[@id='Collections-AddViaLightbox-TableTop_add']");
2666 Thread.sleep(3000);
2667 SeleneseTestBase.assertEquals("Total: 420", driver.findElement(By.xpath("//fieldset/div/div[2]/div[2]")).getText());
2668 }
2669
2670 protected void testColumnSequence() throws Exception {
2671 waitAndClickByLinkText("Column Sequence");
2672 Thread.sleep(3000);
2673 waitAndTypeByName("newCollectionLines['list1'].field1", "1");
2674 waitAndTypeByName("newCollectionLines['list1'].field2", "1");
2675 waitAndTypeByName("newCollectionLines['list1'].field3", "1");
2676 waitAndTypeByName("newCollectionLines['list1'].field4", "1");
2677 waitAndClick(By.id("Collections-ColumnSequence-TableDefault_add"));
2678 Thread.sleep(3000);
2679
2680
2681 testIfRowHasBeenAdded();
2682
2683
2684 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@id='Collections-ColumnSequence-TableDefault_disclosureContent']/div[@class='dataTables_wrapper']/table/tbody/tr[2]/td[6]/div/fieldset/div/div[@class='uif-boxLayout uif-horizontalBoxLayout clearfix']/button"));
2685 }
2686
2687 protected void testSequencerow() throws Exception {
2688 waitAndClickByLinkText("Save Row");
2689 Thread.sleep(3000);
2690 waitAndTypeByName("newCollectionLines['list1'].field1", "1");
2691 waitAndTypeByName("newCollectionLines['list1'].field2", "1");
2692 waitAndTypeByName("newCollectionLines['list1'].field3", "1");
2693 waitAndTypeByName("newCollectionLines['list1'].field4", "1");
2694 waitAndClickByXpath("//button[contains(.,'add')]");
2695 Thread.sleep(3000);
2696
2697
2698 testIfRowHasBeenAdded();
2699
2700
2701 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@id='Collections-SaveRow-Table_disclosureContent']/div[@class='dataTables_wrapper']/table/tbody/tr[2]/td[6]/div/fieldset/div/div[@class='uif-boxLayout uif-horizontalBoxLayout clearfix']/button"));
2702
2703 }
2704
2705 protected void testIfRowHasBeenAdded() throws Exception {
2706
2707 SeleneseTestBase.assertEquals("", getAttributeByName("newCollectionLines['list1'].field1", "value"));
2708 SeleneseTestBase.assertEquals("", getAttributeByName("newCollectionLines['list1'].field2", "value"));
2709 SeleneseTestBase.assertEquals("", getAttributeByName("newCollectionLines['list1'].field3", "value"));
2710 SeleneseTestBase.assertEquals("", getAttributeByName("newCollectionLines['list1'].field4", "value"));
2711 SeleneseTestBase.assertEquals("1", getAttributeByName("list1[0].field1", "value"));
2712 SeleneseTestBase.assertEquals("1", getAttributeByName("list1[0].field2", "value"));
2713 SeleneseTestBase.assertEquals("1", getAttributeByName("list1[0].field3", "value"));
2714 SeleneseTestBase.assertEquals("1", getAttributeByName("list1[0].field4", "value"));
2715 }
2716
2717
2718 protected void testCollectionTotalling() throws Exception {
2719
2720 waitForElementPresent("div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']");
2721 SeleneseTestBase.assertEquals("Total: 419", getText(
2722 "div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']"));
2723 clearText("div#Demo-CollectionTotaling-Section1 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section1] input[name='list1[0].field1']");
2724 waitAndType("div#Demo-CollectionTotaling-Section1 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section1] input[name='list1[0].field1']","10");
2725 waitAndClick("div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']");
2726 Thread.sleep(5000);
2727 SeleneseTestBase.assertEquals("Total: 424", getText(
2728 "div#Demo-CollectionTotaling-Section1 div[role='grid'] div[data-label='Total']"));
2729
2730
2731 SeleneseTestBase.assertEquals("Total: 419", getText(
2732 "div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']"));
2733 clearText("div#Demo-CollectionTotaling-Section2 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section2] input[name='list1[0].field1']");
2734 waitAndType("div#Demo-CollectionTotaling-Section2 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section2] input[name='list1[0].field1']","9");
2735 waitAndClick("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']");
2736 Thread.sleep(5000);
2737 SeleneseTestBase.assertEquals("Total: 423", getText(
2738 "div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']"));
2739
2740
2741 SeleneseTestBase.assertEquals("", getTextByXpath("//div[3]/div[3]/table/tfoot/tr/th[2]"));
2742
2743
2744 SeleneseTestBase.assertEquals("Total: 369", getTextByXpath(
2745 "//div[3]/div[3]/table/tfoot/tr/th[3]/div/fieldset/div/div[2]/div[2]"));
2746
2747
2748 SeleneseTestBase.assertEquals("Total:", getTextByXpath("//*[@id='u100213_span']"));
2749 SeleneseTestBase.assertEquals("419", getTextByXpath(
2750 "//div[4]/div[3]/table/tfoot/tr/th[2]/div/fieldset/div/div[2]/div[2]"));
2751
2752
2753 SeleneseTestBase.assertEquals("Total: 382", getTextByXpath("//div[2]/div/fieldset/div/div[2]/div[2]"));
2754 clearText("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']");
2755 waitAndType("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']","11");
2756 waitAndClick("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']");
2757 Thread.sleep(5000);
2758 SeleneseTestBase.assertEquals("Total: 385", getTextByXpath("//div[2]/div/fieldset/div/div[2]/div[2]"));
2759
2760
2761 clearText("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']");
2762 waitAndType("div#Demo-CollectionTotaling-Section6 > div[role='grid'] > table > tbody div[data-parent=Demo-CollectionTotaling-Section6] input[name='list1[0].field4']","15.25");
2763 waitAndClick("div#Demo-CollectionTotaling-Section2 div[role='grid'] div[data-label='Total']");
2764 Thread.sleep(5000);
2765 SeleneseTestBase.assertEquals("Page Average: 11.917", getTextByXpath("//div[2]/fieldset/div/div[2]/div"));
2766 }
2767
2768 protected void testConfigurationTestView(String idPrefix) throws Exception {
2769 waitForElementPresentByXpath("//span[@id='" + idPrefix + "TextInputField_label_span']");
2770
2771
2772 String styleValue = getAttributeByXpath("//span[@id='" + idPrefix + "TextInputField_label_span']", "style");
2773
2774
2775 SeleneseTestBase.assertTrue(idPrefix + "textInputField label does not contain expected style", styleValue.replace(" ", "").contains("color:red"));
2776
2777
2778 String refreshTextSelectLocator = "//select[@id='" + idPrefix + "RefreshTextField_control']";
2779 String[] options1 = getSelectOptionsByXpath(refreshTextSelectLocator);
2780 String dropDownSelectLocator = "//select[@id='" + idPrefix + "DropDown_control']";
2781 selectByXpath(dropDownSelectLocator, "Vegetables");
2782 Thread.sleep(3000);
2783
2784
2785 String[] options2 = getSelectOptionsByXpath(refreshTextSelectLocator);
2786
2787
2788 SeleneseTestBase.assertFalse(
2789 "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",
2790 options1[options1.length - 1].equalsIgnoreCase(options2[options2.length - 1]));
2791
2792
2793 selectByXpath(dropDownSelectLocator, "None");
2794 Thread.sleep(3000);
2795 SeleneseTestBase.assertEquals("true", getAttributeByXpath(refreshTextSelectLocator, "disabled"));
2796 }
2797
2798
2799
2800
2801 protected void confirmAddLineControlsPresent(String idPrefix, String addLineIdSuffix) {
2802 String[] addLineIds = {"StartTime", "StartTimeAmPm", "AllDay"};
2803
2804 for (String id : addLineIds) {
2805 String tagId = "//*[@id='" + idPrefix + id + addLineIdSuffix + "']";
2806 SeleneseTestBase.assertTrue("Did not find id " + tagId, isElementPresentByXpath(tagId));
2807 }
2808 }
2809
2810 protected void testAddLineWithSpecificTime(String idPrefix, String addLineIdSuffix) throws Exception {
2811 waitForElementPresentByXpath("//span[@id='" + idPrefix + "TextInputField_label_span']");
2812 confirmAddLineControlsPresent(idPrefix, addLineIdSuffix);
2813 String startTimeId = "//*[@id='" + idPrefix + "StartTime" + addLineIdSuffix + "']";
2814 String inputTime = "7:06";
2815 waitAndTypeByXpath(startTimeId, inputTime);
2816 String amPmSelectLocator = "//*[@id='" + idPrefix + "StartTimeAmPm" + addLineIdSuffix + "']";
2817 selectByXpath(amPmSelectLocator, "PM");
2818 SeleneseTestBase.assertEquals("PM", getAttributeByXpath(amPmSelectLocator, "value"));
2819 Thread.sleep(5000);
2820 waitAndClickByXpath("//button");
2821 Thread.sleep(5000);
2822
2823
2824 SeleneseTestBase.assertTrue("line (//input[@value='7:06'])is not present https://jira.kuali.org/browse/KULRICE-8162 Configuration Test View Time Info add line button doesn't addline",
2825 isElementPresentByXpath("//input[@value='7:06']"));
2826 }
2827
2828 protected void testAddLineWithAllDay(String idPrefix, String addLineIdSuffix) throws Exception {
2829 waitForElementPresentByXpath("//span[@id='" + idPrefix + "TextInputField_label_span']");
2830 confirmAddLineControlsPresent(idPrefix, addLineIdSuffix);
2831 String startTimeId = "//*[@id='" + idPrefix + "StartTime" + addLineIdSuffix + "']";
2832 String inputTime = "5:20";
2833 waitAndTypeByXpath(startTimeId, inputTime);
2834 String allDaySelector = "//*[@id='" + idPrefix + "AllDay" + addLineIdSuffix + "']";
2835 Thread.sleep(5000);
2836 waitAndClickByXpath(allDaySelector);
2837 Thread.sleep(5000);
2838 waitAndClick("div#ConfigurationTestView-ProgressiveRender-TimeInfoSection button");
2839 Thread.sleep(5000);
2840 }
2841
2842 protected void testAddLineAllDay(String idPrefix, String addLineIdSuffix) throws Exception {
2843 waitForElementPresentByXpath("//span[@id='" + idPrefix + "TextInputField_label_span']");
2844 confirmAddLineControlsPresent(idPrefix, addLineIdSuffix);
2845
2846
2847 String cssCountRows = "div#ConfigurationTestView-ProgressiveRender-TimeInfoSection.uif-group div#ConfigurationTestView-ProgressiveRender-TimeInfoSection_disclosureContent.uif-disclosureContent table tbody tr";
2848 int rowCount = (getCssCount(cssCountRows));
2849 String allDayId = "//*[@id='" + idPrefix + "AllDay" + addLineIdSuffix + "']";
2850 Thread.sleep(5000);
2851 waitAndClickByXpath(allDayId);
2852 waitAndClick("div#ConfigurationTestView-ProgressiveRender-TimeInfoSection button");
2853 Thread.sleep(5000);
2854
2855
2856 assertEquals("line was not added", rowCount + 1, (getCssCount(cssCountRows)));
2857 }
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884 protected void testCategoryLookUp() throws Exception {
2885 waitForPageToLoad();
2886 selectFrameIframePortlet();
2887 waitAndClickByXpath("//button[contains(.,'earch')]");
2888 Thread.sleep(3000);
2889 waitForPageToLoad();
2890 driver.findElement(By.tagName("body")).getText().contains("Actions");
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901 }
2902
2903 protected void testCreateSampleEDocLite() throws Exception {
2904 waitForPageToLoad();
2905 Thread.sleep(3000);
2906 SeleneseTestBase.assertEquals("Kuali Portal Index", getTitle());
2907 selectFrameIframePortlet();
2908 waitAndClickByXpath("//input[@name='methodToCall.search' and @alt='search']");
2909 waitForPageToLoad();
2910
2911
2912 waitAndClickByLinkText("Create Document");
2913 waitForPageToLoad();
2914 Thread.sleep(3000);
2915 String docId = getTextByXpath("//table/tbody/tr[4]/td[@class='datacell1']");
2916 waitAndTypeByName("userName", "Viral Chauhan");
2917 waitAndTypeByName("rqstDate", "12/03/2020");
2918 checkByName("fundedBy");
2919 waitAndTypeByName("addText", "Note Added.");
2920 waitAndClickByXpath("//td[@class='datacell']/div/img");
2921 waitForPageToLoad();
2922 waitAndClickByXpath("//input[@value='submit']");
2923 SeleneseTestBase.assertEquals(Boolean.FALSE,(Boolean) isElementPresentByXpath("//input[@value='submit']"));
2924 SeleneseTestBase.assertEquals(Boolean.FALSE, (Boolean) isElementPresentByXpath("//input[@value='save']"));
2925 SeleneseTestBase.assertEquals(Boolean.FALSE,(Boolean) isElementPresentByXpath("//input[@value='cancel']"));
2926 waitForPageToLoad();
2927 selectTopFrame();
2928 waitAndClickDocSearch();
2929 waitForPageToLoad();
2930 selectFrameIframePortlet();
2931 waitAndClickByXpath("//input[@name='methodToCall.search' and @alt='search']");
2932 waitForPageToLoad();
2933 isElementPresent(By.linkText(docId));
2934 }
2935
2936 protected void testTermLookUp() throws Exception {
2937 testLookUp();
2938 assertTextPresent("Term Parameters");
2939 waitAndClick(By.xpath(CANCEL2_XPATH));
2940 passed();
2941 }
2942
2943 protected void testWorkFlowRouteRulesBlanketApp() throws Exception {
2944 waitForPageToLoad();
2945 Thread.sleep(3000);
2946 SeleneseTestBase.assertEquals("Kuali Portal Index", getTitle());
2947 selectFrameIframePortlet();
2948
2949
2950 waitAndClickCreateNew();
2951 waitForPageToLoad();
2952
2953
2954 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:documentTypeName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
2955 waitForPageToLoad();
2956
2957
2958 waitAndTypeByName("name", "RoutingRuleDocument");
2959
2960
2961 waitAndClickSearch();
2962 waitForPageToLoad();
2963
2964
2965 waitAndClickReturnValue();
2966 waitForPageToLoad();
2967
2968
2969 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.bo.RuleTemplateBo!!).(((name:ruleTemplateName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
2970 waitForPageToLoad();
2971
2972
2973 waitAndTypeByName("name", "RuleRoutingTemplate");
2974
2975
2976 waitAndClickSearch();
2977 waitForPageToLoad();
2978
2979
2980 waitAndClickReturnValue();
2981 waitForPageToLoad();
2982
2983
2984 waitAndClickByName("methodToCall.createRule");
2985 waitForPageToLoad();
2986 String docId = waitForDocId();
2987 SeleneseTestBase.assertTrue(isElementPresentByName(CANCEL_NAME));
2988
2989
2990 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Test Routing Rule");
2991
2992
2993 waitAndClickByXpath("//input[@id='document.newMaintainableObject.forceAction']");
2994
2995
2996 waitAndTypeByXpath("//textarea[@id='document.newMaintainableObject.description']", "Test Routing Rule1");
2997
2998
2999 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.fieldValues(1321~docTypeFullName)']",
3000 "DocumentTypeDocument");
3001
3002
3003 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalName:document.newMaintainableObject.add.personResponsibilities.principalName,))).((`document.newMaintainableObject.add.personResponsibilities.principalName:principalName,`)).((<>)).(([])).((**)).((^^)).((&&)).((/personImpl/)).((~~)).(::::;"
3004 + getBaseUrlString() + "/kr/lookup.do;::::).anchor15");
3005 waitForPageToLoad();
3006
3007
3008 waitAndClickSearch();
3009 waitForPageToLoad();
3010
3011
3012 waitAndClickReturnValue();
3013 waitForPageToLoad();
3014
3015
3016 selectByXpath("//select[@id='document.newMaintainableObject.add.personResponsibilities.actionRequestedCd']",
3017 "ACKNOWLEDGE");
3018
3019
3020 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.add.personResponsibilities.priority']", "1");
3021
3022
3023 waitAndClickByName("methodToCall.addLine.personResponsibilities.(!!org.kuali.rice.kew.rule.PersonRuleResponsibility!!).(:::;15;:::).anchor15");
3024 waitForPageToLoad();
3025 checkForIncidentReport(BLANKET_APPROVE_NAME);
3026 waitAndClickByName(BLANKET_APPROVE_NAME);
3027 waitForPageToLoad();
3028 driver.switchTo().defaultContent();
3029 Thread.sleep(2000);
3030 waitAndClickDocSearch();
3031 waitForPageToLoad();
3032 SeleneseTestBase.assertEquals("Kuali Portal Index", getTitle());
3033 selectFrameIframePortlet();
3034 waitAndClickSearch();
3035 waitForPageToLoad();
3036 SeleneseTestBase.assertTrue(isElementPresent(By.linkText(docId)));
3037
3038 if (isElementPresent(By.linkText(docId))) {
3039 assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2), "https://jira.kuali.org/browse/KULRICE-9051 WorkFlow Route Rules Blanket Approval submit status results in Enroute, not Final");
3040 } else {
3041 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_2));
3042 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
3043 }
3044 }
3045
3046 protected void testCreateNewRRDTravelRequestDestRouting() throws Exception {
3047 selectFrameIframePortlet();
3048 waitAndClick("img[alt=\"create new\"]");
3049 waitForPageToLoad();
3050 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.RuleBaseValues!!).(((id:parentRuleId))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
3051 waitForPageToLoad();
3052 waitAndClickByXpath("//td[@class='infoline']/input[@name='methodToCall.search']");
3053 waitForPageToLoad();
3054 waitAndClick("a[title=\"return valueRule Id=1046 \"]");
3055 waitForPageToLoad();
3056 waitAndClickByName("parentResponsibilityId");
3057 waitAndClickByName("methodToCall.createDelegateRule");
3058 waitForPageToLoad();
3059 Thread.sleep(3000);
3060 waitAndClickCancel();
3061 waitForPageToLoad();
3062 waitAndClickByName("methodToCall.processAnswer.button0");
3063 waitForPageToLoad();
3064 driver.switchTo().defaultContent();
3065 waitAndClickByXpath("(//input[@name='imageField'])[2]");
3066 waitForPageToLoad();
3067 passed();
3068 }
3069
3070 protected void testWorkFlowRouteRulesCreateNew() throws Exception {
3071 waitForPageToLoad();
3072 Thread.sleep(5000);
3073 SeleneseTestBase.assertEquals("Kuali Portal Index", getTitle());
3074 selectFrameIframePortlet();
3075 waitAndClickCreateNew();
3076 waitForPageToLoad();
3077 Thread.sleep(3000);
3078 waitAndClickByName(CANCEL_NAME,"https://jira.kuali.org/browse/KULRICE-8161 Work Flow Route Rules cancel new yields 404 not found");
3079
3080
3081 waitForPageToLoad();
3082 Thread.sleep(3000);
3083 waitAndClickByName("methodToCall.processAnswer.button0",
3084 "https://jira.kuali.org/browse/KULRICE-7753 : WorkFlowRouteRulesIT cancel confirmation missing from create new Route Rules.");
3085 passed();
3086 }
3087
3088
3089
3090
3091
3092 protected void testWorkFlowRouteRulesEditRouteRules() throws Exception {
3093 waitForPageToLoad();
3094 SeleneseTestBase.assertEquals("Kuali Portal Index", getTitle());
3095 selectFrameIframePortlet();
3096 waitAndClickSearch();
3097 waitAndClickEdit();
3098 waitForPageToLoad();
3099 selectFrameIframePortlet();
3100 Thread.sleep(3000);
3101 waitAndClickCancel();
3102 waitForPageToLoad();
3103 Thread.sleep(3000);
3104 waitAndClickByName("methodToCall.processAnswer.button0");
3105 passed();
3106 }
3107
3108 protected String testCreateNewComponent(String componentName, String componentCode) throws Exception {
3109 return testCreateNewComponent(componentName, componentCode, "");
3110 }
3111
3112 protected String testCreateNewComponent(String componentName, String componentCode, String message) throws Exception {
3113 waitForPageToLoad();
3114 String docId = waitForDocId();
3115
3116
3117 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Component");
3118 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-IDM");
3119 waitAndTypeByName("document.newMaintainableObject.code", componentCode);
3120 waitAndTypeByName("document.newMaintainableObject.name", componentName);
3121 checkByName("document.newMaintainableObject.active");
3122 waitAndClickSave();
3123 waitAndClickSubmit();
3124 waitForPageToLoad();
3125 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH, CREATE_NEW_DOCUMENT_NOT_SUBMITTED_SUCCESSFULLY_MESSAGE_TEXT + message);
3126 selectTopFrame();
3127 waitAndClickDocSearchTitle();
3128 waitForPageToLoad();
3129 selectFrameIframePortlet();
3130 waitAndClickSearch();
3131 Thread.sleep(2000);
3132 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
3133 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
3134 selectTopFrame();
3135 return docId;
3136 }
3137
3138
3139 protected void testLookUpComponent(String docId, String componentName, String componentCode) throws Exception {
3140 selectFrameIframePortlet();
3141
3142 waitAndTypeByName("name", componentName);
3143 waitAndClickSearch();
3144 isElementPresentByLinkText(componentName);
3145 waitAndClickByLinkText(componentName);
3146 waitForPageToLoad();
3147 Thread.sleep(2000);
3148 switchToWindow("Kuali :: Inquiry");
3149 Thread.sleep(2000);
3150 SeleneseTestBase.assertEquals(componentName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
3151 SeleneseTestBase.assertEquals(componentCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim());
3152 waitAndClickCloseWindow();
3153 switchToWindow("null");
3154 }
3155
3156 protected void testEditComponent(String docId, String componentName, String componentCode) throws Exception {
3157 selectFrameIframePortlet();
3158 waitAndClickEdit();
3159 waitForPageToLoad();
3160 docId = waitForDocId();
3161 waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Component");
3162 clearTextByName("document.newMaintainableObject.name");
3163 waitAndTypeByName("document.newMaintainableObject.name", componentName);
3164 waitAndClickSave();
3165 waitAndClickSubmit();
3166 waitForPageToLoad();
3167 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH,"Document is not submitted successfully");
3168 selectTopFrame();
3169 waitAndClickDocSearchTitle();
3170 waitForPageToLoad();
3171 selectFrameIframePortlet();
3172 waitAndClickSearch();
3173 Thread.sleep(2000);
3174 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
3175 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
3176 selectTopFrame();
3177 }
3178
3179 protected void testCopyComponent(String docId, String componentName, String componentCode) throws Exception {
3180 selectFrameIframePortlet();
3181 waitAndClickCopy();
3182 waitForPageToLoad();
3183 docId = waitForDocId();
3184 waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Component");
3185 selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-IDM");
3186 waitAndTypeByName("document.newMaintainableObject.code", componentCode);
3187 clearTextByName("document.newMaintainableObject.name");
3188 waitAndTypeByName("document.newMaintainableObject.name", componentName);
3189 waitAndClickSave();
3190 waitAndClickSubmit();
3191 waitForPageToLoad();
3192 checkForDocError();
3193 assertElementPresentByXpath(DOC_SUBMIT_SUCCESS_MSG_XPATH,"Document is not submitted successfully");
3194 selectTopFrame();
3195 waitAndClickDocSearchTitle();
3196 waitForPageToLoad();
3197 selectFrameIframePortlet();
3198 waitAndClickSearch();
3199 Thread.sleep(2000);
3200 SeleneseTestBase.assertEquals(docId, getTextByXpath(DOC_ID_XPATH_3));
3201 SeleneseTestBase.assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
3202 selectTopFrame();
3203 }
3204
3205 protected void testVerifyCopyComponent(String docId, String componentName, String componentCode) throws Exception {
3206 selectFrameIframePortlet();
3207 waitAndTypeByName("name", componentName);
3208 waitAndClickSearch();
3209 isElementPresentByLinkText(componentName);
3210 waitAndClickByLinkText(componentName);
3211 waitForPageToLoad();
3212 Thread.sleep(2000);
3213 switchToWindow("Kuali :: Inquiry");
3214 Thread.sleep(2000);
3215 SeleneseTestBase.assertEquals(componentName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
3216 SeleneseTestBase.assertEquals(componentCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim());
3217 waitAndClickCloseWindow();
3218 switchToWindow("null");
3219 }
3220
3221
3222
3223
3224 protected void testPageHelp() throws Exception {
3225
3226 fireMouseOverEventByXpath("//h2/span[@class='uif-headerText-span']");
3227 SeleneseTestBase.assertEquals("Sample text for page help", getText("td.jquerybubblepopup-innerHtml"));
3228
3229
3230 waitAndClickByXpath("//input[@alt='Help for Help Page']");
3231 Thread.sleep(5000);
3232 switchToWindow("Kuali Foundation");
3233 Thread.sleep(5000);
3234 switchToWindow(CONFIGURATION_VIEW_WINDOW_TITLE);
3235 }
3236
3237
3238
3239
3240 protected void testTooltipHelp() throws Exception {
3241
3242 if (isElementPresentByXpath("//td[contains(text(),'Sample text for section help - tooltip help')]")) {
3243 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for section help - tooltip help')]"));
3244 }
3245
3246 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - label left')]")) {
3247 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label left')]"));
3248 }
3249
3250 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - label right')]")) {
3251 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label right')]"));
3252 }
3253
3254 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - label top')]")) {
3255 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label top')]"));
3256 }
3257
3258 if (isElementPresentByXpath("//td[contains(text(),'Sample text for standalone help widget tooltip which will never be rendered')]")) {
3259 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for standalone help widget tooltip which will never be rendered')]"));
3260 }
3261
3262 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip')]")) {
3263 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip')]"));
3264 }
3265
3266 if (isElementPresentByXpath("//td[contains(text(),'Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip')]")) {
3267 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip')]"));
3268 }
3269
3270 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - there is also an on-focus tooltip')]")) {
3271 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also an on-focus tooltip')]"));
3272 }
3273
3274 if (isElementPresentByXpath("//td[contains(text(),'Sample text for on-focus event tooltip')]")) {
3275 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for on-focus event tooltip')]"));
3276 }
3277
3278 if (isElementPresentByXpath("//td[contains(text(),'Sample text for check box help')]")) {
3279 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for check box help')]"));
3280 }
3281
3282
3283 fireMouseOverEventByXpath("//div[@id='ConfigurationTestView-Help-Section1']/div/h3[@class='uif-headerText']");
3284 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for section help - tooltip help')]"));
3285 String javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" + "element[0].style.display='none'";
3286 ((JavascriptExecutor) driver).executeScript(javascript);
3287 Thread.sleep(3000);
3288 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for section help - tooltip help')]"));
3289
3290
3291 SeleneseTestBase.assertFalse(isElementPresent("#ConfigurationTestView-Help-Section1 input.uif-helpImage"));
3292
3293
3294 fireMouseOverEventByXpath("//label[@id='field-label-left_label']");
3295 Thread.sleep(3000);
3296 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label left')]"));
3297 javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" +
3298 "element[1].style.display='none'";
3299 Thread.sleep(3000);
3300 ((JavascriptExecutor) driver).executeScript(javascript);
3301 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label left')]"));
3302
3303
3304 fireMouseOverEventByXpath("//label[@id='field-label-right_label']");
3305 Thread.sleep(3000);
3306 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label righ')]"));
3307 javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" +"element[2].style.display='none'";
3308 ((JavascriptExecutor) driver).executeScript(javascript);
3309 Thread.sleep(3000);
3310 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label righ')]"));
3311
3312
3313 fireMouseOverEventByXpath("//label[@id='field-label-top_label']");
3314 Thread.sleep(3000);
3315 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label top')]"));
3316 javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" + "element[3].style.display='none'";
3317 ((JavascriptExecutor) driver).executeScript(javascript);
3318 Thread.sleep(3000);
3319 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label top')]"));
3320
3321
3322 SeleneseTestBase.assertFalse(isElementPresentByXpath("//*[@id='standalone-help-not-rendered']"));
3323
3324
3325 fireMouseOverEventByXpath("//label[@id='override-tooltip_label']");
3326 Thread.sleep(3000);
3327 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip')]"));
3328 if (isElementPresentByXpath("//td[contains(text(),'Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip')]")) {
3329 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip')]"));
3330 }
3331 javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" + "element[4].style.display='none'";
3332 ((JavascriptExecutor) driver).executeScript(javascript);
3333 Thread.sleep(3000);
3334 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip')]"));
3335
3336
3337 fireMouseOverEventByXpath("//input[@id='on-focus-tooltip_control']");
3338 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for on-focus event tooltip')]"));
3339 fireMouseOverEventByXpath("//label[@id='on-focus-tooltip_label']");
3340 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also an on-focus tooltip')]"));
3341 javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" +"element[5].style.display='none'";
3342 ((JavascriptExecutor) driver).executeScript(javascript);
3343 Thread.sleep(3000);
3344 javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" + "element[6].style.display='none'";
3345 ((JavascriptExecutor) driver).executeScript(javascript);
3346 Thread.sleep(3000);
3347 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also an on-focus tooltip')]"));
3348 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for on-focus event tooltip')]"));
3349
3350
3351 fireMouseOverEventByXpath("//label[@id='checkbox_label']");
3352 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for check box help')]"));
3353 javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" + "element[7].style.display='none'";
3354 ((JavascriptExecutor) driver).executeScript(javascript);
3355 Thread.sleep(3000);
3356 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for check box help')]"));
3357 }
3358
3359
3360
3361
3362 protected void testDisplayOnlyTooltipHelp() throws Exception {
3363
3364 if (isElementPresentByXpath("//td[contains(text(),'Sample text for sub-section help')]")) {
3365 SeleneseTestBase.assertFalse(isVisible("//td[contains(text(),'Sample text for sub-section help')]"));
3366 }
3367
3368 if (isElementPresentByXpath("//td[contains(text(),'Sample text for read only field help')]")) {
3369 SeleneseTestBase.assertFalse(isVisible("//td[contains(text(),'Sample text for read only field help')]"));
3370 }
3371
3372
3373 fireMouseOverEventByXpath("//span[contains(text(),'Display only fields')]");
3374 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for sub-section help')]"));
3375 String javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" +
3376 "element[0].style.display='none'";
3377 ((JavascriptExecutor) driver).executeScript(javascript);
3378 SeleneseTestBase.assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for sub-section help')]"));
3379
3380
3381 fireMouseOverEventByXpath("//label[@for='display-field_control']");
3382 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for read only field help')]"));
3383 javascript="var element = document.getElementsByClassName('jquerybubblepopup jquerybubblepopup-black');" +
3384 "element[0].style.display='none'";
3385 ((JavascriptExecutor) driver).executeScript(javascript);
3386 }
3387
3388
3389
3390
3391 protected void testMissingTooltipHelp() throws Exception {
3392
3393 SeleneseTestBase.assertFalse(isElementPresentByXpath("//*[@class='jquerybubblepopup jquerybubblepopup-black']"));
3394
3395
3396 SeleneseTestBase.assertFalse(isElementPresent("#ConfigurationTestView-Help-Section2 input.uif-helpImage"));
3397
3398
3399 fireMouseOverEventByXpath("//div[@id='ConfigurationTestView-Help-Section2']/div");
3400 SeleneseTestBase.assertFalse(isElementPresentByXpath("//*[@class='jquerybubblepopup jquerybubblepopup-black']"));
3401 SeleneseTestBase.assertFalse(isElementPresentByXpath("//*[@class='jquerybubblepopup jquerybubblepopup-black']"));
3402
3403
3404 fireMouseOverEventByXpath("//label[@id='missing-tooltip-help_label']");
3405 SeleneseTestBase.assertFalse(isElementPresentByXpath("//*[@class='jquerybubblepopup jquerybubblepopup-black']"));
3406 SeleneseTestBase.assertFalse(isElementPresentByXpath("//*[@class='jquerybubblepopup jquerybubblepopup-black']"));
3407 }
3408
3409
3410
3411
3412
3413 protected void testExternalHelp2() throws Exception {
3414
3415 assertPopUpWindowUrl(By.cssSelector("input[title=\"Help for External Help\"]"), "HelpWindow", "http://www.kuali.org/?section");
3416
3417
3418 assertPopUpWindowUrl(By.xpath("//div[@id='field-label-left-external-help']/fieldset/input[@title='Help for Field Label']"), "HelpWindow",
3419 "http://www.kuali.org/?label_left");
3420
3421
3422 assertPopUpWindowUrl(By.xpath("//div[@id='field-label-right-external-help']/fieldset/input[@title='Help for Field Label']"), "HelpWindow",
3423 "http://www.kuali.org/?label_right");
3424
3425
3426 assertPopUpWindowUrl(By.xpath("//div[@id='field-label-top-external-help']/fieldset/input[@title='Help for Field Label']"), "HelpWindow",
3427 "http://www.kuali.org/?system_parm");
3428
3429
3430 assertPopUpWindowUrl(By.id("standalone-external-help"), "HelpWindow", "http://www.kuali.org/?widget_only");
3431 }
3432
3433
3434
3435
3436
3437 protected void testDisplayOnlyExternalHelp2() throws Exception {
3438
3439 assertPopUpWindowUrl(By.cssSelector("input[title=\"Help for Display only fields\"]"), "HelpWindow", "http://www.kuali.org/?sub_section");
3440
3441
3442 assertPopUpWindowUrl(By.xpath("//div[@id='display-field-external-help']/fieldset/input[@title='Help for Field Label']"), "HelpWindow",
3443 "http://www.kuali.org/?display_field");
3444 }
3445
3446
3447
3448
3449
3450 protected void testMissingExternalHelp2() throws Exception {
3451
3452 SeleneseTestBase.assertFalse(isElementPresent(By.cssSelector("input[title=\"Help for Missing External Help\"]")));
3453
3454
3455 SeleneseTestBase.assertFalse(isElementPresentByXpath("//div[@id='external-help-externalHelpUrl-empty']/*[@class='uif-helpImage']"));
3456
3457
3458 SeleneseTestBase.assertFalse(isElementPresentByXpath("//div[@id='external-help-helpdefinition-empty']/*[@class='uif-helpImage']"));
3459
3460
3461 SeleneseTestBase.assertFalse(isElementPresentByXpath("//div[@id='external-help-system-parm-missing']/*[@class='uif-helpImage']"));
3462
3463
3464 SeleneseTestBase.assertFalse(isElementPresentByXpath("//div[@id='standalone-external-help-missing']"));
3465 }
3466
3467 protected void testReferenceCampusTypeBlanketApprove() throws Exception {
3468 selectFrameIframePortlet();
3469 waitAndCreateNew();
3470 String docId = waitForDocId();
3471 assertBlanketApproveButtonsPresent();
3472 String dtsTwo = ITUtil.createUniqueDtsPlusTwoRandomCharsNot9Digits();
3473 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Campus Type " + dtsTwo);
3474 waitAndTypeByXpath(DOC_CODE_XPATH, RandomStringUtils.randomAlphabetic(1));
3475 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", "Indianapolis" + dtsTwo);
3476 int attemptCount = 1;
3477 while (hasDocError("same primary key already exists") && attemptCount < 25) {
3478 clearTextByXpath(DOC_CODE_XPATH);
3479 waitAndTypeByXpath(DOC_CODE_XPATH, Character.toString((char) ('A' + attemptCount++)));
3480 }
3481 blanketApproveTest();
3482 assertDocFinal(docId);
3483 }
3484
3485 protected void testSearchEditCancel() throws InterruptedException {
3486 selectFrameIframePortlet();
3487 waitAndClickSearch2();
3488 waitAndClickEdit();
3489 testCancelConfirmation();
3490 }
3491
3492 protected void testServerErrorsIT() throws Exception {
3493 waitAndClickByXpath("//button[contains(.,'Get Error Messages')]");
3494 waitForPageToLoad();
3495 Thread.sleep(5000);
3496 assertElementPresent("div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-errorMessageItem");
3497 waitIsVisibleByXpath("//div[@data-header_for='Demo-ValidationLayout-Section1']");
3498 assertElementPresentByXpath("//*[@data-messageitemfor='Demo-ValidationLayout-Section1' and @class='uif-errorMessageItem']");
3499 assertElementPresent("div[data-role=\"InputField\"] img[alt=\"Error\"]");
3500 assertElementPresentByXpath("//a[contains(.,'Section 1 Title')]");
3501 fireMouseOverEventByXpath("//a[contains(.,'Field 1')]");
3502 assertElementPresent(".uif-errorMessageItem-field");
3503 waitAndClickByXpath("//a[contains(.,'Field 1')]");
3504 Thread.sleep(2000);
3505 waitIsVisible(".jquerybubblepopup-innerHtml");
3506 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems");
3507 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
3508 waitAndTypeByName("field1", "");
3509 fireEvent("field1", "blur");
3510 fireEvent("field1", "focus");
3511 waitIsVisible(".jquerybubblepopup-innerHtml");
3512 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
3513 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems");
3514 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems .uif-errorMessageItem-field");
3515 waitAndTypeByName("field1", "t");
3516
3517 for (int second = 0;; second++) {
3518 if (second >= waitSeconds) {
3519 failableFail(TIMEOUT_MESSAGE);
3520 }
3521 try {
3522 if (!isElementPresent(".jquerybubblepopup-innerHtml > .uif-clientMessageItems")) {
3523 break;
3524 }
3525 } catch (Exception e) {}
3526 Thread.sleep(1000);
3527 }
3528
3529 waitIsVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-errorMessageItem-field");
3530 SeleneseTestBase.assertFalse(isElementPresent(".jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
3531 }
3532
3533 protected void testServerInfoIT() throws Exception {
3534 waitAndClickByXpath("//button[contains(.,'Get Info Messages')]");
3535 waitIsVisibleByXpath("//div[@data-messagesfor='Demo-ValidationLayout-SectionsPage']");
3536 SeleneseTestBase.assertTrue(isVisibleByXpath("//div[@data-messagesfor='Demo-ValidationLayout-SectionsPage']"));
3537 SeleneseTestBase.assertTrue(isElementPresent("div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-infoMessageItem"));
3538 SeleneseTestBase.assertTrue(isVisible("div[data-messagesfor=\"Demo-ValidationLayout-Section1\"]"));
3539 SeleneseTestBase.assertTrue(isElementPresent("div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] .uif-infoMessageItem"));
3540 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@data-role='InputField']//img[@alt='Information']"));
3541 fireMouseOverEventByXpath("//a[contains(.,'Field 1')]");
3542 SeleneseTestBase.assertTrue(isElementPresent(".uif-infoHighlight"));
3543 waitAndClickByXpath("//a[contains(.,'Field 1')]");
3544
3545 for (int second = 0;; second++) {
3546 if (second >= waitSeconds)
3547 failableFail(TIMEOUT_MESSAGE);
3548 try {
3549 if (isVisible(".jquerybubblepopup-innerHtml"))
3550 break;
3551 } catch (Exception e) {}
3552 Thread.sleep(1000);
3553 }
3554
3555 SeleneseTestBase.assertTrue(isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems"));
3556 SeleneseTestBase.assertTrue(isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
3557 waitAndTypeByName("field1", "");
3558 fireEvent("field1", "blur");
3559 fireEvent("field1", "focus");
3560
3561 for (int second = 0;; second++) {
3562 if (second >= waitSeconds)
3563 failableFail(TIMEOUT_MESSAGE);
3564 try {
3565 if (isVisible(".jquerybubblepopup-innerHtml"))
3566 break;
3567 } catch (Exception e) {}
3568 Thread.sleep(1000);
3569 }
3570
3571 SeleneseTestBase.assertTrue(isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
3572 for (int second = 0;; second++) {
3573 if (second >= waitSeconds)
3574 failableFail(TIMEOUT_MESSAGE);
3575 try {
3576 if (isVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems"))
3577 break;
3578 } catch (Exception e) {}
3579 Thread.sleep(1000);
3580 }
3581
3582 SeleneseTestBase.assertTrue(isVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems .uif-errorMessageItem-field"));
3583 waitAndTypeByName("field1", "b");
3584 fireEvent("field1", "blur");
3585 fireEvent("field1", "focus");
3586
3587 for (int second = 0;; second++) {
3588 if (second >= waitSeconds)
3589 failableFail(TIMEOUT_MESSAGE);
3590 try {
3591 if (!isElementPresent(".jquerybubblepopup-innerHtml > .uif-clientMessageItems"))
3592 break;
3593 } catch (Exception e) {}
3594 Thread.sleep(1000);
3595 }
3596
3597 fireEvent("field1", "blur");
3598 Thread.sleep(3000);
3599 SeleneseTestBase.assertTrue(!isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-infoMessageItem-field"));
3600 SeleneseTestBase.assertFalse(isElementPresent(".jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
3601 fireEvent("field1", "focus");
3602 clearTextByName("field1");
3603 fireEvent("field1", "blur");
3604 SeleneseTestBase.assertTrue(isElementPresent("div.uif-hasError"));
3605 SeleneseTestBase.assertTrue(isElementPresent("img[src*=\"error.png\"]"));
3606 }
3607
3608 protected void testServerWarningsIT() throws Exception {
3609 waitAndClickByXpath("//button[contains(.,'Get Warning Messages')]");
3610 waitForPageToLoad();
3611 Thread.sleep(3000);
3612 com.thoughtworks.selenium.SeleneseTestBase.assertTrue("div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] not visible",
3613 isVisible("div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"]"));
3614 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3615 "div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-warningMessageItem not present",
3616 isElementPresent("div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-warningMessageItem"));
3617 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3618 "div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] not visible", isVisible(
3619 "div[data-messagesfor=\"Demo-ValidationLayout-Section1\"]"));
3620 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3621 "div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] .uif-warningMessageItem not present",
3622 isElementPresent("div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] .uif-warningMessageItem"));
3623 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3624 "div[data-role=\"InputField\"] img[alt=\"Warning\"] not present", isElementPresent(
3625 "div[data-role=\"InputField\"] img[alt=\"Warning\"]"));
3626 fireMouseOverEvent(By.xpath("//a[contains(.,'Field 1')]"));
3627 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3628 ".uif-warningHighlight no present when //a[contains(.,'Field 1')] is moused over",
3629 isElementPresent(".uif-warningHighlight"));
3630 waitAndClickByXpath("//a[contains(.,'Field 1')]");
3631 waitForElementVisible(".jquerybubblepopup-innerHtml", " after click on //a[contains(.,'Field 1')]");
3632 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3633 ".jquerybubblepopup-innerHtml > .uif-serverMessageItems not visible", isVisible(
3634 ".jquerybubblepopup-innerHtml > .uif-serverMessageItems"));
3635 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3636 ".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field not visible",
3637 isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
3638 waitAndTypeByName("field1", "");
3639 fireEvent("field1", "blur");
3640 fireMouseOverEventByName("field1");
3641 waitForElementVisible(".jquerybubblepopup-innerHtml",
3642 " not visible after typing nothing in name=field1 then firing blur and focus events");
3643 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3644 ".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field not visible after typing nothing in name=field1 then firing blur and focus events",
3645 isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
3646 waitForElementVisible(".jquerybubblepopup-innerHtml> .uif-clientMessageItems",
3647 " not visible after typing nothing in name=field1 then firing blur and focus events");
3648 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3649 ".jquerybubblepopup-innerHtml > .uif-clientMessageItems .uif-errorMessageItem-field not visible after typing nothing in name=field1 then firing blur and focus events",
3650 isVisible(".jquerybubblepopup-innerHtml > .uif-clientMessageItems .uif-errorMessageItem-field"));
3651 waitAndTypeByName("field1", "b");
3652 fireEvent("field1", "blur");
3653 fireMouseOverEventByName("field1");
3654 waitForElementVisible(".jquerybubblepopup-innerHtml> .uif-serverMessageItems", "");
3655 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3656 ".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field not visible after typing b in name=field1 then firing blur and focus events",
3657 isVisible(".jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
3658 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(".jquerybubblepopup-innerHtml > .uif-clientMessageItems",
3659 !isElementPresent(
3660 ".jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
3661 clearTextByName("field1");
3662 fireEvent("field1", "blur");
3663 fireMouseOverEventByName("field1");
3664 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3665 ".uif-hasError is not present after typing nothing in name=field1 and then firing focus and blur events",
3666 isElementPresent(".uif-hasError"));
3667 com.thoughtworks.selenium.SeleneseTestBase.assertTrue(
3668 "img[src*=\"error.png\"] is not present after typing nothing in name=field1 and then firing focus and blur events",
3669 isElementPresent("img[src*=\"error.png\"]"));
3670 passed();
3671 }
3672
3673
3674
3675
3676 protected void testViewHelp() throws Exception {
3677
3678 fireMouseOverEventByXpath("//h1/span[@class='uif-headerText-span']");
3679 SeleneseTestBase.assertEquals("Sample text for view help", getText("td.jquerybubblepopup-innerHtml"));
3680
3681
3682 waitAndClickByXpath("//input[@alt='Help for Configuration Test View - Help']");
3683 Thread.sleep(5000);
3684 switchToWindow("Kuali Foundation");
3685 Thread.sleep(5000);
3686 switchToWindow(CONFIGURATION_VIEW_WINDOW_TITLE);
3687 }
3688
3689
3690
3691
3692 protected void testViewHelp2() throws Exception {
3693
3694 if (isElementPresentByXpath("//td[@class='jquerybubblepopup-innerHtml']")) {
3695 SeleneseTestBase.assertFalse(driver.findElement(By.cssSelector("td.jquerybubblepopup-innerHtml")).isDisplayed());
3696 }
3697
3698
3699 fireMouseOverEventByXpath("//h1/span[@class='uif-headerText-span']");
3700 Thread.sleep(2000);
3701 SeleneseTestBase.assertTrue(isVisibleByXpath("//td[contains(text(),'View help')]"));
3702 assertPopUpWindowUrl(By.cssSelector("input[title=\"Help for Configuration Test View\"]"), "HelpWindow", "http://www.kuali.org/");
3703 }
3704
3705 protected void testVerifyAddDeleteFiscalOfficerLegacy() throws Exception {
3706 selectFrameIframePortlet();
3707 checkForIncidentReport("testVerifyAddDeleteFiscalOfficerLegacy");
3708 waitAndTypeByName("document.documentHeader.documentDescription", ITUtil.createUniqueDtsPlusTwoRandomChars());
3709 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.fiscalOfficer.accounts'].number","1234567890");
3710 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.fiscalOfficer.accounts'].foId", "2");
3711 waitAndClickByXpath("//button[@data-loadingmessage='Adding Line...']");
3712 waitForElementPresentByName("document.newMaintainableObject.dataObject.fiscalOfficer.accounts[0].number");
3713 SeleneseTestBase.assertEquals("1234567890", getAttributeByName(
3714 "document.newMaintainableObject.dataObject.fiscalOfficer.accounts[0].number", "value"));
3715 SeleneseTestBase.assertEquals("2", getAttributeByName(
3716 "document.newMaintainableObject.dataObject.fiscalOfficer.accounts[0].foId", "value"));
3717 waitAndClickByXpath("//button[@data-loadingmessage='Deleting Line...']");
3718 Thread.sleep(3000);
3719 SeleneseTestBase.assertEquals(Boolean.FALSE, (Boolean) isElementPresentByName(
3720 "document.newMaintainableObject.dataObject.fiscalOfficer.accounts[0].number"));
3721 passed();
3722 }
3723
3724 protected void testVerifyAddDeleteNoteLegacy() throws Exception {
3725 selectFrameIframePortlet();
3726 waitAndClick("div.tableborders.wrap.uif-boxLayoutVerticalItem.clearfix span.uif-headerText-span > img.uif-disclosure-image");
3727 waitForElementPresent("button[title='Add a Note'].uif-action.uif-primaryActionButton.uif-smallActionButton");
3728 waitAndClickByName("newCollectionLines['document.notes'].noteText");
3729 waitAndTypeByName("newCollectionLines['document.notes'].noteText", "Test note");
3730 waitAndClick("button[title='Add a Note'].uif-action.uif-primaryActionButton.uif-smallActionButton");
3731
3732 SeleneseTestBase.assertEquals("Test note", getTextByXpath("//pre"));
3733 waitAndClick("button[title='Delete a Note'].uif-action.uif-primaryActionButton.uif-smallActionButton");
3734 SeleneseTestBase.assertEquals(Boolean.FALSE, (Boolean) isElementPresentByName("document.notes[0].noteText"));
3735 passed();
3736 }
3737
3738 protected void testVerifyAdHocRecipientsLegacy() throws Exception {
3739 selectFrameIframePortlet();
3740 waitAndClickByLinkText("Fiscal Officer Accounts");
3741 assertElementPresentByXpath(
3742 "//select[@name=\"newCollectionLines['document.adHocRoutePersons'].actionRequested\"]");
3743 assertElementPresentByXpath(
3744 "//input[@name=\"newCollectionLines['document.adHocRoutePersons'].name\" and @type=\"text\"]");
3745 assertElementPresentByXpath(
3746 "//select[@name=\"newCollectionLines['document.adHocRouteWorkgroups'].actionRequested\"]");
3747 assertElementPresentByXpath(
3748 "//input[@name=\"newCollectionLines['document.adHocRouteWorkgroups'].recipientNamespaceCode\" and @type='text']");
3749 assertElementPresentByXpath(
3750 "//input[@name=\"newCollectionLines['document.adHocRouteWorkgroups'].recipientName\" and @type='text']");
3751 passed();
3752 }
3753
3754 protected void testVerifyButtonsLegacy() throws Exception {
3755 selectFrameIframePortlet();
3756 assertElementPresentByXpath("//button[contains(.,'ubmit')]");
3757 assertElementPresentByXpath("//button[contains(.,'ave')]");
3758 assertElementPresentByXpath("//button[contains(.,'lanket approve')]");
3759 assertElementPresentByXpath("//button[contains(.,'lose')]");
3760 assertElementPresentByXpath("//a[contains(.,'ancel')]");
3761 passed();
3762 }
3763
3764 protected void testVerifyConstraintText() throws Exception {
3765 selectFrameIframePortlet();
3766 SeleneseTestBase.assertEquals("* indicates required field", getText(
3767 "div.uif-boxLayout.uif-horizontalBoxLayout.clearfix > span.uif-message.uif-requiredInstructionsMessage.uif-boxLayoutHorizontalItem"));
3768 SeleneseTestBase.assertEquals("Must not be more than 10 characters", getText(
3769 "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"));
3770 SeleneseTestBase.assertEquals("Must not be more than 10 characters", getText(
3771 "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"));
3772 SeleneseTestBase.assertEquals("Must not be more than 10 characters", getText(
3773 "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"));
3774 passed();
3775 }
3776
3777 protected void testVerifyEditedComponent(String docId, String componentName, String componentCode) throws Exception {
3778 selectFrameIframePortlet();
3779 waitAndTypeByName("name", componentName);
3780 waitAndClickSearch();
3781 isElementPresentByLinkText(componentName);
3782 waitAndClickByLinkText(componentName);
3783 waitForPageToLoad();
3784 Thread.sleep(2000);
3785 switchToWindow("Kuali :: Inquiry");
3786 Thread.sleep(2000);
3787 SeleneseTestBase.assertEquals(componentName, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim());
3788 SeleneseTestBase.assertEquals(componentCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim());
3789 waitAndClickCloseWindow();
3790 switchToWindow("null");
3791 List<String> parameterList=new ArrayList<String>();
3792 }
3793
3794 protected void testVerifyDisclosures() throws Exception {
3795 selectFrameIframePortlet();
3796 assertElementPresentByXpath("//span[contains(text(),'Document Overview')]");
3797 assertElementPresentByXpath("//span[contains(text(),'Document Overview')]");
3798 assertElementPresentByXpath("//span[contains(text(),'Account Information')]");
3799 assertElementPresentByXpath("//span[contains(text(),'Fiscal Officer Accounts')]");
3800 assertElementPresentByXpath("//span[contains(text(),'Notes and Attachments')]");
3801 assertElementPresentByXpath("//span[contains(text(),'Ad Hoc Recipients')]");
3802 assertElementPresentByXpath("//span[contains(text(),'Route Log')]");
3803 colapseExpandByXpath("//span[contains(text(),'Document Overview')]//img", "//label[contains(text(),'Organization Document Number')]");
3804 colapseExpandByXpath("//span[contains(text(),'Account Information')]//img","//label[contains(text(),'Travel Account Type Code')]");
3805 colapseExpandByXpath("//span[contains(text(),'Fiscal Officer Accounts')]//img","//a[contains(text(),'Lookup/Add Multiple Lines')]");
3806 expandColapseByXpath("//span[contains(text(),'Notes and Attachments')]//img","//label[contains(text(),'Note Text')]");
3807 expandColapseByXpath("//span[contains(text(),'Ad Hoc Recipients')]","//span[contains(text(),'Ad Hoc Group Requests')]");
3808
3809
3810 waitAndClickByXpath("//span[contains(text(),'Route Log')]//img");
3811 selectFrame("routeLogIFrame");
3812 waitIsVisibleByXpath("//img[@alt='refresh']");
3813
3814
3815 selectTopFrame();
3816 selectFrameIframePortlet();
3817 waitAndClickByXpath("//span[contains(text(),'Route Log')]//img");
3818 selectFrame("routeLogIFrame");
3819 waitNotVisibleByXpath("//img[@alt='refresh']");
3820 passed();
3821 }
3822
3823 protected void testVerifyDocumentOverviewLegacy() throws Exception {
3824 selectFrameIframePortlet();
3825 assertTextPresent("Document Overview");
3826 assertElementPresentByXpath("//input[@name='document.documentHeader.documentDescription']");
3827 assertElementPresentByXpath("//input[@name='document.documentHeader.organizationDocumentNumber']");
3828 assertElementPresentByXpath("//textarea[@name='document.documentHeader.explanation']");
3829 passed();
3830 }
3831
3832 protected void testVerifyExpandCollapse() throws Exception {
3833 selectFrameIframePortlet();
3834 assertElementPresentByXpath("//button[contains(@class, 'uif-expandDisclosuresButton')]");
3835 assertElementPresentByXpath("//button[contains(@class, 'uif-collapseDisclosuresButton')]");
3836 passed();
3837 }
3838
3839 protected void testVerifyFieldsLegacy() throws Exception {
3840 selectFrameIframePortlet();
3841 assertElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.number' and @type='text' and @size=10 and @maxlength=10]");
3842 assertElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.extension.accountTypeCode' and @type='text' and @size=2 and @maxlength=3]");
3843 assertElementPresentByXpath(
3844 "//input[@name='document.newMaintainableObject.dataObject.subAccount' and @type='text' and @size=10 and @maxlength=10]");
3845 assertElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.subsidizedPercent' and @type='text' and @size=6 and @maxlength=20]");
3846 assertElementPresentByXpath(
3847 "//input[@name='document.newMaintainableObject.dataObject.foId' and @type='text' and @size=5 and @maxlength=10]");
3848 assertElementPresentByXpath(
3849 "//input[@name=\"newCollectionLines['document.newMaintainableObject.dataObject.fiscalOfficer.accounts'].number\" and @type='text' and @size=10 and @maxlength=10]");
3850 assertElementPresentByXpath(
3851 "//input[@name=\"newCollectionLines['document.newMaintainableObject.dataObject.fiscalOfficer.accounts'].foId\" and @type='text' and @size=5 and @maxlength=10]");
3852 passed();
3853 }
3854
3855 protected void testVerifyHeaderFieldsLegacy() throws Exception {
3856 selectFrameIframePortlet();
3857 assertElementPresentByXpath("//div[contains(@class, 'uif-documentNumber')]");
3858 assertElementPresentByXpath("//div[contains(@class, 'uif-documentInitiatorNetworkId')]");
3859 assertElementPresentByXpath("//div[contains(@class, 'uif-documentStatus')]");
3860 assertElementPresentByXpath("//div[contains(@class, 'uif-documentCreateDate')]");
3861 passed();
3862 }
3863
3864 protected void testVerifyLookupAddMultipleLinesLegacy() throws Exception {
3865 selectFrameIframePortlet();
3866 assertElementPresentByXpath("//a[contains(text(),'Lookup/Add Multiple Lines')]");
3867 passed();
3868 }
3869
3870 protected void testVerifyNotesAndAttachments() throws Exception {
3871 selectFrameIframePortlet();
3872 waitAndClickByXpath("//span[contains(text(),'Notes and Attachments')]");
3873 waitForElementPresentByXpath("//button[@title='Add a Note']");
3874 assertElementPresentByXpath("//span[contains(text(),'Notes and Attachments')]");
3875 assertElementPresentByXpath("//textarea[@name=\"newCollectionLines['document.notes'].noteText\"]");
3876 assertElementPresentByXpath("//input[@name='attachmentFile']");
3877
3878
3879 passed();
3880 }
3881
3882 protected void testVerifyQuickfinderIconsLegacy() throws Exception {
3883 selectFrameIframePortlet();
3884 assertTextPresent("Document Overview");
3885 assertElementPresentByXpath("//*[@id='quickfinder1']");
3886 assertElementPresentByXpath("//*[@id='quickfinder2']");
3887 assertElementPresentByXpath("//*[@id='quickfinder3']");
3888 assertElementPresentByXpath("//*[@id='quickfinder4_add']");
3889
3890
3891 passed();
3892 }
3893
3894 protected void testVerifyRouteLog() throws Exception {
3895 selectFrameIframePortlet();
3896 waitAndClickByLinkText("Route Log");
3897 waitForElementPresent("//iframe[contains(@src,'RouteLog.do')]");
3898 passed();
3899 }
3900
3901 protected void testVerifySave() throws Exception {
3902 selectFrameIframePortlet();
3903 waitAndTypeByName("document.documentHeader.documentDescription", "Test Document " + ITUtil.DTS);
3904 waitAndClickByName("document.newMaintainableObject.dataObject.number");
3905 waitAndTypeByName("document.newMaintainableObject.dataObject.number", "1234567890");
3906 waitAndTypeByName("document.newMaintainableObject.dataObject.extension.accountTypeCode", "EAT");
3907 waitAndTypeByName("document.newMaintainableObject.dataObject.subAccount", "a1");
3908 waitAndClick(
3909 "button[data-loadingmessage='Saving...'].uif-action.uif-primaryActionButton.uif-boxLayoutHorizontalItem");
3910 Thread.sleep(2000);
3911
3912
3913 passed();
3914 }
3915
3916 protected void testVerifySubsidizedPercentWatermarkLegacy() throws Exception {
3917 selectFrameIframePortlet();
3918
3919
3920
3921 assertElementPresentByXpath("//input[@name='document.newMaintainableObject.dataObject.subsidizedPercent']");
3922 passed();
3923 }
3924
3925 protected void testWorkFlowDocTypeBlanketApprove() throws Exception {
3926 selectFrameIframePortlet();
3927 waitAndCreateNew();
3928 String docId = waitForDocId();
3929 assertBlanketApproveButtonsPresent();
3930 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Validation Test Document Type " + ITUtil.DTS);
3931 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,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
3932 + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
3933 waitAndClickByXpath(parentDocType);
3934 waitAndClickSearch();
3935 waitAndClickReturnValue();
3936 String docTypeName = "DocType" + ITUtil.DTS;
3937 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", docTypeName);
3938 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.unresolvedDocHandlerUrl']",
3939 "${kr.url}/maintenance.do?methodToCall=docHandler");
3940 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.label']",
3941 "Workflow Maintenance Document Type Document");
3942 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.unresolvedHelpDefinitionUrl']",
3943 "default.htm?turl=WordDocuments%2Fdocumenttype.htm");
3944 blanketApproveTest();
3945 assertDocFinal(docId);
3946 }
3947
3948 protected void uncheck(By by) throws InterruptedException {
3949 WebElement element = driver.findElement(by);
3950 if (element.isSelected()) {
3951 element.click();
3952 }
3953 }
3954
3955 protected void uncheckByName(String name) throws InterruptedException {
3956 uncheck(By.name(name));
3957 }
3958
3959 protected void uncheckByXpath(String locator) throws InterruptedException {
3960 uncheck(By.xpath(locator));
3961 }
3962
3963 protected boolean validateErrorImage(boolean validateVisible) throws Exception {
3964 Thread.sleep(500);
3965 boolean valid = false;
3966
3967 for (int second = 0; second < 5; second++) {
3968 if ((valid = validateErrorImage(validateVisible, second, ARIA_INVALID_XPATH)) == true) {
3969 break;
3970 }
3971 }
3972
3973 if (validateVisible) {
3974 SeleneseTestBase.assertTrue("valid = " + valid + " when validateVisible is " + validateVisible, valid);
3975 } else {
3976 SeleneseTestBase.assertFalse("valid = " + valid + " when validateVisible is " + validateVisible, valid);
3977 }
3978
3979 return valid;
3980 }
3981
3982 private boolean validateErrorImage(boolean validateVisible, int second, String xpath) throws InterruptedException {
3983 try {
3984 if (validateVisible) {
3985 if (isElementPresentByXpath(xpath) && isVisibleByXpath(xpath)) {
3986 return true;
3987 }
3988 } else {
3989 if (!isElementPresentByXpath(xpath) || !isVisibleByXpath(xpath)) {
3990 return true;
3991 }
3992 }
3993 } catch (Exception e) {
3994
3995 }
3996 Thread.sleep(1000);
3997 return false;
3998 }
3999
4000 protected void verifyRichMessagesValidationBasicFunctionality() throws Exception
4001 {
4002 SeleneseTestBase.assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field1']"));
4003 SeleneseTestBase.assertTrue(isElementPresentByXpath("//a[contains(text(), 'Kuali')]"));
4004 SeleneseTestBase.assertTrue(isElementPresentByXpath("//input[@type='checkbox' and @name='field2']"));
4005 Thread.sleep(3000);
4006 }
4007
4008 protected void verifyRichMessagesValidationAdvancedFunctionality() throws Exception
4009 {
4010
4011 SeleneseTestBase.assertTrue(isElementPresentByXpath("//span[@style='color: green;']"));
4012 SeleneseTestBase.assertTrue(isElementPresentByXpath("//span[@style='color: blue;']"));
4013
4014
4015 SeleneseTestBase.assertTrue(isElementPresentByXpath("//span[@class='fl-text-underline fl-text-larger']"));
4016
4017
4018 SeleneseTestBase.assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field3']"));
4019 SeleneseTestBase.assertTrue(isElementPresentByXpath("//select[@name='field4']"));
4020 SeleneseTestBase.assertTrue(isElementPresentByXpath("//button[contains(text(), 'Action Button')]"));
4021
4022
4023 SeleneseTestBase.assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/span[contains(., 'Color')]"));
4024 SeleneseTestBase.assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/i/b[contains(., 'Html')]"));
4025 SeleneseTestBase.assertTrue(isElementPresentByXpath("//label[contains(., 'Label With')]/img[@class='uif-image inlineBlock']"));
4026 Thread.sleep(3000);
4027 }
4028
4029 protected void verifyRichMessagesValidationLettersNumbersValidation() throws Exception
4030 {
4031
4032 SeleneseTestBase.assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field5']"));
4033 waitAndTypeByXpath(
4034 "//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock']/input[@name= 'field5']",
4035 "abc");
4036 SeleneseTestBase.assertFalse(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
4037 clearTextByXpath(
4038 "//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock']/input[@name= 'field5']");
4039 waitAndTypeByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock']/input[@name= 'field5']","abc12");
4040 waitAndTypeByXpath("//input[@name= 'field6']", "");
4041 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
4042 Thread.sleep(3000);
4043 clearTextByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']/input[@name= 'field5']");
4044 waitAndTypeByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']/input[@name= 'field5']","abc");
4045 waitAndTypeByXpath("//input[@name= 'field6']", "");
4046
4047
4048 waitAndTypeByXpath("//input[@name= 'field6']", "123");
4049 SeleneseTestBase.assertFalse(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
4050 clearTextByXpath("//input[@name= 'field6']");
4051 waitAndTypeByXpath("//input[@name= 'field6']", "123ab");
4052 fireEvent("field6", "blur");
4053 Thread.sleep(5000);
4054 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@class='uif-field uif-inputField uif-inputField-labelTop inlineBlock uif-hasError']"));
4055 Thread.sleep(3000);
4056 }
4057
4058 protected void verifyRichMessagesValidationRadioAndCheckBoxGroupFunctionality() throws Exception
4059 {
4060
4061 SeleneseTestBase.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='1']"));
4062 SeleneseTestBase.assertTrue(isElementPresentByXpath(
4063 "//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='2']"));
4064 SeleneseTestBase.assertTrue(isElementPresentByXpath(
4065 "//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='3']"));
4066 SeleneseTestBase.assertTrue(isElementPresentByXpath(
4067 "//fieldset[@class='uif-verticalRadioFieldset']/span/input[@type='radio' and @name='field24' and @value='4']"));
4068
4069
4070 SeleneseTestBase.assertTrue(isElementPresentByXpath(
4071 "//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='1']"));
4072 SeleneseTestBase.assertTrue(isElementPresentByXpath("//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='2']"));
4073 SeleneseTestBase.assertTrue(isElementPresentByXpath(
4074 "//fieldset[@class='uif-verticalCheckboxesFieldset']/span/input[@type='checkbox' and @name='field115' and @value='3']"));
4075 SeleneseTestBase.assertTrue(isElementPresentByXpath(
4076 "//fieldset[@class='uif-verticalCheckboxesFieldset']/span/label/div/select[@name='field4']"));
4077
4078
4079 SeleneseTestBase.assertTrue(isElementPresentByXpath("//input[@type='checkbox' and @name='bField1']"));
4080 SeleneseTestBase.assertTrue(isElementPresentByXpath("//input[@type='text' and @name='field103']"));
4081 }
4082
4083 protected void verifyRichMessagesValidationLinkDeclarationsFunctionality() throws Exception
4084 {
4085
4086 waitAndClickByXpath("//div[contains(., 'Testing link tag')]/a");
4087 Thread.sleep(9000);
4088 switchToWindow("Open Source Software | www.kuali.org");
4089 switchToWindow(RICH_MESSAGES_WINDOW_TITLE);
4090
4091
4092 waitAndClickByXpath("//div[contains(., 'Testing methodToCall action')]/a");
4093 Thread.sleep(3000);
4094 SeleneseTestBase.assertTrue(isElementPresentByXpath(
4095 "//div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages uif-pageValidationMessages-error']"));
4096 SeleneseTestBase.assertTrue(isElementPresentByXpath(
4097 "//div[@id='Demo-AdvancedMessagesSection']/div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages-error']"));
4098 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@id='Demo-RadioCheckboxMessageSection']/div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages-error']"));
4099
4100
4101 waitAndClickByXpath("//div[contains(., 'Testing methodToCall action (no client validation check)')]/a");
4102 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages uif-pageValidationMessages-error']"));
4103 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@class='uif-validationMessages uif-groupValidationMessages']"));
4104 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages uif-pageValidationMessages-error']"));
4105 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@id='Demo-AdvancedMessagesSection']/div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages-error']"));
4106 SeleneseTestBase.assertTrue(isElementPresentByXpath("//div[@id='Demo-RadioCheckboxMessageSection']/div[@class='uif-validationMessages uif-groupValidationMessages uif-pageValidationMessages-error']"));
4107 Thread.sleep(3000);
4108 }
4109
4110
4111
4112
4113
4114
4115 protected void waitAndClickAdministration(Failable failable) throws InterruptedException {
4116 waitAndClickByLinkText(ADMINISTRATION_LINK_TEXT, failable);
4117 }
4118
4119 protected void waitAndCancelConfirmation() throws InterruptedException {
4120 waitAndClickCancel();
4121 waitAndClickByName("methodToCall.processAnswer.button0");
4122 }
4123
4124 protected void waitAndClick(By by) throws InterruptedException {
4125 jiraAwareWaitAndClick(by, "");
4126 }
4127
4128 protected void waitAndClick(By by, Failable failable) throws InterruptedException {
4129 jiraAwareWaitAndClick(by, "", failable);
4130 }
4131
4132 protected void waitAndClick(String locator, String message) throws InterruptedException {
4133 jiraAwareWaitAndClick(By.cssSelector(locator), message);
4134 }
4135
4136 protected void waitAndClickById(String id) throws InterruptedException {
4137 jiraAwareWaitAndClick(By.id(id), "");
4138 }
4139 protected void waitAndClickById(String id, String message) throws InterruptedException {
4140 jiraAwareWaitAndClick(By.id(id), message);
4141 }
4142
4143 protected void waitAndClickButtonByText(String buttonText) throws InterruptedException {
4144 waitAndClickByXpath("//button[contains(text(), '" + buttonText + "')]");
4145 }
4146
4147 protected void waitAndClickByLinkText(String text) throws InterruptedException {
4148 jiraAwareWaitAndClick(By.linkText(text), "");
4149 }
4150
4151 protected void waitAndClickByLinkText(String text, String message) throws InterruptedException {
4152 jiraAwareWaitAndClick(By.linkText(text), message);
4153 }
4154
4155 protected void waitAndClickByLinkText(String text, Failable failable) throws InterruptedException {
4156 jiraAwareWaitAndClick(By.linkText(text), "", failable);
4157 }
4158
4159 protected void waitAndClickByLinkText(String text, String message, Failable failable) throws InterruptedException {
4160 jiraAwareWaitAndClick(By.linkText(text), message, failable);
4161 }
4162
4163 protected void waitAndClickByName(String name) throws InterruptedException {
4164 jiraAwareWaitAndClick(By.name(name), "");
4165 }
4166
4167 protected void waitAndClickByXpath(String xpath) throws InterruptedException {
4168 waitAndClick(By.xpath(xpath));
4169 }
4170
4171 protected void waitAndClickByXpath(String xpath, Failable failable) throws InterruptedException {
4172 waitAndClick(By.xpath(xpath), failable);
4173 }
4174
4175 protected void waitAndClickByName(String name, String message) throws InterruptedException {
4176 jiraAwareWaitAndClick(By.name(name), message);
4177 }
4178
4179 protected void waitAndClickByXpath(String xpath, String message) throws InterruptedException {
4180 jiraAwareWaitAndClick(By.xpath(xpath), message);
4181 }
4182
4183
4184
4185
4186
4187 protected void waitAndClickCancel() throws InterruptedException {
4188 waitAndClickByName(CANCEL_NAME);
4189 }
4190
4191
4192
4193
4194
4195 protected void waitAndClickCloseWindow() throws InterruptedException {
4196 waitAndClickByXpath(CLOSE_WINDOW_XPATH_TITLE);
4197 }
4198
4199
4200
4201
4202
4203 protected void waitAndClickCopy() throws InterruptedException {
4204 waitAndClickByLinkText(COPY_LINK_TEXT);
4205 }
4206
4207
4208
4209
4210
4211 protected void waitAndClickDocSearch() throws InterruptedException {
4212 waitAndClickByXpath(DOC_SEARCH_XPATH);
4213 }
4214
4215
4216
4217
4218
4219 protected void waitAndClickDocSearchTitle() throws InterruptedException {
4220 waitAndClickByXpath(DOC_SEARCH_XPATH_TITLE);
4221 }
4222
4223
4224
4225
4226
4227 protected void waitAndClickLogout() throws InterruptedException {
4228 waitAndClickByXpath(LOGOUT_XPATH, this);
4229 }
4230
4231
4232
4233
4234
4235
4236 protected void waitAndClickLogout(Failable failable) throws InterruptedException {
4237 waitAndClickByXpath(LOGOUT_XPATH, failable);
4238 }
4239
4240
4241
4242
4243
4244
4245 protected void waitAndClickMainMenu(Failable failable) throws InterruptedException {
4246 waitAndClickByLinkText(MAIN_MENU_LINK_TEXT, failable);
4247 }
4248
4249
4250
4251
4252
4253 protected void waitAndClickSave() throws InterruptedException {
4254 waitAndClickByXpath(SAVE_XPATH);
4255 }
4256
4257
4258
4259
4260
4261 private void waitAndClickSearch() throws InterruptedException {
4262 waitAndClickByXpath(SEARCH_XPATH);
4263 }
4264
4265
4266
4267
4268
4269 protected void waitAndClickSubmit() throws InterruptedException {
4270 waitAndClickByXpath(SUBMIT_XPATH);
4271 }
4272
4273
4274
4275
4276
4277
4278
4279 protected void waitAndClickXMLIngester(Failable failable) throws InterruptedException {
4280 waitAndClickByLinkText(XML_INGESTER_LINK_TEXT, failable);
4281 }
4282
4283 protected void waitAndType(By by, String text) throws InterruptedException {
4284 waitAndType(by, text, "");
4285 }
4286
4287 protected void waitAndType(By by, String text, String message) throws InterruptedException {
4288 try {
4289 jiraAwareWaitFor(by, "");
4290 (driver.findElement(by)).sendKeys(text);
4291 } catch (Exception e) {
4292 JiraAwareFailureUtil.failOnMatchedJira(by.toString(), this);
4293 failableFail(e.getMessage() + " " + by.toString() + " unable to type text '" + text + "' " + message
4294 + " current url " + driver.getCurrentUrl()
4295 + "\n" + ITUtil.deLinespace(driver.getPageSource()));
4296 }
4297 }
4298
4299 protected void waitAndType(String selector, String text) throws InterruptedException {
4300 waitAndType(By.cssSelector(selector), text);
4301 }
4302
4303 protected void waitAndTypeByXpath(String locator, String text) throws InterruptedException {
4304 waitAndType(By.xpath(locator), text);
4305 }
4306
4307 protected void waitAndTypeByXpath(String locator, String text, String message) throws InterruptedException {
4308 waitAndType(By.xpath(locator), text, message);
4309 }
4310
4311 protected void waitAndTypeByName(String name, String text) throws InterruptedException {
4312 waitAndType(By.name(name), text);
4313 }
4314
4315 protected void waitAndCreateNew() throws InterruptedException {
4316 selectFrameIframePortlet();
4317 try {
4318 jGrowl("Create New");
4319 waitAndClickCreateNew();
4320 } catch (Exception e) {
4321 System.out.println("waitAndClickByXpath(\"//img[@alt='create new']\") failed trying title method with " + e.getMessage());
4322 waitAndClickByXpath("//a[@title='Create a new record']");
4323 }
4324 }
4325
4326
4327
4328
4329
4330 protected void waitAndClickCreateNew() throws InterruptedException {
4331 waitAndClickByXpath(CREATE_NEW_XPATH);
4332 }
4333
4334 protected void waitAndClickEdit() throws InterruptedException {
4335 waitAndClickByLinkText(EDIT_LINK_TEXT);
4336 }
4337
4338 protected void waitAndClickReturnValue() throws InterruptedException {
4339 waitAndClickByLinkText(RETURN_VALUE_LINK_TEXT);
4340 }
4341
4342 protected void waitAndClickSearch2() throws InterruptedException {
4343 waitAndClickByXpath(SEARCH_XPATH_2);
4344 }
4345
4346 protected void waitAndClickSearch3() throws InterruptedException {
4347 waitAndClickByXpath(SEARCH_XPATH_3);
4348 }
4349
4350 protected String waitForDocId() throws InterruptedException {
4351 waitForElementPresentByXpath(DOC_ID_XPATH);
4352
4353 return driver.findElement(By.xpath(DOC_ID_XPATH)).getText();
4354 }
4355
4356 protected void waitForElementPresent(By by) throws InterruptedException {
4357 jiraAwareWaitFor(by, "");
4358 }
4359
4360 protected void waitForElementPresent(String locator) throws InterruptedException {
4361 jiraAwareWaitFor(By.cssSelector(locator), "");
4362 }
4363
4364 protected void waitForElementPresentByClassName(String name) throws InterruptedException {
4365 jiraAwareWaitFor(By.className(name), "");
4366 }
4367
4368 protected void waitForElementPresentByClassName(String name, String message) throws InterruptedException {
4369 jiraAwareWaitFor(By.className(name), message);
4370 }
4371
4372 protected void waitForElementPresentById(String id) throws InterruptedException {
4373 jiraAwareWaitFor(By.id(id), "");
4374 }
4375
4376 protected void waitForElementPresentByName(String name) throws InterruptedException {
4377 jiraAwareWaitFor(By.name(name), "");
4378 }
4379
4380 protected void waitForElementPresentByXpath(String locator) throws InterruptedException {
4381 jiraAwareWaitFor(By.xpath(locator), "");
4382 }
4383
4384 protected void waitForTitleToEqualKualiPortalIndex() throws InterruptedException {
4385 waitForTitleToEqualKualiPortalIndex("");
4386 }
4387
4388 protected void waitIsVisible(By by) throws InterruptedException {
4389 for (int second = 0;; second++) {
4390 if (second >= waitSeconds) {
4391 failableFail(TIMEOUT_MESSAGE + " " + by.toString());
4392 }
4393 if (isVisible(by)) {
4394 break;
4395 }
4396 Thread.sleep(1000);
4397 }
4398 }
4399
4400 protected void waitIsVisible(By by, String message) throws InterruptedException {
4401 for (int second = 0;; second++) {
4402 if (second >= waitSeconds) {
4403 failableFail(TIMEOUT_MESSAGE + " " + by.toString() + " " + message);
4404 }
4405 if (isVisible(by)) {
4406 break;
4407 }
4408 Thread.sleep(1000);
4409 }
4410 }
4411
4412 protected boolean waitAreAnyVisible(By[] bys) throws InterruptedException {
4413 if (bys == null || bys.length == 0 ) {
4414 return false;
4415 }
4416
4417 for (int second = 0; second < waitSeconds; second++) {
4418
4419 if (isVisible(bys)) {
4420 return true;
4421 }
4422
4423 Thread.sleep(1000);
4424 }
4425
4426 return false;
4427 }
4428
4429 protected boolean isVisible(By[] bys) {
4430 if (bys == null || bys.length == 0 ) {
4431 return false;
4432 }
4433
4434 for (int i = 0, s = bys.length; i < s; i++) {
4435
4436 try {
4437
4438 if (isVisible(bys[i])) {
4439 return true;
4440 }
4441
4442 } catch (NoSuchElementException nsee) {
4443
4444 }
4445
4446 }
4447
4448 return false;
4449 }
4450
4451
4452
4453
4454
4455
4456
4457 protected void waitForElementVisible(String elementLocator, String message) throws InterruptedException {
4458 boolean failed = false;
4459
4460 for (int second = 0;; second++) {
4461 if (second >= waitSeconds)
4462 failed = true;
4463 try {
4464 if (failed || (driver.findElements(By.cssSelector(elementLocator))).size() > 0)
4465 break;
4466 } catch (Exception e) {}
4467 Thread.sleep(1000);
4468 }
4469
4470 checkForIncidentReport(elementLocator);
4471
4472 if (failed)
4473 failableFail("timeout of " + waitSeconds + " seconds waiting for " + elementLocator + " " + message + " " + driver.getCurrentUrl());
4474 }
4475
4476 protected void waitIsVisible(String locator) throws InterruptedException {
4477 waitIsVisible(By.cssSelector(locator));
4478 }
4479
4480 protected void waitIsVisibleByXpath(String locator) throws InterruptedException {
4481 waitIsVisible(By.xpath(locator));
4482 }
4483
4484 protected void waitIsVisibleByXpath(String locator, String message) throws InterruptedException {
4485 waitIsVisible(By.xpath(locator), message);
4486 }
4487
4488 protected void waitForTitleToEqualKualiPortalIndex(String message) throws InterruptedException {
4489 Thread.sleep(2000);
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501 }
4502
4503 protected void waitAndClick(String locator) throws InterruptedException {
4504 waitAndClick(locator, "");
4505 }
4506
4507 protected void waitForPageToLoad() {
4508
4509 }
4510
4511 protected void waitFor(By by) throws InterruptedException {
4512 jiraAwareWaitFor(by, "");
4513 }
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524 protected void waitFor(By by, String message) throws InterruptedException {
4525 WebDriverUtil.waitFor(this.driver, this.waitSeconds, by, message);
4526 }
4527
4528
4529
4530
4531
4532 protected void waitAndClickKRAD() throws InterruptedException {
4533 waitAndClickByLinkText(KRAD_XPATH);
4534 }
4535
4536 protected void waitNotVisible(By by) throws InterruptedException {
4537 for (int second = 0;; second++) {
4538 if (second >= waitSeconds) {
4539 failableFail(TIMEOUT_MESSAGE);
4540 }
4541 if (!isVisible(by)) {
4542 break;
4543 }
4544 Thread.sleep(1000);
4545 }
4546 }
4547
4548 protected void waitNotVisibleByXpath(String locator) throws InterruptedException {
4549 waitNotVisible(By.xpath(locator));
4550 }
4551
4552
4553
4554
4555 protected boolean isKradLogin(){
4556
4557 String loginUif = System.getProperty(REMOTE_LOGIN_UIF);
4558 if (loginUif == null) {
4559 loginUif = ITUtil.REMOTE_UIF_KRAD;
4560 }
4561
4562 return (ITUtil.REMOTE_UIF_KRAD.equalsIgnoreCase(loginUif));
4563 }
4564
4565
4566
4567
4568
4569
4570 protected boolean isKrad(){
4571 return (ITUtil.REMOTE_UIF_KRAD.equalsIgnoreCase(getUiFramework()));
4572 }
4573
4574 protected WebElement getElementByDataAttributeValue(String dataAttributeName, String value){
4575 return driver.findElement(By.cssSelector("[data-" + dataAttributeName + "='" + value +"']"));
4576 }
4577
4578 protected WebElement getElementByDataAttribute(String dataAttributeName){
4579 return driver.findElement(By.cssSelector("[data-" + dataAttributeName + "]"));
4580 }
4581
4582 protected WebElement getElementByAttributeValue(String attributeName, String value){
4583 return driver.findElement(By.cssSelector("[" + attributeName + "='" + value +"']"));
4584 }
4585
4586 protected WebElement getElementByAttribute(String attributeName){
4587 return driver.findElement(By.cssSelector("[" + attributeName + "]"));
4588 }
4589
4590
4591
4592
4593
4594
4595 public String getUiFramework() {
4596 return uiFramework;
4597 }
4598
4599
4600
4601
4602 public void setUiFramework(String uiFramework) {
4603 this.uiFramework = uiFramework;
4604 }
4605 }