Resolve "Генерация периодических задач по тегам" #207
@ -127,6 +127,7 @@ public class ConferenceService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public void delete(Integer conferenceId) {
|
public void delete(Integer conferenceId) {
|
||||||
if (conferenceRepository.exists(conferenceId)) {
|
if (conferenceRepository.exists(conferenceId)) {
|
||||||
|
eventService.removeConferencesEvent(conferenceRepository.findOne(conferenceId));
|
||||||
conferenceRepository.delete(conferenceId);
|
conferenceRepository.delete(conferenceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,4 +203,9 @@ public class EventService {
|
|||||||
eventRepository.delete(eventRepository.findAllByGrant(grant));
|
eventRepository.delete(eventRepository.findAllByGrant(grant));
|
||||||
createFromGrant(grant);
|
createFromGrant(grant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeConferencesEvent(Conference conference) {
|
||||||
|
List<Event> eventList = eventRepository.findAllByConference(conference);
|
||||||
|
eventList.forEach(event -> eventRepository.delete(event.getId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,22 +159,22 @@ public class IndexConferenceTest extends TestTemplate {
|
|||||||
|
|
||||||
conferencesPage.getConferenceFirst();
|
conferencesPage.getConferenceFirst();
|
||||||
String conferenceId = conferencePage.getId();
|
String conferenceId = conferencePage.getId();
|
||||||
Integer paperCount = conferencePage.getPaperCount();
|
Integer paperCount = conferencePage.getArticlesCount();
|
||||||
|
|
||||||
conferencePage.showAllowToAttachArticles();
|
conferencePage.showAllowToAttachArticles();
|
||||||
WebElement paper = conferencePage.selectPaper();
|
WebElement paper = conferencePage.selectArticle();
|
||||||
String paperName = paper.findElement(By.className("text")).getText();
|
String paperName = paper.findElement(By.className("text")).getText();
|
||||||
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(paperCount + 1 == conferencePage.getPaperCount()
|
Assert.assertTrue(paperCount + 1 == conferencePage.getArticlesCount()
|
||||||
&& conferencePage.getPapers()
|
&& conferencePage.getArticles()
|
||||||
.stream()
|
.stream()
|
||||||
.anyMatch(webElement -> webElement
|
.anyMatch(webElement -> webElement
|
||||||
.findElement(By.className("paper-name"))
|
.findElements(By.tagName("input"))
|
||||||
.findElements(By.tagName("span"))
|
.get(1).getAttribute("value")
|
||||||
.get(1).getText().equals(paperName)));
|
.equals(paperName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -187,17 +187,17 @@ public class IndexConferenceTest extends TestTemplate {
|
|||||||
|
|
||||||
conferencesPage.getConferenceFirst();
|
conferencesPage.getConferenceFirst();
|
||||||
String conferenceId = conferencePage.getId();
|
String conferenceId = conferencePage.getId();
|
||||||
Integer paperCount = conferencePage.getPaperCount();
|
Integer paperCount = conferencePage.getArticlesCount();
|
||||||
|
|
||||||
conferencePage.clickAddPaperBut();
|
conferencePage.clickAddPaperBut();
|
||||||
List<WebElement> webElements = conferencePage.getPapers();
|
List<WebElement> webElements = conferencePage.getArticles();
|
||||||
String paperName = webElements.get(webElements.size() - 1).findElements(By.tagName("input")).get(1).getAttribute("value");
|
String paperName = webElements.get(webElements.size() - 1).findElements(By.tagName("input")).get(1).getAttribute("value");
|
||||||
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(paperCount + 1 == conferencePage.getPaperCount()
|
Assert.assertTrue(paperCount + 1 == conferencePage.getArticlesCount()
|
||||||
&& conferencePage.getPapers()
|
&& conferencePage.getArticles()
|
||||||
.stream()
|
.stream()
|
||||||
.anyMatch(webElement -> webElement
|
.anyMatch(webElement -> webElement
|
||||||
.findElements(By.tagName("input"))
|
.findElements(By.tagName("input"))
|
||||||
@ -215,11 +215,44 @@ public class IndexConferenceTest extends TestTemplate {
|
|||||||
|
|
||||||
conferencesPage.getConferenceFirst();
|
conferencesPage.getConferenceFirst();
|
||||||
|
|
||||||
WebElement paper = conferencePage.getPapers().get(0);
|
WebElement paper = conferencePage.getArticles().get(0);
|
||||||
String paperName = paper.findElements(By.tagName("input")).get(1).getAttribute("value");
|
String paperName = paper.findElements(By.tagName("input")).get(1).getAttribute("value");
|
||||||
paper.findElement(By.tagName("a")).click();
|
paper.findElement(By.tagName("a")).click();
|
||||||
|
|
||||||
Assertions.assertThat(conferencePage.getName())
|
Assertions.assertThat(conferencePage.getName())
|
||||||
.isEqualTo(paperName);
|
.isEqualTo(paperName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUndockArticle() {
|
||||||
|
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.getArticlesCount();
|
||||||
|
|
||||||
|
conferencePage.clickUndockArticleBut();
|
||||||
|
conferencePage.clickSaveBut();
|
||||||
|
|
||||||
|
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/conferences/conference?id=%s", conferenceId));
|
||||||
|
|
||||||
|
Assert.assertTrue(paperCount - 1 == conferencePage.getArticlesCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSortAndFilterConferenceList() {
|
||||||
|
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());
|
||||||
|
|
||||||
|
conferencesPage.selectMember();
|
||||||
|
conferencesPage.selectYear();
|
||||||
|
|
||||||
|
Assert.assertEquals(1, conferencesPage.getConferencesList().size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,21 +72,26 @@ public class ConferencePage extends PageObject {
|
|||||||
driver.findElement(By.cssSelector("button[data-id=\"paperIds\"]")).click();
|
driver.findElement(By.cssSelector("button[data-id=\"paperIds\"]")).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WebElement> getPapers() {
|
public void clickAddPaperBut() {
|
||||||
|
driver.findElement(By.id("add-paper")).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<WebElement> getArticles() {
|
||||||
return driver.findElements(By.className("paper"));
|
return driver.findElements(By.className("paper"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPaperCount() {
|
public Integer getArticlesCount() {
|
||||||
return driver.findElements(By.className("paper")).size();
|
return driver.findElements(By.className("paper")).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebElement selectPaper() {
|
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 webElement = driver.findElement(By.xpath("//*[@id=\"conference-form\"]/div/div[2]/div[5]/div/div/div[2]/ul/li[1]/a"));
|
||||||
webElement.click();
|
webElement.click();
|
||||||
return webElement;
|
return webElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickAddPaperBut() {
|
public void clickUndockArticleBut() {
|
||||||
driver.findElement(By.id("add-paper")).click();
|
driver.findElement(By.name("removePaper")).click();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,4 +19,14 @@ public class ConferencesPage extends PageObject {
|
|||||||
public void getConferenceFirst() {
|
public void getConferenceFirst() {
|
||||||
driver.findElement(By.xpath("//*[@id=\"conferences\"]/div/div[2]/div[1]/div[1]/div/a")).click();
|
driver.findElement(By.xpath("//*[@id=\"conferences\"]/div/div[2]/div[1]/div[1]/div/a")).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void selectMember() {
|
||||||
|
driver.findElements(By.className("bootstrap-select")).get(0).findElement(By.className("btn")).click();
|
||||||
|
driver.findElements(By.className("bootstrap-select")).get(0).findElements(By.className("dropdown-item")).get(1).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectYear() {
|
||||||
|
driver.findElements(By.className("bootstrap-select")).get(1).findElement(By.className("btn")).click();
|
||||||
|
driver.findElements(By.className("bootstrap-select")).get(1).findElements(By.className("dropdown-item")).get(1).click();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user