ExpectedCondition tests
This commit is contained in:
parent
328c6e810e
commit
cfe9535e18
|
@ -13,12 +13,19 @@ import org.testng.annotations.Test;
|
|||
|
||||
public class BasicTest {
|
||||
private WebDriver driver;
|
||||
private WebDriverWait wait;
|
||||
String URL = "https://0.fredldev.fremo-net.eu";
|
||||
|
||||
@BeforeClass
|
||||
public void testSetUp() {
|
||||
|
||||
driver = new HtmlUnitDriver(true);
|
||||
wait = new WebDriverWait(driver, 15);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void tearDown() {
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -31,16 +38,21 @@ public class BasicTest {
|
|||
@Test
|
||||
public void verifyLoginAsSystemUser() {
|
||||
driver.navigate().to(URL);
|
||||
WebElement loginButton = wait.until(elementToBeClickable(By.name("doLogin"));
|
||||
|
||||
driver.findElement(By.name("login")).sendKeys("system");
|
||||
driver.findElement(By.name("password")).sendKeys("system");
|
||||
driver.findElement(By.name("doLogin")).click();
|
||||
loginButton.click();
|
||||
|
||||
//driver.findElement(By.xpath("//input[@name='login']")).sendKeys("system");
|
||||
//driver.findElement(By.xpath("//input[@name='password']")).sendKeys("system");
|
||||
//driver.findElement(By.xpath("//input[@name='doLogin']")).submit();
|
||||
WebDriverWait waitForLoginDone = new WebDriverWait(driver, 15);
|
||||
//waitForLoginDone.until(ExpectedConditions.ElementIsVisible(By.xpath("//input[@class='menu'][0]"));
|
||||
waitForLoginDone.until(ExpectedConditions.ElementIsVisible(By.className("menu")));
|
||||
driver.switchTo().frame("oben");
|
||||
//wait.until(ExpectedConditions.ElementIsVisible(By.xpath("//input[@class='menu'][0]"));
|
||||
//wait.until(ExpectedConditions.ElementIsVisible(By.className("menu")));
|
||||
wait.until(titleIs("FreDL"));
|
||||
//driver.switchTo().frame("oben");
|
||||
WebElement obenFrame = wait.until(frameToBeAvailableAndSwitchToIt("oben");
|
||||
|
||||
String versionInfo = driver.findElement(By.xpath("/table/tr/td/b")).getText();
|
||||
String userInfo = driver.findElement(By.xpath("/table/tr/td[3]")).getText();
|
||||
System.out.println("Version info found: " + versionInfo);
|
||||
|
@ -50,9 +62,4 @@ public class BasicTest {
|
|||
System.out.println("Welcome message is: " + welcomeMessage);
|
||||
Assert.assertEquals(welcomeMessage, "Willkommen bei FreDL");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void tearDown() {
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue