protected void waitForFolderToLoad(final String folderName) throws Exception { logMsg("Waiting for folder: " + folderName); int count = 0; try { getJspTestUtils().waitSec(); String crumb = getJspTestUtils() .findElement(By.id("auto_folder_search_dialog_breadcrumbs")) .findElement(By.xpath("//strong")) .getText(); while (count < 12 && !crumb.toLowerCase().contains(folderName.toLowerCase())) { logMsg(" Found: " + crumb); if (getJspTestUtils().isElement(By.id(folderName))) { logMsg("Clicking " + folderName); getJspTestUtils().findElement(By.id(folderName)).click(); } count++; getJspTestUtils().waitSec(); crumb = getJspTestUtils() .findElement(By.id("auto_folder_search_dialog_breadcrumbs")) .findElement(By.xpath("//strong")) .getText(); } } catch (ErrorHandler.UnknownServerException e) { logMsg("Threw UnknownServerException"); } }
private void verifySentItemsQuery() throws Exception { // should be on archive page logMsg( "verifying that selecting to search the Sent Items folder populates user email in sender filter"); getJspTestUtils().clickLink(By.id("auto_folder_search")); getJspTestUtils().wait4Visible(15, By.id("folderList")); forcePageLoad(); getJspTestUtils().findElement(By.id("Child-101-002")); // ensures loaded forcePageLoad(); getJspTestUtils().findElement(By.id("Child-199-002")); // ensures loaded forcePageLoad(); getJspTestUtils().findElement(By.id("Sent Items")); // ensures loaded getJspTestUtils().clickLink(By.id("Sent Items")); waitForFolderToLoad("Sent Items"); acceptFolderSelection(); getJspTestUtils().clickLink(By.id("auto_query_submit")); // verify filter by sender is populated with getJspTestUtils() .waitFor( 15000, "filter_sender_input", new IntegrationJspTestHelper.IWebElementCheck() { @Override public boolean onCheck(WebElement element) { logMsg("Value: '" + element.getAttribute("value") + "'"); logMsg("Email: '" + getJspTestUtils().m_userAddress + "'"); return element.getAttribute("value").equals(getJspTestUtils().m_userAddress); } }, "From filter did not have user's email"); }
protected void forcePageLoad() throws Exception { logMsg("Forcing page load by sending END key to folder list"); WebElement e = getJspTestUtils().findElement(By.id("folderList")); Actions clicker = new Actions(getJspTestUtils().getDriver()); clicker.moveToElement(e); clicker.sendKeys(e, Keys.END); clicker.perform(); }
protected void selectSearchFolder(String folderName) throws Exception { getJspTestUtils().clickOnVisible(15000, By.id("auto_folder_search")); getJspTestUtils().wait4Visible(15, By.id("auto_folder_search_dialog_breadcrumbs")); logMsg( "Breadcrumbs before: " + getJspTestUtils() .findElement(By.id("auto_folder_search_dialog_breadcrumbs")) .getText()); getJspTestUtils().clickOnVisible(15000, By.id(folderName)); waitForFolderToLoad(folderName); logMsg( "Breadcrumbs after: " + getJspTestUtils() .findElement(By.id("auto_folder_search_dialog_breadcrumbs")) .getText()); getJspTestUtils().clickOnVisible(15000, By.id("auto_folder_search_dialog_accept")); }
protected void verifyFolders(int start, int end) throws Exception { logMsg("Verifying items between index " + start + " and " + end); int currentIndex = start; while (currentIndex <= end) { String toFind = String.format(FOLDER_NAME_FORMAT, currentIndex, FOLDER_DEPTH); getJspTestUtils().findElement(By.id(toFind)); currentIndex++; } }
private void acceptFolderSelection() throws WebTestException { WebElement acceptElement = getJspTestUtils().findElement(By.id("auto_folder_search_dialog_accept")); int count = 0; while (acceptElement.isDisplayed() && count < 12) { logMsg("accept element is displayed"); acceptElement.click(); getJspTestUtils().waitSec(); acceptElement = getJspTestUtils().findElement(By.id("auto_folder_search_dialog_accept")); count++; } }
private void verifySelectButtonOnNotSyncedFolder() throws Exception { logMsg("verifying the select button is disabled for nonfolder sync enabled folder"); getJspTestUtils().clickLink(By.id("auto_folder_search"), By.id("Child-005-002")); getJspTestUtils() .waitFor( 10000, "auto_folder_search_dialog_accept", new IntegrationJspTestHelper.IWebElementCheck() { @Override public boolean onCheck(WebElement element) { logMsg("Title: '" + element.getAttribute("title") + "'"); return !element.isEnabled() && element.getAttribute("title").contains("not enabled"); } }, "Accept button not disabled/doesn't contain the correct text."); getJspTestUtils().clickBy(By.id("auto_folder_search_dialog_reset")); }