/** * This method provides the user to login into edit google docs page through google authorization. * * @param drone WebDrone * @return EditInGoogleDocsPage */ public static EditInGoogleDocsPage signIntoResumeEditGoogleDocFromDetailsPage(WebDrone drone) throws InterruptedException { DocumentDetailsPage detailsPage = ShareUser.getSharePage(drone).render(); detailsPage.render(); GoogleDocsAuthorisation googleAuthorisationPage = detailsPage.resumeEditInGoogleDocs().render(); return signInGoogleDocs(drone, googleAuthorisationPage); }
@Test(groups = "EnterpriseOnly") public void Enterprise40x_14032() { /** Start Test */ testName = getTestName(); /** Test Data Setup */ String siteName = getSiteName(testName); String testUser = getUserNameFreeDomain(testName); String fileName = getFileName(testName) + ".txt"; DocumentLibraryPage documentLibraryPage; // Login ShareUser.login(drone, testUser, DEFAULT_PASSWORD); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName); // Click 'Change Type' action ChangeTypePage changeTypePage = detailsPage.selectChangeType().render(); assertTrue(changeTypePage.isChangeTypeDisplayed()); // Select any type if present and click Cancel // The behavior for standard install is: no types are available -> click cancel changeTypePage.selectCancel(); }
@Test(groups = "EnterpriseOnly") public void Enterprise40x_3960() throws Exception { /** Start Test */ testName = getTestName(); /** Test Data Setup */ String siteName = getSiteName(testName); String testUser = getUserNameFreeDomain(testName); String fileName = getFileName(testName) + ".txt"; DocumentLibraryPage documentLibraryPage; String filePath = downloadDirectory + fileName; setupCustomDrone(WebDroneType.DownLoadDrone); // Login ShareUser.login(customDrone, testUser, DEFAULT_PASSWORD); documentLibraryPage = ShareUser.openSitesDocumentLibrary(customDrone, siteName); // Document details page has been opened; DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName).render(); Assert.assertFalse(detailsPage.getDocumentVersion().equals("1.0")); // Click Download icon for previous version; detailsPage.selectDownloadPreviousVersion("2.0"); // Check the file is downloaded successfully detailsPage.waitForFile(maxWaitTime, downloadDirectory + fileName); String body = FileUtils.readFileToString(new File(filePath)); if (body.length() == 0) { body = FileUtils.readFileToString(new File(filePath)); } Assert.assertEquals(body, String.format("New version of document %s: %s", 2, fileName)); }
@Test(groups = "EnterpriseOnly") public void Enterprise40x_13863() throws Exception { /** Start Test */ testName = getTestName(); /** Test Data Setup */ String siteName = getSiteName(testName); String testUser = getUserNameFreeDomain(testName); String fileName = getFileName(testName) + getRandomStringWithNumders(3) + ".txt"; DocumentLibraryPage documentLibraryPage; // Login ShareUser.login(drone, testUser, DEFAULT_PASSWORD); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); // Upload File String[] fileInfo = {fileName, DOCLIB}; ShareUser.uploadFileInFolder(drone, fileInfo); DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName); // Click "Edit Properties" in Actions section; EditDocumentPropertiesPage editPropertiesPage = detailsPage.selectEditProperties().render(); editPropertiesPage.selectMimeType(MimeType.XML); detailsPage = editPropertiesPage.selectSave().render(); detailsPage.render(); Map<String, Object> properties = detailsPage.getProperties(); Assert.assertEquals(properties.get("Mimetype"), "XML"); }
/** * This method provides edit google docs page. * * @param drone WebDrone * @return EditInGoogleDocsPage */ public static EditInGoogleDocsPage openEditGoogleDocFromDetailsPage(WebDrone drone) { DocumentDetailsPage detailsPage = ShareUser.getSharePage(drone).render(); detailsPage.render(); EditInGoogleDocsPage googleDocsPage = detailsPage.editInGoogleDocs().render(); if (isGoogleDocsV3) { googleDocsPage = switchToGoogleWindow(drone).render(); } return googleDocsPage.render(); }
@Test(groups = "EnterpriseOnly") public void Enterprise40x_3910() { /** Start Test */ testName = getTestName(); /** Test Data Setup */ String siteName = getSiteName(testName); String testUser = getUserNameFreeDomain(testName); String fileName = getFileName(testName) + ".txt"; String text = getRandomString(5); DocumentLibraryPage documentLibraryPage; // Login ShareUser.login(drone, testUser, DEFAULT_PASSWORD); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName); AddCommentForm addCommentForm = detailsPage.clickAddCommentButton(); // 1. Type any text and make it bold; TinyMceEditor tinyMceEditor = addCommentForm.getTinyMceEditor(); tinyMceEditor.setText(text); tinyMceEditor.clickTextFormatter(BOLD); assertEquals( tinyMceEditor.getContent(), String.format("<p><b>%s</b></p>", text), "The text didn't mark as bold."); tinyMceEditor.clickTextFormatter(ITALIC); assertEquals( tinyMceEditor.getContent(), String.format("<p><i><b>%s</b></i></p>", text), "The text didn't italic."); tinyMceEditor.clickTextFormatter(BULLET); assertEquals( tinyMceEditor.getContent(), String.format("<ul><li><i><b>%s</b></i></li></ul>", text), "List didn't display."); tinyMceEditor.clickTextFormatter(NUMBER); assertEquals( tinyMceEditor.getContent(), String.format("<ol><li><i><b>%s</b></i></li></ol>", text), "Numbered list didn't display."); tinyMceEditor.clickColorCode(TinyMceColourCode.BLUE); assertEquals( tinyMceEditor.getColourAttribute(), "BLUE", "The text didn't highlight with any color."); addCommentForm.clickAddCommentButton(); assertTrue(detailsPage.isCommentCorrect(text), "Comment didn't create"); }
@Test(groups = "EnterpriseOnly") public void Enterprise40x_13861() throws Exception { /** Start Test */ testName = getTestName(); /** Test Data Setup */ String siteName = getSiteName(testName); String testUser = getUserNameFreeDomain(testName); String fileName = getFileName(testName) + ".txt"; DocumentLibraryPage documentLibraryPage; String workFlowName1 = testName + System.currentTimeMillis() + "-1-WF"; String dueDate = new DateTime().plusDays(2).toString("dd/MM/yyyy"); // Login ShareUser.login(drone, testUser, DEFAULT_PASSWORD); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName); // Click Start Workflow from Actions section StartWorkFlowPage startWorkFlowPage = ShareUserWorkFlow.selectStartWorkFlowFromDetailsPage(drone).render(); NewWorkflowPage newWorkflowPage = startWorkFlowPage.getWorkflowPage(WorkFlowType.NEW_WORKFLOW).render(); List<String> reviewers = new ArrayList<String>(); reviewers.add(username); WorkFlowFormDetails formDetails = new WorkFlowFormDetails(siteName, siteName, reviewers); formDetails.setMessage(workFlowName1); formDetails.setDueDate(dueDate); formDetails.setTaskPriority(Priority.MEDIUM); // detailsPage = newWorkflowPage.startWorkflow(formDetails).render(); newWorkflowPage.startWorkflow(formDetails).render(); // check the document is marked with icon assertTrue(detailsPage.isPartOfWorkflow(), "Verifying the file is part of a workflow"); // site creator logs out and assignee user logs in ShareUser.logout(drone); ShareUser.login(drone, ADMIN_USERNAME, ADMIN_PASSWORD); // check the task is in MyTasks for site creator MyTasksPage myTasksPage = ShareUserWorkFlow.navigateToMyTasksPage(drone); assertTrue(myTasksPage.isTaskPresent(workFlowName1)); }
/** * Discarding the changes made in google doc. * * @param drone WebDrone * @return SharePage */ public static HtmlPage discardGoogleDocsChanges(WebDrone drone) { EditInGoogleDocsPage googleDocsPage = ShareUser.getSharePage(drone).render(); if (isGoogleDocsV3) { String docTitle = googleDocsPage.getDocumentTitle(); closeAndSwitchToShare(drone); HtmlPage currentPage = FactorySharePage.resolvePage(drone); if (currentPage instanceof DocumentLibraryPage) { ((DocumentLibraryPage) currentPage) .getFileDirectoryInfo(docTitle) .selectCancelEditingInGoogleDocs() .render(); } else if (currentPage instanceof DocumentDetailsPage) { ((DocumentDetailsPage) currentPage).clickCancelEditingInGoogleDocs().render(); } HtmlPage thePage = FactorySharePage.resolvePage(drone).render(); if (thePage instanceof SharePopup) { ((SharePopup) thePage).clickYes(); drone.waitUntilElementDeletedFromDom( By.cssSelector("span[class='message']"), SECONDS.convert(maxWaitTime, MILLISECONDS)); } } else { GoogleDocsDiscardChanges googleDocsDiscardChanges = googleDocsPage.selectDiscard().render(); return googleDocsDiscardChanges.clickOkButton().render(); } return FactorySharePage.resolvePage(drone).render(); }
/** * This method is used to create content with name, title and description. User should be logged * in * * @param drone * @param contentDetails * @param contentType * @return {@link RepositoryPage} * @throws Exception */ public static RepositoryPage createContentInFolder( WebDrone drone, ContentDetails contentDetails, ContentType contentType, String... folderPath) throws Exception { // Open Folder in repository Library RepositoryPage repositoryPage = navigateFoldersInRepositoryPage(drone, folderPath); DocumentDetailsPage detailsPage = null; try { CreatePlainTextContentPage contentPage = repositoryPage.getNavigation().selectCreateContent(contentType).render(); detailsPage = contentPage.create(contentDetails).render(); repositoryPage = detailsPage.navigateToFolderInRepositoryPage().render(); } catch (Exception e) { throw new SkipException("Error in creating content." + e); } return repositoryPage; }
/** * This method is used to create content with name, title and description. User should be logged * in * * @param drone * @param contentDetails * @param contentType * @return {@link RepositoryPage} * @throws Exception */ public static HtmlPage createContentInFolderWithValidation( WebDrone drone, ContentDetails contentDetails, ContentType contentType, String... folderPath) throws Exception { // Open Folder in repository Library RepositoryPage repositoryPage = navigateFoldersInRepositoryPage(drone, folderPath); try { CreatePlainTextContentPage contentPage = repositoryPage.getNavigation().selectCreateContent(contentType).render(); HtmlPage page = contentPage.createWithValidation(contentDetails).render(); if (page instanceof DocumentDetailsPage) { DocumentDetailsPage detailsPage = page.render(); repositoryPage = detailsPage.navigateToFolderInRepositoryPage().render(); return repositoryPage; } return page; } catch (Exception e) { throw new SkipException("Error in creating content." + e.getMessage()); } }
@Test(groups = "EnterpriseOnly") public void Enterprise40x_5675() { /** Start Test */ testName = getTestName(); /** Test Data Setup */ String siteName = getSiteName(testName); String testUser = getUserNameFreeDomain(testName); String fileName = getFileName(testName) + ".txt"; String text = getRandomString(5); DocumentLibraryPage documentLibraryPage; // Login ShareUser.login(drone, testUser, DEFAULT_PASSWORD); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); // Click Comment link near created file DocumentDetailsPage detailsPage = documentLibraryPage.getFileDirectoryInfo(fileName).clickCommentsLink().render(); // Write some text in text box and click Add Comment button detailsPage.addComment(text); // Go to document library and verify comment counter documentLibraryPage = ShareUser.openDocumentLibrary(drone); Assert.assertEquals(documentLibraryPage.getFileDirectoryInfo(fileName).getCommentsCount(), 1); // Go to Details page and delete the comment detailsPage = documentLibraryPage.selectFile(fileName); detailsPage.removeComment(text); // Go to document library and verify comment counter documentLibraryPage = ShareUser.openDocumentLibrary(drone); Assert.assertEquals(documentLibraryPage.getFileDirectoryInfo(fileName).getCommentsCount(), 0); }
/** AONE-15602:Form - Items - Items were selected */ @Test(groups = "Hybrid", enabled = true) public void AONE_15602() throws Exception { String testName = getTestName() + System.currentTimeMillis(); String user1 = getUserNameForDomain(testName + "opUser", testDomain); String opSite = getSiteName(testName) + "-OP"; String fileName1 = getFileName(testName) + ".txt"; String fileName2 = "second" + getFileName(testName) + ".txt"; createCloudAccount(testName); // login ShareUser.login(drone, user1, DEFAULT_PASSWORD); // start workflow WorkFlowPage workflow = ShareUserWorkFlow.startCloudReviewTaskWorkFlow(drone).render(); SelectContentPage selectPage = workflow.clickAddItems(); // add new document selectPage.addItemFromSite(fileName1, opSite); selectPage.selectOKButton(); // ---- Step 1 ---- // --- Step action --- // Verify the information and controls available for the Added document. // ---- Expected results ---- /** * The section contains the following information and controls: - Document's thumbnail * placeholder (depends on mimetype) - Document's name (a link to Document Details page) - * Document's description - Document's modified date - View More Actions button - Remove button */ CloudTaskOrReviewPage cloudTaskOrReviewPage = new CloudTaskOrReviewPage(drone); List<SelectedWorkFlowItem> selectedWorkFlowItems = workflow.getSelectedItem(fileName1); DateFormat dateFormat = new SimpleDateFormat("EEE d MMM yyyy"); Calendar cal = Calendar.getInstance(); String current_date = dateFormat.format(cal.getTime()); String itemName = selectedWorkFlowItems.get(0).getItemName(); ShareLink link = selectedWorkFlowItems.get(0).getItemNameLink(); String url = link.getHref(); Assert.assertEquals(itemName, fileName1, "File with incorrect name has been added"); Assert.assertTrue( cloudTaskOrReviewPage.getItemDate(fileName1).contains(current_date), "Item Date is not correct for added file"); Assert.assertTrue( selectedWorkFlowItems.get(0).getDescription().contains("None"), "Description has been added to file"); Assert.assertTrue( selectedWorkFlowItems.get(0).isRemoveLinkPresent(), "'Remove link is not displayed for the file"); Assert.assertTrue( selectedWorkFlowItems.get(0).isViewMoreActionsPresent(), "View more action is not displayed for the file"); String handle1 = drone.getWindowHandle(); // ---- Step 2 ---- // --- Step action --- // Click on the document's name to open the page in a separate tab/window (e.g. via RBC > Open // Link in a new tab). // ---- Expected results ---- // The document details page in opened. All data is displayed correctly. No information about // Sync or Workflows is present - the document is now not a // part of workflow and is not yet synced to Cloud. drone.createNewTab(); drone.navigateTo(url); DocumentDetailsPage docDetails = drone.getCurrentPage().render(); Assert.assertTrue( docDetails.isDocumentActionPresent(DocumentAction.START_WORKFLOW), "Start workflow is not present"); Assert.assertTrue( docDetails.getContentTitle().contains(fileName1), "Title of new tab doesn't contain info about file"); drone.closeTab(); // drone.find(By.cssSelector("body")).sendKeys(Keys.CONTROL +"\t"); drone.switchToWindow(handle1); // ---- Step 3 ----- // --- Step action --- // Click on the View More Actions button to open the page in a separate tab/window (e.g. via // mouse scroll button). // ---- Expected results ---- // The document details page in opened. All data is displayed correctly. No information about // Sync or Workflows is present - the document is now not a // part of workflow and is not yet synced to Cloud. cloudTaskOrReviewPage.selectViewMoreActionsBtn(fileName1).render(); drone.getCurrentPage().render(); Assert.assertTrue( docDetails.isDocumentActionPresent(DocumentAction.START_WORKFLOW), "Start workflow is not present"); Assert.assertTrue( docDetails.getContentTitle().contains(fileName1), "Title of new tab doesn't contain info about file (via View More Actions Button)"); workflow = ShareUserWorkFlow.startCloudReviewTaskWorkFlow(drone).render(); selectPage = workflow.clickAddItems(); // add new document selectPage.addItemFromSite(fileName1, opSite); selectPage.selectOKButton(); // ---- Step 4 ---- // --- Step action --- // Click on the Remove button. // ---- Expected results ---- // The document is removed from the Items section. cloudTaskOrReviewPage.selecRemoveBtn(fileName1); Assert.assertTrue( cloudTaskOrReviewPage.isNoItemsSelectedMessagePresent(), "Failed is not removed from workFlow"); // ---- Step 5 ---- // --- Step action --- // The documents are selected. // ---- Expected results ---- // The documents are selected. String[] fileInfo2 = {fileName2, DOCLIB}; ShareUser.openSiteDashboard(drone, opSite); @SuppressWarnings("unused") DocumentLibraryPage documentLibraryPage = ShareUser.uploadFileInFolder(drone, fileInfo2).render(); workflow = ShareUserWorkFlow.startCloudReviewTaskWorkFlow(drone).render(); selectPage = workflow.clickAddItems(); selectPage.addItemFromSite(fileName1, opSite); selectPage.selectOKButton(); selectPage = workflow.clickAddItems(); selectPage.addItemFromSite(fileName2, opSite); selectPage.selectOKButton(); selectedWorkFlowItems = workflow.getSelectedItem(fileName1); itemName = selectedWorkFlowItems.get(0).getItemName(); Assert.assertEquals(itemName, fileName1, "First file is not added to workFlow"); selectedWorkFlowItems = workflow.getSelectedItem(fileName2); itemName = selectedWorkFlowItems.get(0).getItemName(); Assert.assertEquals(itemName, fileName2, "Second file is not added to workFlow"); // ---- Step 6 ----- // --- Step action --- // Click on Remove action for any of the added document. // ---- Expected results ---- // The document is removed from the Items section. All other previously added documents are // still present. cloudTaskOrReviewPage.selecRemoveBtn(fileName1); Assert.assertFalse( cloudTaskOrReviewPage.isItemAdded(fileName1), "First file is not removed from workFlow"); Assert.assertTrue( cloudTaskOrReviewPage.isItemAdded(fileName2), "Second file is removed during deletion first file"); // ---- Step 7 ---- // --- Step action --- // Click on Remove All button. // ---- Expected results ---- // All other previously added documents are removed. cloudTaskOrReviewPage.selectRemoveAllButton(); Assert.assertFalse( cloudTaskOrReviewPage.isItemAdded(fileName2), "Remove All button doesn't work"); }
/** * Test - AONE-13004: CRM property validation * * <ul> * <li>Login * <li>Access the document details page for the account content created Via SF * <li>Verify that document details page should be displayed. * <li>Access the document details page for the contract content created Via SF. * <li>Verify that document details page should be displayed correctly * <li>Access the document details page for the oppor content created Via SF. * <li>Verify that document details page should be displayed correctly * <li>Access the document details page for the case content created Via SF. * <li>Verify that document details page should be displayed correctly * </ul> */ @Test public void AONE_13885() throws PageException, Exception { // Login ShareUser.login(drone, salesforceUserName, salesforcePassword); // Opening Site Document library page ShareUser.openSitesDocumentLibrary(drone, siteName); // Account content details page DocumentLibraryPage docLibPage = ShareUserSitePage.navigateToFolder(drone, attachments_Folder + SLASH + accountName); DocumentDetailsPage detailsPage = ShareUser.openDocumentDetailPage(drone, account_Content); // Get the properties from details page Map<String, Object> properties = detailsPage.getProperties(); Assert.assertNotNull(properties); Assert.assertFalse(properties.isEmpty()); Assert.assertTrue( ((String) properties.get("AccountIdentifier")).equalsIgnoreCase(accountIdentifier)); Assert.assertTrue(((String) properties.get("AccountName")).equalsIgnoreCase(accountName)); // Opening Site Document library page ShareUser.openDocumentLibrary(drone); // Contract content details page docLibPage = ShareUserSitePage.navigateToFolder( drone, attachments_Folder + SLASH + contractNameOrNumber); detailsPage = ShareUser.openDocumentDetailPage(drone, contract_Content); // Get the properties from details page properties.clear(); properties = detailsPage.getProperties(); Assert.assertNotNull(properties); Assert.assertFalse(properties.isEmpty()); Assert.assertTrue( ((String) properties.get("AccountIdentifier")).equalsIgnoreCase(accountIdentifier)); Assert.assertTrue( ((String) properties.get("ContractNumber")).equalsIgnoreCase(contractNameOrNumber)); Assert.assertTrue( ((String) properties.get("ContractName")).equalsIgnoreCase(contractNameOrNumber)); // Opening Site Document library page ShareUser.openDocumentLibrary(drone); // Opportunity content details page docLibPage = ShareUserSitePage.navigateToFolder(drone, attachments_Folder + SLASH + oppName); detailsPage = ShareUser.openDocumentDetailPage(drone, oppo_Content); // Get the properties from details page properties.clear(); properties = detailsPage.getProperties(); Assert.assertNotNull(properties); Assert.assertFalse(properties.isEmpty()); Assert.assertTrue( ((String) properties.get("AccountIdentifier")).equalsIgnoreCase(accountIdentifier)); Assert.assertTrue(((String) properties.get("OpportunityName")).equalsIgnoreCase(oppName)); // Opening Site Document library page ShareUser.openDocumentLibrary(drone); // Case content details page docLibPage = ShareUserSitePage.navigateToFolder(drone, attachments_Folder + SLASH + caseNameOrNumber); detailsPage = ShareUser.openDocumentDetailPage(drone, case_Content); // Get the properties from details page properties.clear(); properties = detailsPage.getProperties(); Assert.assertNotNull(properties); Assert.assertFalse(properties.isEmpty()); Assert.assertTrue( ((String) properties.get("AccountIdentifier")).equalsIgnoreCase(accountIdentifier)); Assert.assertTrue(((String) properties.get("CaseNumber")).equalsIgnoreCase(caseNameOrNumber)); Assert.assertTrue(((String) properties.get("CaseName")).equalsIgnoreCase(caseNameOrNumber)); }