Created
February 2, 2022 09:57
-
-
Save KrishnB/3507c1b733abc4783f4f9e6a8f649afc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.testng.Assert; | |
import org.testng.annotations.Test; | |
public class SearchTests { | |
@Test | |
public void verifyIfSearchTermShowsRelevantResults() { | |
//Arrange | |
String searchItem = "Jeans"; | |
String searchKey = "Jean"; | |
LauncherPage launcherPage = new LauncherPage(webdriver); // Assume webdriver is created and // handy | |
launcherPage.navigateTo("https://web-playground.ultralesson.com/"); | |
//Act | |
HomePage homepage = new HomePage(webdriver); | |
homepage.search(searchItem); | |
List<Item> searchItems = homepage.getSearchItems(); | |
//Assert | |
Assert.assertEquals(4, searchItems.size()); | |
Assert.assertTrue(searchItems.stream().allMatch(item -> item.getName().contains("Jean"))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment