#103 add adding article

This commit is contained in:
Nightblade73 2019-05-10 20:07:55 +04:00
parent d9a4224317
commit cad8682088
3 changed files with 38 additions and 0 deletions

View File

@ -140,6 +140,7 @@ body {
.paper-name { .paper-name {
flex: 1; flex: 1;
overflow: hidden;
} }
.paper-name:hover { .paper-name:hover {
@ -156,6 +157,11 @@ body {
float: left; float: left;
} }
.paper-name span:nth-child(2) {
max-width: 326px;
white-space: nowrap;
}
.icon { .icon {

View File

@ -176,4 +176,32 @@ public class IndexConferenceTest extends TestTemplate {
.findElements(By.tagName("span")) .findElements(By.tagName("span"))
.get(1).getText().equals(paperName))); .get(1).getText().equals(paperName)));
} }
@Test
public void testAddArticle() {
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 paperCount = conferencePage.getPaperCount();
conferencePage.clickAddPaperBut();
List<WebElement> webElements = conferencePage.getPapers();
String paperName = webElements.get(webElements.size() - 1).findElement(By.tagName("a")).findElements(By.tagName("span")).get(1).getText();
conferencePage.clickSaveBut();
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/conferences/conference?id=%s", conferenceId));
Assert.assertTrue(paperCount + 1 == conferencePage.getPaperCount()
&& conferencePage.getPapers()
.stream()
.anyMatch(webElement -> webElement
.findElement(By.tagName("a"))
.findElements(By.tagName("span"))
.get(1).getText().equals(paperName)));
}
} }

View File

@ -85,4 +85,8 @@ public class ConferencePage extends PageObject {
webElement.click(); webElement.click();
return webElement; return webElement;
} }
public void clickAddPaperBut() {
driver.findElement(By.id("add-paper")).click();
}
} }