mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 13:35:50 +00:00
fixed 1 test
This commit is contained in:
parent
29dc4b634f
commit
b137e5a64f
3 changed files with 9 additions and 3 deletions
|
@ -31,16 +31,19 @@ public class AddOwnerIT extends SeleniumBaseIT {
|
|||
fillTextField(By.name("city"), "Enschede");
|
||||
fillTextField(By.name("telephone"), "0534890000");
|
||||
driver.findElement(By.name("telephone")).submit();
|
||||
new WebDriverWait(driver, 5).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[text()='Owner Information']")));
|
||||
Assert.assertTrue(pageContainsText("Sophie Lathouwers"));
|
||||
|
||||
//Add a pet
|
||||
new WebDriverWait(driver, 3).until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.linkText("Add New Pet")));
|
||||
driver.findElement(By.linkText("Add New Pet")).click();
|
||||
new WebDriverWait(driver, 5).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[text()='Pets and Visits']")));
|
||||
driver.findElements(By.className("btn")).get(1).click();
|
||||
new WebDriverWait(driver, 5).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[text()='New']")));
|
||||
fillTextField(By.name("name"), "Thumper");
|
||||
fillTextField(By.name("birthDate"), "1942/08/09");
|
||||
new Select(driver.findElement(By.name("type"))).selectByValue("hamster");
|
||||
driver.findElement(By.name("name")).submit();
|
||||
|
||||
new WebDriverWait(driver, 5).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[text()='Pets and Visits']")));
|
||||
Assert.assertTrue(pageContainsText("Thumper"));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
|
@ -23,6 +25,7 @@ public class FindOwnerIT extends SeleniumBaseIT {
|
|||
driver.get(BASE_URL+"/owners/find");
|
||||
fillTextField(By.name("lastName"),"Coleman");
|
||||
driver.findElement(By.name("lastName")).submit();
|
||||
new WebDriverWait(driver, 5).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[text()='Owner Information']")));
|
||||
Assert.assertTrue(driver.findElementsByXPath("//*[text()='Jean Coleman']").size() == 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class SeleniumBaseIT {
|
|||
public SeleniumBaseIT() throws MalformedURLException {
|
||||
// System.setProperty("webdriver.chrome.driver","C:\\Users\\marti\\Downloads\\chromedriver_win32\\chromedriver.exe");
|
||||
// this.driver = new ChromeDriver();
|
||||
this.driver = new RemoteWebDriver(new URL("http://selenium:4444/wd/hub"), DesiredCapabilities.firefox());
|
||||
this.driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), DesiredCapabilities.firefox());
|
||||
driver.get(BASE_URL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue