Skip to content

Instantly share code, notes, and snippets.

@angiejones
Last active January 31, 2021 05:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save angiejones/746425b97b7d89523ec0f3c6c6b98f27 to your computer and use it in GitHub Desktop.
Playwright tests
package search;
import base.BaseTests;
import org.testng.annotations.Test;
import pages.SearchPage;
import java.util.List;
import static org.testng.Assert.*;
public class SearchTests extends BaseTests {
@Test
public void searchForExactTitle(){
String title = "Agile Testing";
searchPage.search(title);
assertEquals(searchPage.getNumberOfVisibleBooks(), 1, "Number of visible books");
assertTrue(searchPage.getVisibleBooks().contains(title), "Title of visible book");
}
@Test
public void searchForPartialTitle(){
searchPage.search("Test");
List<String> expectedBooks = List.of(
"Test Automation in the Real World",
"Experiences of Test Automation",
"Agile Testing",
"How Google Tests Software",
"Java For Testers"
);
assertEquals(searchPage.getNumberOfVisibleBooks(), expectedBooks.size(), "Number of visible books");
assertEquals(searchPage.getVisibleBooks(), expectedBooks,"Titles of visible books");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment