Skip to content

Instantly share code, notes, and snippets.

@batmi02
Created November 8, 2019 18:49
Embed
What would you like to do?
@Test
@UseDataProvider("testForDataFailure")
public void testLoginFailure(String username, String password, String expected, String testName, string locatorId) {
//try loggin in with username and password
login(username,password);
//get the text from the alert element
String actual = driver.findElement(By.id("alert")).getText();
assertEquals(testName, expected, actual);
}
@Test
@UseDataProvider("testForDataSuccess")
public void testLoginSuccess(String username, String password, String expected, String testName, string locatorId) {
//try loggin in with username and password
login(username,password);
//get the text from the alert element
String actual = driver.findElement(By.id("logged-user-name")).getText();
assertEquals(testName, expected, actual);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment