116 lines
3.5 KiB
Java
116 lines
3.5 KiB
Java
package conference;
|
|
|
|
import core.PageObject;
|
|
import org.openqa.selenium.By;
|
|
import org.openqa.selenium.WebElement;
|
|
|
|
import java.util.List;
|
|
|
|
public class ConferencePage extends PageObject {
|
|
|
|
public String getSubTitle() {
|
|
return driver.findElement(By.tagName("h3")).getText();
|
|
}
|
|
|
|
public String getId() {
|
|
return driver.findElement(By.id("id")).getAttribute("value");
|
|
}
|
|
|
|
public void setName(String name) {
|
|
driver.findElement(By.id("title")).sendKeys(name);
|
|
}
|
|
|
|
public String getName() {
|
|
return driver.findElement(By.id("title")).getAttribute("value");
|
|
}
|
|
|
|
public void clearName() {
|
|
driver.findElement(By.id("title")).clear();
|
|
}
|
|
|
|
public void clickSaveBut() {
|
|
driver.findElement(By.id("send-message-button")).click();
|
|
}
|
|
|
|
public void clickAddDeadlineBut() {
|
|
driver.findElement(By.id("addDeadline")).click();
|
|
}
|
|
|
|
public List<WebElement> getDeadlineList() {
|
|
return driver.findElements(By.className("deadline"));
|
|
}
|
|
|
|
public Integer getDeadlineCount() {
|
|
return driver.findElements(By.className("deadline")).size();
|
|
}
|
|
|
|
public void setDeadlineDescription(String description, Integer i) {
|
|
driver.findElement(By.id(String.format("deadlines%d.description", i))).sendKeys(description);
|
|
}
|
|
|
|
public void setDeadlineDate(String date, Integer i) {
|
|
driver.findElement(By.id(String.format("deadlines%d.date", i))).sendKeys(date);
|
|
}
|
|
|
|
public void clickTakePartBut() {
|
|
driver.findElement(By.id("take-part")).click();
|
|
}
|
|
|
|
public Boolean isTakePartButDisabledValueTrue() {
|
|
return driver.findElement(By.id("take-part")).getAttribute("disabled").equals("true");
|
|
}
|
|
|
|
public Integer getMemberCount() {
|
|
return driver.findElements(By.className("member")).size();
|
|
}
|
|
|
|
public void clickDeleteDeadlineBut() {
|
|
driver.findElement(By.xpath("//*[@id=\"deadlines\"]/div/input[4]")).click();
|
|
}
|
|
|
|
public void showAllowToAttachArticles() {
|
|
driver.findElement(By.cssSelector("button[data-id=\"paperIds\"]")).click();
|
|
}
|
|
|
|
public void clickAddPaperBut() {
|
|
driver.findElement(By.id("add-paper")).click();
|
|
}
|
|
|
|
|
|
public List<WebElement> getArticles() {
|
|
return driver.findElements(By.className("paper"));
|
|
}
|
|
|
|
public Integer getArticlesCount() {
|
|
return driver.findElements(By.className("paper")).size();
|
|
}
|
|
|
|
public WebElement selectArticle() {
|
|
WebElement webElement = driver.findElement(By.xpath("//*[@id=\"conference-form\"]/div/div[2]/div[5]/div/div/div[2]/ul/li[1]/a"));
|
|
webElement.click();
|
|
return webElement;
|
|
}
|
|
|
|
public void clickUndockArticleBut() {
|
|
driver.findElement(By.name("removePaper")).click();
|
|
}
|
|
|
|
public boolean checkDeadline(String description, String dateValue) {
|
|
return getDeadlineList()
|
|
.stream()
|
|
.anyMatch(webElement -> {
|
|
return webElement.findElement(By.className("deadline-text")).getAttribute("value").equals(description)
|
|
&& webElement.findElement(By.cssSelector("input[type=\"date\"]")).getAttribute("value").equals(dateValue);
|
|
});
|
|
}
|
|
|
|
public boolean checkArticle(String paperName) {
|
|
return getArticles()
|
|
.stream()
|
|
.anyMatch(webElement -> webElement
|
|
.findElements(By.tagName("input"))
|
|
.get(1).getAttribute("value")
|
|
.equals(paperName));
|
|
}
|
|
|
|
} |