@Test( description = "Test to verify the deletion of a STB from tag and a complete deletion of a tag from tag cloud.", groups = TestGroups.DELETION_TAG_REQUIRED_GROUP) protected void testDeletionOfTags() { IndexPage indexPage = getIndexPageLoaded(); // Select check box of common stb that is available in two of the tags. indexPage.selectStbCheckboxes(existingDeletionTagTwoStbId); // Validate whether the delete option appears for both the tags when common STB id is // selected. Assert.assertTrue( indexPage.isDeleteOptionDisplayedInTag(existingDeletionTagOneName), String.format( "Delete option does not appear for the tag (%s) when STB (%s) is selected.", existingDeletionTagOneName, existingDeletionTagTwoStbId)); Assert.assertTrue( indexPage.isDeleteOptionDisplayedInTag(existingDeletionTagTwoName), String.format( "Delete option does not appear for the tag (%s) when STB (%s) is selected.", existingDeletionTagTwoName, existingDeletionTagTwoStbId)); // Deleting the selected STB content from first tag. indexPage.clickOnTagDeleteOptionAndConfirmDeletion(existingDeletionTagOneName); // Validating the tag count get reduced by one. validateTagCloudTagCount( indexPage, existingDeletionTagOneName, existingDeletionTagOneStbIds.length - 1); // Validating delete option on existing tag one got removed. Assert.assertFalse( indexPage.isDeleteOptionDisplayedInTag(existingDeletionTagOneName), "Deletion option is still getting displayed even after the removal of one tagged STB."); // Clicking on delete option on second tag. indexPage.clickOnTagDeleteOptionAndConfirmDeletion(existingDeletionTagTwoName); // Validate the second tag having single STB gets removed. String tagCloudElementText = indexPage.refreshPageAndGetTagCloudElementText(); Assert.assertFalse( tagCloudElementText.contains(existingDeletionTagTwoName), String.format( "The deletion of second tag(%s) failed, returned tag cloud texts is [%s].", existingDeletionTagTwoName, tagCloudElementText)); }
@Test( description = "Test to verify the deletion of a STB from tag when it is highlighted in tag cloud.", groups = TestGroups.DELETION_SELECTED_TAG_GROUP) protected void testDeletionWhileTagIsSelected() { IndexPage indexPage = getIndexPageLoaded(); // Selecting the tag element. indexPage.clickOnTagCloudTagElement(existingDeletionTagThreeName); // Validating the tag got highlighted. Assert.assertTrue( indexPage.isTagSelectedInTagCloud(existingDeletionTagThreeName), "On click of tag failed to select the tag."); // Selecting one of the STB for deletion from tag. if (null != existingDeletionTagThreeStbIds && existingDeletionTagThreeStbIds.length > 1) { // Select check box of common stb that is available in two of the tags. indexPage.selectStbCheckboxes(existingDeletionTagThreeStbIds[0]); // Deleting the selected STB content from first tag. indexPage.clickOnTagDeleteOptionAndConfirmDeletion(existingDeletionTagThreeName); // Validating the tag count get reduced by one to confirm the STB got removed. validateTagCloudTagCount( indexPage, existingDeletionTagThreeName, existingDeletionTagThreeStbIds.length - 1); // Validating the tag previously selected before deletion of tag remain highlighted. Assert.assertTrue( indexPage.isTagSelectedInTagCloud(existingDeletionTagThreeName), "The highlight on tag got removed after removal of a STB from highlighted tag."); } else { String failureMessage = (null == existingDeletionTagThreeStbIds) ? "No STBs are tagged under the existing tag three (%s) awaiting for deletion." : "The total STBs tagged under the existing tag three (%s) awaiting for deletion is only one. It expects more than one for deletion."; Assert.fail(String.format(failureMessage, existingDeletionTagThreeName)); } }