Skip to content

Instantly share code, notes, and snippets.

@GuilhermeManzano
Created December 13, 2020 22:04
Show Gist options
  • Save GuilhermeManzano/0a46920a149d5f7347d43da19f671fd4 to your computer and use it in GitHub Desktop.
Save GuilhermeManzano/0a46920a149d5f7347d43da19f671fd4 to your computer and use it in GitHub Desktop.
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ChromeDriver;
public class TaskTest {
@Test
public void deveSalvarTarefaComSucesso() {
WebDriver driver = new ChromeDriver();
driver.navigate().to("http://localhost:8001/tasks");
driver.manage().timeouts().implicityWait(10, TimeUnit.SECONDS);
//clicar em Add ToDo
driver.findElement(By.id("addTodo")).click();
//escrever descrição
driver.findElement(By.id("task")).sendKeys("Teste via Selenium");
//Escrever a data
driver.findElement(By.id("dueDate")).sendKeys("10/10/2030");
//clicar em salvar
driver.findElement(By.id("saveButton")).click();
//validar mensagem de sucesso
String message = driver.findElement(By.id("message")).getText();
Assert.assertEquals("Sucess!", message);
//fechar o browser
driver.quit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment