From b2e8a43ceec6f280324bea07c33d838cfd9c32ef Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Sat, 11 May 2019 00:51:57 +0400 Subject: [PATCH] #103 delete conf test --- src/test/java/IndexConferenceTest.java | 15 +++++++++++++++ src/test/java/conference/ConferencesPage.java | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/src/test/java/IndexConferenceTest.java b/src/test/java/IndexConferenceTest.java index 47af27f..64b144d 100644 --- a/src/test/java/IndexConferenceTest.java +++ b/src/test/java/IndexConferenceTest.java @@ -255,4 +255,19 @@ public class IndexConferenceTest extends TestTemplate { Assert.assertEquals(1, conferencesPage.getConferencesList().size()); } + + @Test + public void testDeleteConf() throws InterruptedException { + Map.Entry> page = Iterables.get(navigationHolder.entrySet(), 0); + + getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1)); + ConferencesPage conferencesPage = (ConferencesPage) getContext().initPage(page.getKey()); + + Integer size = conferencesPage.getConferencesList().size(); + conferencesPage.deleteFirst(); + Thread.sleep(2000); + conferencesPage.clickConfirm(); + + Assert.assertEquals(size - 1, conferencesPage.getConferencesList().size()); + } } diff --git a/src/test/java/conference/ConferencesPage.java b/src/test/java/conference/ConferencesPage.java index 795ccf3..9cccf3f 100644 --- a/src/test/java/conference/ConferencesPage.java +++ b/src/test/java/conference/ConferencesPage.java @@ -29,4 +29,12 @@ public class ConferencesPage extends PageObject { 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(); } + + public void deleteFirst() { + driver.findElement(By.xpath("//*[@id=\"conferences\"]/div/div[2]/div[1]/div[1]/div/input[2]")).submit(); + } + + public void clickConfirm() { + driver.findElement(By.xpath("//*[@id=\"deleteConference\"]")).click(); + } } \ No newline at end of file