@Test( dataProvider = AtlasConstants.INVALID_SEARCH_STRING, dataProviderClass = SearchPage.class, priority = 10) public void invalidSearchResult(String invalidQuery) { LOGGER.info("STARTED: Test verifySearchResultNegative"); searchPage.searchQuery(invalidQuery); // atlasDriver utility function - >customWait(10); AtlasDriverUtility.waitUntilElementVisible( searchPage.searchPageElements.noResultFound, 50); // Waiting for // "no result found" // notification // to appear // on screen Assert.assertTrue( searchPage.searchPageElements.noResultFound.isDisplayed(), "An Alert Banner displayed"); String expectedMessage = "No Result found"; String actualMessage = searchPage .searchPageElements .noResultFound .findElement(By.cssSelector(".ng-binding")) .getText(); Assert.assertEquals(actualMessage, expectedMessage, "No Result found message displayed"); AtlasDriverUtility.waitUntilElementVisible(searchPage.searchPageElements.noResultFound, 10); WebElement close = searchPage.searchPageElements.noResultFound.findElement(By.tagName("button")); Assert.assertTrue(close.isDisplayed(), "Alert message displayed"); close.click(); LOGGER.info("ENDED: Test verifySearchResultNegative"); }
@Test(priority = 18) public void validateTagInSearchResult() { LOGGER.info("STARTED: Test validateTagInSearchResult"); String SEARCH_QUERY = "Table"; searchPage.searchQuery(SEARCH_QUERY); if (searchPage.getSearchResultCount() > 0) { Assert.assertFalse(SearchPage.isPreviousButtonDisabled, "Previous Button disabled"); Assert.assertTrue(SearchPage.isNextButtonEnabled, "Next Button enabled"); searchPage.clickOnTag("Employee:Fact"); Assert.assertTrue(SearchPage.isPreviousButtonEnabled, "Previous Button enabled"); Assert.assertFalse(!SearchPage.isNextButtonDisabled, "Next Button disabled"); } LOGGER.info("ENDED: Test validateTagInSearchResult"); }
@Test(priority = 16) public void validateSearchResultCount() { LOGGER.info("STARTED: Test validateSearchResult"); Select select = new Select(searchPage.searchPageElements.selectOnSearchPage); select.selectByIndex(0); String SEARCH_QUERY = "Table"; searchPage.searchQuery(SEARCH_QUERY); String expectedMessage = searchPage.searchPageElements.resultCount.getText(); if (searchPage.getSearchResultCount() > 0) { Assert.assertTrue(searchPage.getSearchResultCount() > 0, expectedMessage); } LOGGER.info("ENDED: Test validateSearchResult"); }
@Test( dataProvider = AtlasConstants.SEARCH_STRING, dataProviderClass = SearchPage.class, priority = 15) public void validateSearchQueries(String token) { LOGGER.info("STARTED: Test validatePagination"); searchPage.searchQuery(token.toString()); AtlasDriverUtility.customWait(1); int searchCount = searchPage.getSearchResultCount(); if (searchCount == 0) { LOGGER.info("No results found"); Assert.assertTrue( !webElement.isElementExists(searchPage.searchPageElements.resultTable), "Table not displayed for no result"); } LOGGER.info("Searching with query : " + token + " to assert with row count as " + searchCount); AtlasDriverUtility.customWait(1); Assert.assertTrue( webElement.isElementExists(searchPage.searchPageElements.paginationPrevious), "Previous button displayed"); String prevButtonState = searchPage.searchPageElements.paginationPrevious.getAttribute("class").toString(); Assert.assertTrue( prevButtonState.contains(AtlasConstants.BUTTON_ATTRIBUTE_AS_DISBALED), "Previous button disabled"); Assert.assertTrue( webElement.isElementExists(searchPage.searchPageElements.paginationNext), "Next button displayed"); String nextButtonState = searchPage.searchPageElements.paginationNext.getAttribute("class").toString(); if (searchCount < 10) { Assert.assertTrue( nextButtonState.contains(AtlasConstants.BUTTON_ATTRIBUTE_AS_DISBALED), "Next button disabled"); } else if (searchCount > 10) { Assert.assertTrue( !nextButtonState.contains(AtlasConstants.BUTTON_ATTRIBUTE_AS_DISBALED), "Next button enabled"); } LOGGER.info("ENDED: Test validatePagination"); }
@Test(priority = 14) public void validateSearchFunctionalty() { LOGGER.info("STARTED: Test searchTestMethod"); searchPage.searchQuery("Fact"); LOGGER.info("ENDED: Test searchTestMethod"); }