141 lines
4.2 KiB
Java
141 lines
4.2 KiB
Java
package project;
|
|
|
|
import core.PageObject;
|
|
import org.openqa.selenium.By;
|
|
import org.openqa.selenium.WebElement;
|
|
|
|
import java.util.List;
|
|
|
|
public class ProjectPage 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 clickSave() {
|
|
driver.findElement(By.id("sendMessageButton")).click();
|
|
}
|
|
|
|
public void clickAddDeadline() {
|
|
driver.findElement(By.id("addDeadline")).click();
|
|
}
|
|
|
|
public void addDeadlineDate(String deadDate, Integer deadNum) {
|
|
driver.findElement(By.id(String.format("deadlines%d.date", deadNum))).sendKeys(deadDate);
|
|
}
|
|
|
|
public void addDeadlineDescription(String description) {
|
|
driver.findElement(By.id("deadlines0.description")).sendKeys(description);
|
|
}
|
|
|
|
public void setDeadlineCompletion() {
|
|
driver.findElement(By.id("deadlines0.done1")).click();
|
|
}
|
|
|
|
public void setStatus() {
|
|
driver.findElement(By.id("status")).click();
|
|
getFirstStatus();
|
|
}
|
|
|
|
public void getFirstStatus() {
|
|
driver.findElement(By.xpath("//*[@id=\"status\"]/option[1]")).click();
|
|
}
|
|
|
|
public void addDescription(String description) {
|
|
driver.findElement(By.id("description")).sendKeys(description);
|
|
}
|
|
|
|
public void addLink(String link) {
|
|
driver.findElement(By.id("repository")).sendKeys(link);
|
|
}
|
|
|
|
public List<WebElement> getDeadlineList() {
|
|
return driver.findElements(By.className("deadline"));
|
|
}
|
|
|
|
public Integer getDeadlineCount() {
|
|
return driver.findElements(By.className("deadline")).size();
|
|
}
|
|
|
|
public void setExecutors() {
|
|
driver.findElement(By.id("status")).click();
|
|
getFirstExecutor();
|
|
}
|
|
|
|
public void getFirstExecutor() {
|
|
driver.findElement(By.xpath("//*[@id=\"status\"]/option[1]")).click();
|
|
}
|
|
|
|
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 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 clickDeleteDeadline() {
|
|
driver.findElement(By.className("btn-danger")).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=\"project-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);
|
|
});
|
|
}
|
|
|
|
} |