/** * This method provides the user to login into create google docs with given filename through * google authorization. And Saves the document return to the document library page. User should * be already logged * * @param drone WebDrone * @param fileName String * @param contentType ContentType * @return DocumentLibraryPage * @throws Exception */ public static DocumentLibraryPage createAndSavegoogleDocBySignIn( WebDrone drone, String fileName, ContentType contentType) throws Exception { DocumentLibraryPage docLibPage; String docTitle = ""; EditInGoogleDocsPage googleDocsPage = createGoogleDocWithoutSave(drone, fileName, contentType); if (isGoogleDocsV3) { switch (contentType) { case GOOGLEDOCS: docTitle = "Untitled Document.docx"; break; case GOOGLESPREADSHEET: docTitle = "Untitled Document.xlsx"; break; case GOOGLEPRESENTATION: docTitle = "Untitled Document.pptx"; break; } closeAndSwitchToShare(drone).render(); Thread.sleep(10000); docLibPage = ShareUser.getSharePage(drone).render(); docLibPage.render(); try { docLibPage.getFileDirectoryInfo(docTitle).selectCheckInGoogleDoc(); } catch (TimeoutException e) { throw new PageOperationException("Check-in didn't finish within the timeout"); } } else { docLibPage = googleDocsPage.selectSaveToAlfresco().render(); } return docLibPage.render(); }
@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)); }
/** * Discarding the changes made in google doc. * * @param filename String * @return SharePage */ public static GoogleSignUpPage openSignUpPage(WebDrone driver, String filename) { DocumentLibraryPage docLibPage = driver.getCurrentPage().render(); GoogleDocsAuthorisation googleAuth = docLibPage.getFileDirectoryInfo(filename).selectEditInGoogleDocs().render(); Assert.assertTrue(googleAuth.isAuthorisationDisplayed()); return googleAuth.submitAuth().render(); }
@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_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"); }
@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: AONE-6554:Hidden files * * <ul> * <li>Map Alfresco Webdav as a network drive * <li>Create a folder with the name started with dot (e.g. '.folder new') * <li>Create a file with the name started with dot (e.g. '.test.txt') * <li>Log into Share * <li>Verify the presence of the file and folder * <li>The file and folder are not displayed * </ul> * * @throws Exception */ @AlfrescoTest(testlink = "AONE-6554") @Test( groups = {"WEBDAVWindowsClient", "EnterpriseOnly"}, timeOut = 600000) public void AONE_6554() throws Exception { if (!CifsUtil.checkDirOrFileExists(10, 200, networkDrive + sitesPath)) { Assert.fail("Mapping was not done " + testUser); } // Alfresco WebDAV connection is established String docLib = "\\documentLibrary"; // Alfresco WebDAV connection is established String fullPath = networkDrive + sitesPath + siteName.toLowerCase() + docLib + "\\"; explorer.openWindowsExplorer(); explorer.openFolder(fullPath); // The space / the site's doclib is opened via WebDAV String windowName = ldtpUtil.findWindowName("documentLibrary"); explorer.activateApplicationWindow(windowName); // Create a folder with the name started with dot (e.g. '.folder new') explorer.createNewFolderMenu(folderName); // Create a file with the name started with dot (e.g. '.test.txt') explorer.rightClickCreate("documentLibrary", fileName, Application.TEXTFILE); explorer.activateApplicationWindow(windowName); Ldtp newLdtp = new Ldtp(windowName); String[] objects = newLdtp.getObjectList(); Assert.assertTrue( Arrays.asList(objects).contains(fileNameCheck), "Expected file '" + fileName + "' isn't displayed"); Assert.assertTrue( Arrays.asList(objects).contains(folderNameCheck), "Expected folder '" + folderName + "' isn't displayed"); logger.info("Close window"); explorer.closeExplorer(); // Log into Share ShareUser.login(drone, testUser); DocumentLibraryPage docLibPage = ShareUser.openSitesDocumentLibrary(drone, siteName); int fileCount = docLibPage.getFiles().size(); ShareUser.logout(drone); // The file and folder are not displayed Assert.assertTrue( fileCount == 0, "Some file isn't hidden in Document Library. MNT-13125 and MNT-8116"); }
@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(); }
/** * Creates files in site's document library * * @param numberOfFiles * @param siteName * @throws Exception */ public static void createFilesInSite( WebDrone drone, String testName, int numberOfFiles, String siteName) throws Exception { // Create Files for (int i = 0; i <= numberOfFiles - 1; i++) { DocumentLibraryPage documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); ContentDetails contentDetails = new ContentDetails(); String fileName = getFileName(testName + "_" + i + "." + "txt"); contentDetails.setName(fileName); contentDetails.setTitle(testName + " title"); contentDetails.setDescription(testName + " description"); contentDetails.setContent(testName + " content"); CreatePlainTextContentPage contentPage = documentLibraryPage.getNavigation().selectCreateContent(ContentType.PLAINTEXT).render(); contentPage.create(contentDetails).render(); } }
public static EditInGoogleDocsPage createGoogleDocWithoutSave( WebDrone drone, String fileName, ContentType contentType) throws Exception { DocumentLibraryPage docLibPage = ShareUser.getSharePage(drone).render(); GoogleDocsAuthorisation googleAuthorisationPage = docLibPage.getNavigation().selectCreateContent(contentType).render(); googleAuthorisationPage.render(); EditInGoogleDocsPage googleDocsPage = signInGoogleDocs(drone, googleAuthorisationPage); googleDocsPage.setGoogleCreate(true); if (isGoogleDocsV3) { googleDocsPage = switchToGoogleWindow(drone); } if (!(fileName == null)) { return renameGoogleDocName(fileName, googleDocsPage); } throw new PageOperationException("Filename param must not be null : error creating GoogleDoc"); }
@Test(groups = {"DataPrepDocumentLibrary"}) public void dataPrep_Enterprise40x_3960() throws Exception { String testName = getTestName(); String testUser = getUserNameFreeDomain(testName); String siteName = getSiteName(testName); String fileName = getFileName(testName) + ".txt"; // User String[] testUserInfo = new String[] {testUser}; CreateUserAPI.CreateActivateUser(drone, ADMIN_USERNAME, testUserInfo); // Login ShareUser.login(drone, testUser, DEFAULT_PASSWORD); // Create Site ShareUser.createSite(drone, siteName, AbstractUtils.SITE_VISIBILITY_PUBLIC); ShareUser.openSiteDashboard(drone, siteName); ShareUser.openSitesDocumentLibrary(drone, siteName); // Upload File String[] fileInfo = {fileName, DOCLIB}; DocumentLibraryPage documentLibraryPage = ShareUser.uploadFileInFolder(drone, fileInfo).render(); // Upload New version of the document. for (int i = 0; i < 2; i++) { UpdateFilePage updatePage = documentLibraryPage.getFileDirectoryInfo(fileName).selectUploadNewVersion().render(); updatePage.selectMajorVersionChange(); String fileContents = String.format("New version of document %s: %s", i + 2, fileName); File newFileName = newFile(DATA_FOLDER + (fileName + getRandomString(3)), fileContents); updatePage.uploadFile(newFileName.getCanonicalPath()); updatePage.setComment(fileName); SitePage sitePage = updatePage.submit().render(); documentLibraryPage = (DocumentLibraryPage) sitePage.render(); FileUtils.forceDelete(newFileName); } }
@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); }
/** * Utility to create events in share for adhoc reports * * @param drone * @param testName * @throws Exception */ public static void userShareInteractions(WebDrone drone, String testName) throws Exception { String testUser = getUserNameForDomain(testName, DOMAIN_FREE); String[] testUserInfo = new String[] {testUser}; String siteName = getSiteName(testName); // Create test user CreateUserAPI.createActivateUserAsTenantAdmin(drone, ADMIN_USERNAME, testUserInfo); // Login as created test user ShareUser.login(drone, testUser, DEFAULT_PASSWORD); // test user creates site SiteUtil.createSite(drone, siteName, AbstractUtils.SITE_VISIBILITY_PUBLIC); String folderName = getFolderName(testName) + System.currentTimeMillis(); // and a folder in sites document library ShareUserSitePage.createFolder(drone, folderName, folderName); // add comment to folder ShareUserSitePage.addComment(drone, folderName, "folderComment"); // create text file in the folder - file-previewed String fileName = getFileName(testName) + "-" + System.currentTimeMillis(); ContentDetails contentDetails = new ContentDetails(); contentDetails.setName(fileName); ShareUserSitePage.createContentInFolder( drone, contentDetails, ContentType.PLAINTEXT, siteName, folderName); ShareUser.openDocumentLibrary(drone); // uploads a file in the folder String fileName1 = getFileName(testName) + System.currentTimeMillis() + "_1" + ".txt"; File file1 = newFile(fileName1, fileName1); ShareUserSitePage.uploadFile(drone, file1); // add comment to file - file-previewed ShareUserSitePage.addComment(drone, fileName1, "fileComment"); ShareUser.openDocumentLibrary(drone); // like file ShareUserSitePage.likeContent(drone, fileName1); // share file ShareUserSitePage.getFileDirectoryInfo(drone, fileName1).clickShareLink().render(); ContentDetails newContentDetails = new ContentDetails(); newContentDetails.setContent(testName); DocumentLibraryPage documentLibPage = ShareUser.openDocumentLibrary(drone); // edit document inline ShareUserSitePage.editTextDocumentInLine(drone, fileName1, newContentDetails).render(); // select all documentLibPage.getNavigation().selectAll().render(); // delete all ConfirmDeletePage confirmDeletePage = documentLibPage.getNavigation().selectDelete().render(); confirmDeletePage.selectAction(ConfirmDeletePage.Action.Delete).render(); // add user with write permissions to write to the site ShareUserMembers.inviteUserToSiteWithRole( drone, testUser, testName, siteName, UserRole.COLLABORATOR); // change the user role ShareUserMembers.assignRoleToSiteMember(drone, testName, siteName, UserRole.CONTRIBUTOR); // Inviting user logs out ShareUser.logout(drone); // Invited User logs in ShareUser.login(drone, testName, DEFAULT_PASSWORD); // user leaves site ShareUserMembers.userRequestToLeaveSite(drone, siteName); }
/** * Creates files in a folder in site's document library * * @param numberOfFiles * @param siteName * @param siteNumber * @throws Exception */ public static void createFilesInSiteFolder( WebDrone drone, String testName, int numberOfFiles, String siteName, int siteNumber, String rule) throws Exception { // Create folder String folderName = getFileName(testName + "_" + siteNumber); DocumentLibraryPage documentLibraryPage = ShareUserSitePage.createFolder(drone, folderName, folderName); // create rule if rule is set if (MOVE_RULE.equalsIgnoreCase(rule)) { FolderRulesPage folderRulesPage = documentLibraryPage.getFileDirectoryInfo(folderName).selectManageRules().render(); Assert.assertTrue(folderRulesPage.isPageCorrect(folderName)); CreateRulePage createRulePage = folderRulesPage.openCreateRulePage().render(); createRulePage.fillNameField("New Move Rule Name"); createRulePage.fillDescriptionField("New Move Rule Description"); ActionSelectorEnterpImpl actionSelectorEnterpImpl = createRulePage.getActionOptionsObj(); // move rule actionSelectorEnterpImpl.selectMove(siteName, "Documents"); FolderRulesPageWithRules folderRulesPageWithRules = createRulePage.clickCreate().render(); Assert.assertTrue(folderRulesPageWithRules.isPageCorrect(folderName)); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); } else if (COPY_RULE.equalsIgnoreCase(rule)) { FolderRulesPage folderRulesPage = documentLibraryPage.getFileDirectoryInfo(folderName).selectManageRules().render(); Assert.assertTrue(folderRulesPage.isPageCorrect(folderName)); CreateRulePage createRulePage = folderRulesPage.openCreateRulePage().render(); createRulePage.fillNameField("New Copy and Transform Rule Name"); createRulePage.fillDescriptionField("New Copy and Transform Rule Description"); ActionSelectorEnterpImpl actionSelectorEnterpImpl = createRulePage.getActionOptionsObj(); // copy rule actionSelectorEnterpImpl.selectTransformAndCopy("XML", siteName, "Documents"); FolderRulesPageWithRules folderRulesPageWithRules = createRulePage.clickCreate().render(); Assert.assertTrue(folderRulesPageWithRules.isPageCorrect(folderName)); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); } documentLibraryPage.selectFolder(folderName).render(); // Create Files for (int i = 0; i <= numberOfFiles - 1; i++) { ContentDetails contentDetails = new ContentDetails(); String fileName = getFileName(testName + "_" + i + "." + "txt"); contentDetails.setName(fileName); contentDetails.setTitle(testName + " title"); contentDetails.setDescription(testName + " description"); contentDetails.setContent(testName + " content"); CreatePlainTextContentPage contentPage = documentLibraryPage.getNavigation().selectCreateContent(ContentType.PLAINTEXT).render(); contentPage.create(contentDetails).render(); ShareUserSitePage.navigateToFolder(drone, folderName); } }