@Test( description = "Test to validate the highlight of tag remains even after addition of a new tag to the tag cloud.", groups = TestGroups.EXISTING_TAG_NEEDED_GROUP) protected void testTagAdditionAfterTagSelectedInCloud() { IndexPage indexPage = getIndexPageLoaded(); String tagSelected = existingTagOneName; String[] uniqueStbIdsForSelectedTag = existingTagOneUniqueStbIds; // Selecting the tag element. indexPage.clickOnTagCloudTagElement(tagSelected); // Validating to see that only list of STB available in selected tag is getting displayed failTestIfUniqueStbsNotFoundInFilteredTable(indexPage, uniqueStbIdsForSelectedTag); // Selecting one of the STB tagged to tag one. if (null != uniqueStbIdsForSelectedTag && uniqueStbIdsForSelectedTag.length > 0) { // Getting a STB that is already tagged with the selected tag in tag cloud. String stbIdForTagging = uniqueStbIdsForSelectedTag[0]; String newTestTagName = createDynamicTestTagNames(); // Adding a new tag with the STB that is available on the selected tag in tag cloud. addTagFromIndexPage(indexPage, newTestTagName, stbIdForTagging); // Validating the highlight still remain on the first tag after addition of new tag. Assert.assertTrue( indexPage.isTagSelectedInTagCloud(tagSelected), "Failed to find highlight on the previously selected tag after the addition of a new tag."); // Validating to see that only list of STB available on selected tag is getting // displayed after new tag addition. failTestIfUniqueStbsNotFoundInFilteredTable(indexPage, uniqueStbIdsForSelectedTag); // Validate whether the delete option appears for both the tags since STB id remains // in selected mode. Assert.assertTrue( indexPage.isDeleteOptionDisplayedInTag(tagSelected), String.format( "Delete option does not appear for the tag (%s) when STB (%s) is selected.", tagSelected, stbIdForTagging)); Assert.assertTrue( indexPage.isDeleteOptionDisplayedInTag(newTestTagName), String.format( "Delete option does not appear for the tag (%s) when STB (%s) is selected.", newTestTagName, stbIdForTagging)); } else { Assert.fail(String.format("No STBs are available on the tag one(%s)", tagSelected)); } }
@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 that device getting hidden from index page is getting deselected. Selected non hidden device remains selected.", groups = TestGroups.EXISTING_TAG_NEEDED_GROUP) protected void testDeviceIdDeselectionWhenHidden() { IndexPage indexPage = getIndexPageLoaded(); // Selecting the tag one. indexPage.clickOnTagCloudTagElement(existingTagOneName); // Validating the tag got highlighted or not. Assert.assertTrue( indexPage.isTagSelectedInTagCloud(existingTagOneName), "On click of tag one highlight does not happen."); // Continue the test if the tag one have atleast one device ID. Assert.assertTrue( ((null != existingTagOneUniqueStbIds) && (existingTagOneUniqueStbIds.length > 0)), "No devices tagged to tag one. Prerequisite of the test failed."); String deviceIdCommonForTagOneAndTwo = existingTagOneUniqueStbIds[0]; // Select check box of common stb that is available in tag one and tag three. indexPage.selectStbCheckboxes(deviceIdCommonForTagOneAndTwo); // Validating the delete option is displayed for both tags when the common tagged device // id is selected. Assert.assertTrue( indexPage.isDeleteOptionDisplayedInTag(existingTagOneName), String.format( "Delete option does not appear for the existing tag one(%s) when STB (%s) is selected.", existingTagOneName, deviceIdCommonForTagOneAndTwo)); Assert.assertTrue( indexPage.isDeleteOptionDisplayedInTag(existingTagThreeWithTagOneStbs), String.format( "Delete option does not appear for the existing tag three(%s) when STB (%s) is selected.", existingTagThreeWithTagOneStbs, deviceIdCommonForTagOneAndTwo)); // Selecting the second tag inorder to validate that the delete option of previous selected // tag and checked status of device id remains indexPage.clickOnTagCloudTagElement(existingTagTwoName); Assert.assertTrue( indexPage.isTagSelectedInTagCloud(existingTagTwoName), "On click of tag two highlight does not happen."); Assert.assertTrue( indexPage.isStbCheckboxElementSelected(deviceIdCommonForTagOneAndTwo), String.format( "Device(%s) check box field selection goes off when second tag got selected.", deviceIdCommonForTagOneAndTwo)); // Validating whether the delete option still persist when the device id of previously // selected tag remains on the display area. Assert.assertTrue( indexPage.isDeleteOptionDisplayedInTag(existingTagOneName), String.format( "After selection of second tag, delete option does not prevails for the existing tag one(%s) when STB (%s) remains as selected.", existingTagOneName, deviceIdCommonForTagOneAndTwo)); Assert.assertTrue( indexPage.isDeleteOptionDisplayedInTag(existingTagThreeWithTagOneStbs), String.format( "After selection of second tag, delete option does not prevails for the existing tag three(%s) when STB (%s) remains as selected.", existingTagThreeWithTagOneStbs, deviceIdCommonForTagOneAndTwo)); // Deselecting tag one so that all the device ID of tag one gets hidden. indexPage.clickOnTagCloudTagElement(existingTagOneName); // Validation to see that only device ID of tag two remains displayed. failTestIfUniqueStbsNotFoundInFilteredTable(indexPage, existingTagTwoUniqueStbIds); // Validating the delete option of tags gets removed when a previously selected device ID // become hidden. Assert.assertFalse( indexPage.isDeleteOptionDisplayedInTag(existingTagOneName), String.format( "Delete option still persist for existing tag one(%s) after the deselection of existing tag one.", existingTagOneName)); Assert.assertFalse( indexPage.isDeleteOptionDisplayedInTag(existingTagThreeWithTagOneStbs), String.format( "Delete option still persist for existing tag three(%s) after the deselection of existing tag one.", existingTagThreeWithTagOneStbs)); // Selecting tag one again to see the device Id is not in selected mode. indexPage.clickOnTagCloudTagElement(existingTagOneName); Assert.assertFalse( indexPage.isStbCheckboxElementSelected(deviceIdCommonForTagOneAndTwo), String.format( "Device(%s) remains selected when brought to display after hiding.", deviceIdCommonForTagOneAndTwo)); }