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