Skip to content

Instantly share code, notes, and snippets.

@ultimate-qa2
Created March 28, 2021 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ultimate-qa2/a1b03ed01937d279230d09bddcf8eb34 to your computer and use it in GitHub Desktop.
Save ultimate-qa2/a1b03ed01937d279230d09bddcf8eb34 to your computer and use it in GitHub Desktop.
@Test
public void noCredentialsTest() {
WebElement _loginButton = driver.findElement(By.id("login-button"));
_loginButton.click();
WebElement _errorMessage = driver.findElement(By.xpath("//h3[@data-test='error']"));
// Validate that the message is displayed:
Assert.assertTrue(_errorMessage.isDisplayed());
// Validate the message contains the correct text:
Assert.assertTrue(_errorMessage.getText().equals("Epic sadface: Username is required"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment