From 97a64f34984fb2cd79f590c164a936c3474dc01c Mon Sep 17 00:00:00 2001 From: felipedanielsousa Date: Fri, 27 Oct 2023 14:41:04 -0300 Subject: [PATCH] Atividade 2 - Semana 12 --- src/test/java/felipe/Atividade02.java | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/java/felipe/Atividade02.java diff --git a/src/test/java/felipe/Atividade02.java b/src/test/java/felipe/Atividade02.java new file mode 100644 index 0000000..6bc86d7 --- /dev/null +++ b/src/test/java/felipe/Atividade02.java @@ -0,0 +1,29 @@ +package felipe; + +import mickhill.Hooks; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +public class Atividade02 extends Hooks { + public static final String BASE_URL = "https://the-internet.herokuapp.com/login"; + @Test + @DisplayName("Login com sucesso") + public void successLogin() throws InterruptedException { + driver.navigate().to(BASE_URL); + + By usernameField = By.id("username"); + driver.findElement(usernameField).sendKeys("tomsmith"); + By passwordField = By.id("password"); + driver.findElement(passwordField).sendKeys("SuperSecretPassword!"); + By loginButton = By.id("login"); + driver.findElement(loginButton).submit(); + + //Assertion + Assertions.assertTrue(driver.getCurrentUrl().equals("https://the-internet.herokuapp.com/secure")); + Assertions.assertTrue(driver.getPageSource().contains("You logged into a secure area!")); + Thread.sleep(3000); + + } +}