#103 add check take part

This commit is contained in:
Nightblade73 2019-05-10 17:21:36 +04:00
parent 253f4b4aad
commit 0cb7b05c25
2 changed files with 33 additions and 0 deletions

View File

@ -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<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 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"));
}
}

View File

@ -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();
}
}