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