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