use of it.vige.rubia.selenium.forum.model.TestUser in project rubia-forums by flashboss.
the class VerifyForum method getForum.
public static Forum getForum(WebDriver driver, WebElement trComponent) {
Forum forum = new Forum();
WebElement forumNameComponent = trComponent.findElement(xpath(FORUM_NAME_LINK));
String forumNameText = forumNameComponent.getText();
addParents(driver, forum);
forum.setName(forumNameText);
forum.setDescription(trComponent.findElement(xpath(DESCRIPTION_OUTPUT_TEXT)).getText().split("\n")[1]);
WebElement lastPostElement = trComponent.findElement(xpath(LAST_POST));
if (!lastPostElement.getText().equals(NO_POSTS)) {
Post lastPost = new Post();
try {
lastPost.setCreateDate(dateFormat.parse(lastPostElement.getText().split("\n")[2]));
} catch (ParseException e) {
log.error(e);
}
String userIdLastPost = lastPostElement.findElement(xpath(LAST_POST_USER_LINK)).getText();
Poster poster = new Poster();
poster.setUserId(userIdLastPost);
lastPost.setPoster(poster);
User user = new TestUser();
user.setId(userIdLastPost);
user.setUserName(userIdLastPost);
lastPost.setUser(user);
Message message = new Message();
message.setSubject(lastPostElement.findElement(xpath(LAST_POST_MESSAGE_LINK)).getText());
lastPost.setMessage(message);
forum.setLastPost(lastPost);
}
forum.setTopicCount(new Integer(trComponent.findElement(xpath(TOPICS_COUNT_OUTPUT_TEXT)).getText()));
forum.setPostCount(new Integer(trComponent.findElement(xpath(POSTS_COUNT_OUTPUT_TEXT)).getText()));
return forum;
}
Aggregations