From 46864069543d5c6f69572b68ab91c8e209069b1c Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Fri, 10 May 2019 21:15:49 +0400 Subject: [PATCH] #103 add undock article --- src/test/java/IndexConferenceTest.java | 38 ++++++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/test/java/IndexConferenceTest.java b/src/test/java/IndexConferenceTest.java index b3314ff..84e51a2 100644 --- a/src/test/java/IndexConferenceTest.java +++ b/src/test/java/IndexConferenceTest.java @@ -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 webElements = conferencePage.getPapers(); + List 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> 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()); + } }