Resolve "Генерация периодических задач по тегам" #207

Merged
ashette merged 32 commits from 79-students-tags-generation into dev 2019-05-16 07:30:47 +04:00
2 changed files with 50 additions and 3 deletions
Showing only changes of commit d9a4224317 - Show all commits

View File

@ -10,6 +10,7 @@ import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
@ -117,14 +118,14 @@ public class IndexConferenceTest extends TestTemplate {
conferencesPage.getConferenceFirst(); conferencesPage.getConferenceFirst();
String conferenceId = conferencePage.getId(); String conferenceId = conferencePage.getId();
Integer membersCount = conferencePage.getMemperCount(); Integer membersCount = conferencePage.getMemberCount();
conferencePage.clickTakePartBut(); conferencePage.clickTakePartBut();
conferencePage.clickSaveBut(); conferencePage.clickSaveBut();
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/conferences/conference?id=%s", conferenceId)); getContext().goTo(applicationProperties.getBaseUrl() + String.format("/conferences/conference?id=%s", conferenceId));
Assert.assertTrue(membersCount + 1 == conferencePage.getMemperCount() Assert.assertTrue(membersCount + 1 == conferencePage.getMemberCount()
&& conferencePage.getTakePartButDisabledValue().equals("true")); && conferencePage.getTakePartButDisabledValue().equals("true"));
} }
@ -147,4 +148,32 @@ public class IndexConferenceTest extends TestTemplate {
Assert.assertTrue(deadlineCount - 1 == conferencePage.getDeadlineCount()); Assert.assertTrue(deadlineCount - 1 == conferencePage.getDeadlineCount());
} }
@Test
public void testAttachArticle() {
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
ConferencesPage conferencesPage = (ConferencesPage) getContext().initPage(page.getKey());
ConferencePage conferencePage = (ConferencePage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
conferencesPage.getConferenceFirst();
String conferenceId = conferencePage.getId();
Integer paperCount = conferencePage.getPaperCount();
conferencePage.showAllowToAttachArticles();
WebElement paper = conferencePage.selectPaper();
String paperName = paper.findElement(By.className("text")).getText();
conferencePage.clickSaveBut();
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/conferences/conference?id=%s", conferenceId));
Assert.assertTrue(paperCount + 1 == conferencePage.getPaperCount()
&& conferencePage.getPapers()
.stream()
.anyMatch(webElement -> webElement
.findElement(By.className("paper-name"))
.findElements(By.tagName("span"))
.get(1).getText().equals(paperName)));
}
} }

View File

@ -60,11 +60,29 @@ public class ConferencePage extends PageObject {
return driver.findElement(By.id("take-part")).getAttribute("disabled"); return driver.findElement(By.id("take-part")).getAttribute("disabled");
} }
public Integer getMemperCount() { public Integer getMemberCount() {
return driver.findElements(By.className("member")).size(); return driver.findElements(By.className("member")).size();
} }
public void clickDeleteDeadlineBut() { public void clickDeleteDeadlineBut() {
driver.findElement(By.xpath("//*[@id=\"deadlines\"]/div/input[4]")).click(); driver.findElement(By.xpath("//*[@id=\"deadlines\"]/div/input[4]")).click();
} }
public void showAllowToAttachArticles() {
driver.findElement(By.cssSelector("button[data-id=\"paperIds\"]")).click();
}
public List<WebElement> getPapers() {
return driver.findElements(By.className("paper"));
}
public Integer getPaperCount() {
return driver.findElements(By.className("paper")).size();
}
public WebElement selectPaper() {
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;
}
} }