From 7b4318a3b528c93b0be5cbdcbc19cb4019485221 Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Fri, 10 May 2019 17:40:24 +0400 Subject: [PATCH] #103 add delete deadline --- src/test/java/IndexConferenceTest.java | 20 ++++++++++++++++++++ src/test/java/conference/ConferencePage.java | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/src/test/java/IndexConferenceTest.java b/src/test/java/IndexConferenceTest.java index 4fb72d4..8408029 100644 --- a/src/test/java/IndexConferenceTest.java +++ b/src/test/java/IndexConferenceTest.java @@ -127,4 +127,24 @@ public class IndexConferenceTest extends TestTemplate { Assert.assertTrue(membersCount + 1 == conferencePage.getMemperCount() && conferencePage.getTakePartButDisabledValue().equals("true")); } + + @Test + public void testDeleteDeadlineAndSave() { + 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 deadlineCount = conferencePage.getDeadlineCount(); + + conferencePage.clickDeleteDeadlineBut(); + conferencePage.clickSaveBut(); + + getContext().goTo(applicationProperties.getBaseUrl() + String.format("/conferences/conference?id=%s", conferenceId)); + + Assert.assertTrue(deadlineCount - 1 == conferencePage.getDeadlineCount()); + } } diff --git a/src/test/java/conference/ConferencePage.java b/src/test/java/conference/ConferencePage.java index 9a448eb..d51e7b9 100644 --- a/src/test/java/conference/ConferencePage.java +++ b/src/test/java/conference/ConferencePage.java @@ -63,4 +63,8 @@ public class ConferencePage extends PageObject { public Integer getMemperCount() { return driver.findElements(By.className("member")).size(); } + + public void clickDeleteDeadlineBut() { + driver.findElement(By.xpath("//*[@id=\"deadlines\"]/div/input[4]")).click(); + } } \ No newline at end of file