#103 add undock article

This commit is contained in:
Nightblade73 2019-05-10 21:15:49 +04:00
parent 4e4e7ae194
commit 4686406954

View File

@ -159,17 +159,17 @@ public class IndexConferenceTest extends TestTemplate {
conferencesPage.getConferenceFirst();
String conferenceId = conferencePage.getId();
Integer paperCount = conferencePage.getPaperCount();
Integer paperCount = conferencePage.getArticlesCount();
conferencePage.showAllowToAttachArticles();
WebElement paper = conferencePage.selectPaper();
WebElement paper = conferencePage.selectArticle();
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()
Assert.assertTrue(paperCount + 1 == conferencePage.getArticlesCount()
&& conferencePage.getArticles()
.stream()
.anyMatch(webElement -> webElement
.findElement(By.className("paper-name"))
@ -187,17 +187,17 @@ public class IndexConferenceTest extends TestTemplate {
conferencesPage.getConferenceFirst();
String conferenceId = conferencePage.getId();
Integer paperCount = conferencePage.getPaperCount();
Integer paperCount = conferencePage.getArticlesCount();
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");
conferencePage.clickSaveBut();
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/conferences/conference?id=%s", conferenceId));
Assert.assertTrue(paperCount + 1 == conferencePage.getPaperCount()
&& conferencePage.getPapers()
Assert.assertTrue(paperCount + 1 == conferencePage.getArticlesCount()
&& conferencePage.getArticles()
.stream()
.anyMatch(webElement -> webElement
.findElements(By.tagName("input"))
@ -215,11 +215,31 @@ public class IndexConferenceTest extends TestTemplate {
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");
paper.findElement(By.tagName("a")).click();
Assertions.assertThat(conferencePage.getName())
.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());
}
}