Skip to content

Instantly share code, notes, and snippets.

@batmi02
Created November 8, 2019 18:49
Show Gist options
  • Save batmi02/e9d52f8eb47ee6acefc9c2a4d2ca7c98 to your computer and use it in GitHub Desktop.
Save batmi02/e9d52f8eb47ee6acefc9c2a4d2ca7c98 to your computer and use it in GitHub Desktop.
@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