From 0cb7b05c2556f64b277c1d6903229ea0f38e72be Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Fri, 10 May 2019 17:21:36 +0400 Subject: [PATCH] #103 add check take part --- src/test/java/IndexConferenceTest.java | 21 ++++++++++++++++++++ src/test/java/conference/ConferencePage.java | 12 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/test/java/IndexConferenceTest.java b/src/test/java/IndexConferenceTest.java index 7f8ee57..4fb72d4 100644 --- a/src/test/java/IndexConferenceTest.java +++ b/src/test/java/IndexConferenceTest.java @@ -106,4 +106,25 @@ public class IndexConferenceTest extends TestTemplate { && webElement.findElement(By.cssSelector("input[type=\"date\"]")).getAttribute("value").equals(dateValue); })); } + + @Test + public void testTakePartAndSave() { + 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 membersCount = conferencePage.getMemperCount(); + + conferencePage.clickTakePartBut(); + conferencePage.clickSaveBut(); + + getContext().goTo(applicationProperties.getBaseUrl() + String.format("/conferences/conference?id=%s", conferenceId)); + + Assert.assertTrue(membersCount + 1 == conferencePage.getMemperCount() + && conferencePage.getTakePartButDisabledValue().equals("true")); + } } diff --git a/src/test/java/conference/ConferencePage.java b/src/test/java/conference/ConferencePage.java index 00d9585..9a448eb 100644 --- a/src/test/java/conference/ConferencePage.java +++ b/src/test/java/conference/ConferencePage.java @@ -51,4 +51,16 @@ public class ConferencePage extends PageObject { public void setDeadlineDate(String date, Integer i) { driver.findElement(By.id(String.format("deadlines%d.date", i))).sendKeys(date); } + + public void clickTakePartBut() { + driver.findElement(By.id("take-part")).click(); + } + + public String getTakePartButDisabledValue() { + return driver.findElement(By.id("take-part")).getAttribute("disabled"); + } + + public Integer getMemperCount() { + return driver.findElements(By.className("member")).size(); + } } \ No newline at end of file