/** 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"); }
/** AONE-15601:Form - Items - Select Items */ @Test(groups = "Hybrid", enabled = true) public void AONE_15601() throws Exception { String testName = getTestName() + System.currentTimeMillis(); String user1 = getUserNameForDomain(testName + "opUser", testDomain); String opSite = getSiteName(testName) + "-OP"; String fileName1 = getFileName(testName) + ".txt"; createCloudAccount(testName); // Login as OP user ShareUser.login(drone, user1, DEFAULT_PASSWORD); // ---- Step 1---- // --- Step action --- // Click on Add button. // --- Expected results --- // Select window is opened. Company Home directory is opened by default. WorkFlowPage workflow = ShareUserWorkFlow.startCloudReviewTaskWorkFlow(drone).render(); SelectContentPage selectPage = workflow.clickAddItems(); // ---- Step 2 ---- // --- Step action --- // Verify the available controls. // --- Expected results --- /** * The section contains the following controls: - Folder Up picker (disabled when root directory * is chosen) - Navigator (contains parent directory structure) - Available Items section * (Directories from Company Home are displayed) - Selected Items section ('No items selected' * when no items are chosen) - OK button - Cancel button */ Assert.assertFalse( selectPage.isFolderUpButtonEnabled(), "Folder Up button is enabled by default"); Assert.assertEquals( selectPage.getNoItemsSelected(), "No items selected", "'No items selected' text is not displayed when no items are chosen"); Assert.assertTrue(selectPage.isOkButtonPresent()); Assert.assertTrue(selectPage.isCancelButtonPresent()); Assert.assertTrue(selectPage.isCompanyHomeButtonPresent(), "Company button is not displayed"); List<String> elements = selectPage.getDirectoriesLeftPanel(); Assert.assertTrue( elements.contains("Data Dictionary") && elements.contains("Guest Home") && elements.contains("Imap Attachments") && elements.contains("IMAP Home") && elements.contains("Shared") && elements.contains("Sites") && elements.contains("User Homes"), "Default directories from Company Home are NOT displayed"); // ---- Step 3 ---- // --- Step action --- // Open any directory, e.g. Sites // --- Expected results --- // The directory is opened. Folder Up picker becomes enabled. selectPage.clickElementOnLeftPanel("Sites"); Assert.assertTrue( selectPage.isFolderUpButtonEnabled(), "Folder Up is not active after selection child object"); // ---- Step 4 ---- // --- Step action --- // Click on Folder Up picker. // --- Expected results --- // Company Home directory is opened again. selectPage.clickFolderUpButton(); Assert.assertTrue( selectPage.isCompanyHomeButtonPresent(), "Company Home directory is not displayed after using Up button"); // ---- Step 5 ---- // --- Step action --- // Open any directory, e.g. Sites. // --- Expected results --- // The directory is opened. selectPage.clickElementOnLeftPanel("Sites"); // ---- Step 6 ---- // --- Step action --- // Open Company Home using Navigator. // --- Expected results --- // Company Home directory is opened again. selectPage.navigateToRootDir(); Assert.assertTrue( selectPage.isCompanyHomeButtonPresent(), "Company Home is not displayed after navigation"); // ---- Step 7 ---- // ---- Step 8 ---- // ---- Step 9 ---- // --- Step action --- // Navigate to the directory where the added in the pre-condition document is located. // Click on Add icon. // --- Expected results ---- // The directory is opened. // The document appears in the Selected Items section. Add icon disappears for the added // document. Remove icon is present for the document which is // present in the Selected Items section. selectPage.addItemFromSite(fileName1, opSite); Assert.assertFalse( selectPage.isAddIconPresent(fileName1), "Add icon is not disabled after adding the file to workflow"); List<String> addedItems = selectPage.getAddedItems(); Assert.assertTrue( addedItems.contains(fileName1), "Added File is not displayed for Added section"); Assert.assertTrue( selectPage.isRemoveIconPresent(fileName1), "Remove button is not displayed for added content"); // ---- Step 10 ---- // --- Step action --- // Click on Remove icon. // --- Expected results ---- // The document disappears from the Selected Items section. Add icon appears for the removed // document in the Available Items section. selectPage.removeItem(fileName1); addedItems = selectPage.getAddedItems(); Assert.assertFalse( addedItems.contains(fileName1), "File is still displayed for added section after removing."); Assert.assertTrue( selectPage.isAddIconPresent(fileName1), "Add button for the file is not displayed after removing."); // ---- Step 11 ---- // ---- Step action ---- // Repeat step 9. // ---- Expected results ----- // The document appears in the Selected Items section. Add icon disappears for the added // document. Remove icon is present for the document which is // present in the Selected Items section. selectPage.addItemFromSite(fileName1, opSite); addedItems = selectPage.getAddedItems(); Assert.assertTrue( addedItems.contains(fileName1), "Added File is not displayed for Added section"); Assert.assertTrue( selectPage.isRemoveIconPresent(fileName1), "Remove icon is not displayed for Added file"); Assert.assertFalse( selectPage.isAddIconPresent(fileName1), "Add icon is not disabled after adding the file to workflow"); // ---- Step 12 ---- // --- Step action --- // Click on Close button. // --- Expected results ---- // The window is closed. No data was changed in Selected Items section - no document was added. selectPage.selectCloseButton(); CloudTaskOrReviewPage cloudTaskOrReviewPage = new CloudTaskOrReviewPage(drone); Assert.assertTrue( cloudTaskOrReviewPage.isNoItemsSelectedMessagePresent(), "Content has been added after closing Select window"); // ---- Step 13 ---- // ---- Step action --- // Verify the Remove All button. // ---- Expected results ---- // The button is disabled. Assert.assertFalse( cloudTaskOrReviewPage.isRemoveAllButtonEnabled(), "Button is enabled after closing Select window"); // ---- Step 14 ---- // --- Step action --- // Repeat steps 1-9. // ---- Expected results ---- // The latest opened directory is opened in the window (step 2). The previously chosen document // is displayed in the Selected Items section (step 2). The // document is chosen. selectPage = workflow.clickAddItems(); selectPage.removeItem(fileName1); selectPage.addItemFromSite(fileName1, opSite); // ---- Step 15 ---- // ---- Step action ---- // Click on Cancel button. // ---- Expected results ---- // The window is closed. No data was changed in Selected Items section - no document was added. selectPage.selectCancelButton(); Assert.assertTrue( cloudTaskOrReviewPage.isNoItemsSelectedMessagePresent(), "Content has been added after canceling Select window"); // ---- Step 16 ---- // ---- Step action ---- // Verify the Remove All button. // ----- Expected results ---- // The button is disabled. Assert.assertFalse( cloudTaskOrReviewPage.isRemoveAllButtonEnabled(), "Button is enabled after canceling Select window"); // ---- Step 17 ---- // --- Step action --- // Repeat steps 1-9. // ---- Expected results ---- // The latest opened directory is opened in the window (step 2). The previously chosen document // is displayed in the Selected Items section (step 2). The // document is chosen. selectPage = workflow.clickAddItems(); selectPage.removeItem(fileName1); selectPage.addItemFromSite(fileName1, opSite); // ---- Step 18 ---- // --- Step action --- // Click on OK button. // ---- Expected results ---- // The window is closed. The data was changed in Selected Items section - the document was // added. selectPage.selectOKButton(); List<SelectedWorkFlowItem> selectedWorkFlowItems = workflow.getSelectedItem(fileName1); String itemName = selectedWorkFlowItems.get(0).getItemName(); Assert.assertEquals(itemName, fileName1, "File was not added to workflow."); // ---- Step 19 ---- // --- Step action --- // Verify the Remove All button. // ---- Expected results ---- // The button is enabled. Assert.assertTrue( cloudTaskOrReviewPage.isRemoveAllButtonEnabled(), "Remove all button is still disabled after addition file"); }