#103 change name method test

This commit is contained in:
Nightblade73 2019-05-10 15:54:12 +04:00
parent 961fdf9397
commit 1ad66d6fb1
3 changed files with 28 additions and 0 deletions

View File

@ -56,4 +56,25 @@ public class IndexConferenceTest extends TestTemplate {
.stream()
.anyMatch(webElement -> webElement.getText().equals(newConferenceName)));
}
@Test
public void testChangeConferenceNameAndSave() {
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 newConferenceName = "test " + (new Date()).getTime();
conferencePage.clearName();
conferencePage.setName(newConferenceName);
conferencePage.clickSaveBut();
Assert.assertTrue(conferencesPage.getConferencesList()
.stream()
.anyMatch(webElement -> webElement.getText().equals(newConferenceName)));
}
}

View File

@ -13,6 +13,10 @@ public class ConferencePage extends PageObject {
driver.findElement(By.id("title")).sendKeys(name);
}
public void clearName() {
driver.findElement(By.id("title")).clear();
}
public void clickSaveBut() {
driver.findElement(By.id("send-message-button")).click();
}

View File

@ -14,6 +14,9 @@ public class ConferencesPage extends PageObject {
public List<WebElement> getConferencesList() {
return driver.findElements(By.cssSelector("span.h6.float-left.m-2"));
}
public void getConferenceFirst() {
driver.findElement(By.xpath("//*[@id=\"conferences\"]/div/div[2]/div[1]/div[1]/div/a")).click();
}
}