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