public void createCloudAccount(String testName) throws Exception { String user1 = getUserNameForDomain(testName + "opUser", testDomain); String[] userInfo1 = new String[] {user1}; String cloudUser = getUserNameForDomain(testName + "cloudUser", testDomain); String[] cloudUserInfo1 = new String[] {cloudUser}; String opSite = getSiteName(testName) + "-OP"; String fileName1 = getFileName(testName) + ".txt"; // Create User1 (On-premise) CreateUserAPI.CreateActivateUser(drone, ADMIN_USERNAME, userInfo1); // Create User1 (Cloud) CreateUserAPI.CreateActivateUser(hybridDrone, ADMIN_USERNAME, cloudUserInfo1); CreateUserAPI.upgradeCloudAccount(hybridDrone, ADMIN_USERNAME, testDomain, "1000"); // Login to User1, set up the cloud sync ShareUser.login(drone, user1, DEFAULT_PASSWORD); signInToAlfrescoInTheCloud(drone, cloudUser, DEFAULT_PASSWORD); // create Site ShareUser.createSite(drone, opSite, SITE_VISIBILITY_PUBLIC); // upload a file String[] fileInfo1 = {fileName1, DOCLIB}; ShareUser.uploadFileInFolder(drone, fileInfo1).render(); ShareUser.logout(drone); }
@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 = {"DataPrepDocumentLibrary"}) public void dataPrep_Enterprise40x_14032() throws Exception { String testName = getTestName(); String testUser = getUserNameFreeDomain(testName); String siteName = getSiteName(testName); // 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); // Upload File String fileName = getFileName(testName) + ".txt"; String[] fileInfo = {fileName, DOCLIB}; ShareUser.uploadFileInFolder(drone, fileInfo); }
@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); } }
/** * Enterprise40x-6553:Search for items * * <ul> * <li>Search for Content using Keywords search criteria * <li>Search for Content using Name search criteria * <li>Search for Content using Title search criteria * <li>Search for Content using Description search criteria * <li>Search for Content using Mimetype search criteria * <li>Search for Content using Modified Date search criteria * <li>Search for Content using Modifier search criteria * <li>Click View in Browser icon * <li>Click Download icon * <li>Search for Folder using Keywords search criteria * <li>Search for Folder using Name search criteria * <li>Search for Folder using Title search criteria * <li>Search for Folder using Description search criteria * <li>Click on folder's path * <li>Sort the found items by any criteria * </ul> * * @throws Exception */ @Test(groups = {"Sanity", "Search"}) public void enterprise40x_6553() throws Exception { testName = getTestName(); String searchTerm = testName + "-" + System.currentTimeMillis(); Boolean searchOk; String testUser = getUserNameFreeDomain(searchTerm); String siteName = getSiteName(searchTerm); String folderName = getFolderName(searchTerm + "-1"); String folderName2 = getFolderName(searchTerm + "-2"); String fileName = getFileName(searchTerm); CreateUserAPI.CreateActivateUser(drone, ADMIN_USERNAME, testUser); ShareUser.login(drone, testUser, DEFAULT_PASSWORD); // Create a Site ShareUser.createSite(drone, siteName, SITE_VISIBILITY_PUBLIC).render(); // Open Document library ShareUser.openDocumentLibrary(drone); // Create 2 Folder ShareUserSitePage.createFolder(drone, folderName, folderName + "Title1", folderName + "Desc1"); ShareUserSitePage.createFolder(drone, folderName2, folderName + "Title2", folderName + "Desc2"); // Create 2 Documents for (int i = 0; i < 2; i++) { ContentDetails contentDetails = new ContentDetails(); contentDetails.setName(fileName + "-Name-0" + i); contentDetails.setTitle(fileName + "-Title-0" + i); contentDetails.setDescription(fileName + "-Desc-0" + i); ShareUser.createContent(drone, contentDetails, ContentType.PLAINTEXT); } htmlFileName = fileName + "-Name-0" + TEST_HTML_FILE; ShareUser.uploadFileInFolder(drone, new String[] {htmlFileName}); /** Start Test */ // Searching and sorting the content items List<String> searchInfo = Arrays.asList(ADV_CONTENT_SEARCH); Map<String, String> keyWordSearchText = new HashMap<String, String>(); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Calendar cal = Calendar.getInstance(); String todaysDate = dateFormat.format(cal.getTime()); cal.add(Calendar.DATE, -1); try { keyWordSearchText.put(SearchKeys.KEYWORD.getSearchKeys(), searchTerm); List<SearchResultItem> searchResults = null; // Content Search with keyword: common part of filename searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); // Check the Search Results: Search with Retry for Solr assertTrue( ShareUserSearchPage.checkSearchResultsWithRetry( drone, ADV_CONTENT_SEARCH, searchTerm, fileName + "-Name-01", true), "Incorrect Search Results for: Keyword search- " + searchTerm + " file1 not displayed"); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-00"); Assert.assertTrue( searchOk, "Incorrect Search Results for Name search- " + searchTerm + ". Result item - " + fileName + "-Name-00" + " not found"); keyWordSearchText.clear(); // Searching for valid Name. searchTerm = "-Name-00"; keyWordSearchText.put(SearchKeys.NAME.getSearchKeys(), searchTerm); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + searchTerm); Assert.assertTrue(searchOk, "Incorrect Search Results for Name search- " + searchTerm); keyWordSearchText.clear(); // Searching for valid Title string searchTerm = "-Title-01"; keyWordSearchText.put(SearchKeys.TITLE.getSearchKeys(), searchTerm); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-01"); Assert.assertTrue(searchOk, "Incorrect Search Results for Name search- " + searchTerm); keyWordSearchText.clear(); // Searching for valid Description string searchTerm = "-Desc-01"; keyWordSearchText.put(SearchKeys.DESCRIPTION.getSearchKeys(), searchTerm); ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-01"); Assert.assertTrue(searchOk, "Incorrect Search Results for Name search- " + searchTerm); keyWordSearchText.clear(); // Searching for valid MODIFIERTODATE string keyWordSearchText.put(SearchKeys.MODIFIERTODATE.getSearchKeys(), todaysDate); keyWordSearchText.put(SearchKeys.MODIFIERFROMDATE.getSearchKeys(), todaysDate); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); assertTrue( searchResults.size() > 0, "There should be search results for to date - " + todaysDate); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-01"); Assert.assertTrue( searchOk, "Incorrect Search Results for Name search- " + keyWordSearchText + ". Result item - " + fileName + "-Name-00"); keyWordSearchText.clear(); // Searching for valid Name and Mime type. keyWordSearchText.put(SearchKeys.MIME.getSearchKeys(), "HTML"); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); assertTrue(searchResults.size() > 0, "There should be search results for html MIME TYPE."); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, htmlFileName); Assert.assertTrue( searchOk, "Incorrect Search Results for Name search- " + keyWordSearchText + ". Result item - " + fileName + "-Name-00" + " not found"); searchResults.clear(); keyWordSearchText.clear(); // Searching for valid Name and Mime type. keyWordSearchText.put(SearchKeys.MODIFIER.getSearchKeys(), testUser); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); assertTrue( searchResults.size() > 0, "There should be search results for " + testUser + " as modifier."); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-00"); Assert.assertTrue( searchOk, "Incorrect Search Results for Name search- " + keyWordSearchText + ". Result item - " + fileName + "-Name-00" + " not found"); searchResults.clear(); keyWordSearchText.clear(); // Folder Search: Searching with keyword searchInfo = Arrays.asList(ADV_FOLDER_SEARCH); searchTerm = folderName; keyWordSearchText.put(SearchKeys.KEYWORD.getSearchKeys(), searchTerm); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, folderName); Assert.assertTrue( searchOk, "Incorrect Search Results for Name search- " + searchTerm + ". Result item - " + fileName + "-Name-00" + " not found"); keyWordSearchText.clear(); // Searching for valid Name. keyWordSearchText.put(SearchKeys.NAME.getSearchKeys(), searchTerm); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); assertTrue(searchResults.size() > 0, "There should be search results for name on folder."); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, folderName); Assert.assertTrue( searchOk, "Incorrect Search Results for Name search- " + searchTerm + ". Result item - " + fileName + "-Name-00" + " not found"); keyWordSearchText.clear(); // Searching for valid Title string keyWordSearchText.put(SearchKeys.TITLE.getSearchKeys(), searchTerm); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); assertTrue(searchResults.size() > 0, "There should be search results for title on folder."); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, folderName); Assert.assertTrue( searchOk, "Incorrect Search Results for Name search- " + searchTerm + ". Result item - " + folderName + " not found"); keyWordSearchText.clear(); // Searching for valid Description string keyWordSearchText.put(SearchKeys.DESCRIPTION.getSearchKeys(), searchTerm); searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText); assertTrue( searchResults.size() > 0, "There should be search results for description on folder."); searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, folderName); Assert.assertTrue( searchOk, "Incorrect Search Results for Name search- " + searchTerm + ". Result item - " + folderName + " not found"); // Sorting results by Name List<SearchResultItem> sortedByName = ShareUserSearchPage.sortSearchResults(drone, SortType.NAME); List<SearchResultItem> expectedResultsSortedByName = new ArrayList<SearchResultItem>(sortedByName); Collections.sort(expectedResultsSortedByName, new SortedSearchResultItemByName()); // Check Sort order for (int i = 0; (i < 5 && i < expectedResultsSortedByName.size()); i++) { assertTrue( expectedResultsSortedByName .get(i) .getTitle() .equalsIgnoreCase(sortedByName.get(i).getTitle()), "The results are not sorted as expected - " + expectedResultsSortedByName.get(i).getTitle() + " - " + sortedByName.get(i).getTitle()); } } catch (Throwable e) { reportError(drone, testName, e); } finally { testCleanup(drone, testName); } }
/** 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"); }