/** 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"); }