public class ToDoTestPage {
public WebDriver driver;
String actualTitle;
public ToDoTestPage(WebDriver driver) {
PageFactory.initElements(driver, this); // lazy proxy
this.driver = driver;
}
@FindBy(css = "body > section > div > header > h1")
private WebElement el1;
@FindBy(css = "body > aside > ul:nth-child(8) > li:nth-child(3) > a")
private WebElement el4;
@FindBy(css = "body > section > div > header > input")
private WebElement el2;
@FindBy(xpath = "//div/input")
private WebElement el5;
@FindBy(xpath = "//button")
private WebElement el7;
@FindBy(css = "body > section > div > footer > ul > li:nth-child(3) > a")
private WebElement el3;
public ToDoTestPage shouldBeFirstTitleOnTheWebPage(String s) {
Assert.assertEquals("React • TodoMVC", driver.getTitle());
return ToDoTestPage.this;
}
public ToDoTestPage shouldHaveTittle(String toDos) {
el1.isDisplayed();
return ToDoTestPage.this;
}
public ToDoTestPage shouldNotbeClickable(String s) {
el4.getAttribute("irc://chat.freenode.net/reactjs");
return ToDoTestPage.this;
}
public ToDoTestPage input(String s) {
el2.sendKeys("Learn to Code HTML & CSS is a simple", Keys.ENTER);
return ToDoTestPage.this;
}
public ToDoTestPage shouldBeDeleted(String s) {
el7.click();
return ToDoTestPage.this;
}
public ToDoTestPage click(String active_button) {
el3.click();
return ToDoTestPage.this;
}
public ToDoTestPage shouldBeCompleted(String s) {
el5.click();
(new WebDriverWait(driver , 4)).until(ExpectedConditions.elementToBeSelected(By.xpath("//div/input")));
return ToDoTestPage.this;
}
}
Я могу писать проверки внутри пэйджи? Или где их писать?