use of it.vige.rubia.model.Message in project rubia-forums by flashboss.
the class VerifyPost method getPostsOfCurrentTopic.
public static List<Post> getPostsOfCurrentTopic(WebDriver driver) {
List<WebElement> postComponents = driver.findElements(className(BODY_OUTPUT_TEXT));
int postComponentsSize = postComponents.size();
List<Post> posts = new ArrayList<Post>();
for (int i = 0; i < postComponentsSize; i++) {
Post post = new Post();
WebElement postComponent = driver.findElements(className(BODY_OUTPUT_TEXT)).get(i);
String body = postComponent.findElement(xpath("p")).getText();
String post_subject = postComponent.findElement(xpath(POST_SUBJECT_OUTPUT_TEXT)).getText().split(POST_SUBJECT_TEXT)[1];
String createDateStr = postComponent.findElement(xpath(CREATE_DATE_OUTPUT_TEXT)).getText().split(CREATE_DATE_TEXT)[1];
Date createDate = null;
try {
createDate = dateFormat.parse(createDateStr);
} catch (ParseException e) {
log.error(e);
}
Message message = new Message();
message.setSubject(post_subject);
message.setText(body);
post.setMessage(message);
post.setCreateDate(createDate);
WebElement topicEl = driver.findElement(TOPIC_TEMPLATE_LINK.getValue());
Topic topic = new Topic(topicEl.getText());
post.setTopic(topic);
WebElement forumEl = driver.findElement(FORUM_TEMPLATE_LINK.getValue());
topic.setForum(new Forum(forumEl.getText()));
post.setAttachments(getAttachmentsOfCurrentPostInPage(driver, post));
addParents(driver, post);
Poster poster = new Poster();
postComponent = driver.findElements(className(BODY_OUTPUT_TEXT)).get(i);
poster.setUserId(postComponent.findElement(xpath(USER_LINK)).getText());
post.setPoster(poster);
posts.add(post);
}
return posts;
}
use of it.vige.rubia.model.Message in project rubia-forums by flashboss.
the class MyForumsTopicTest method verifyPostProfile.
@Test
public void verifyPostProfile() {
Post post = new Post();
Message message = new Message();
message.setSubject("Fourth Test Topic");
post.setMessage(message);
Poster poster = ViewAllTopicsSelectPost.selectProfile(driver, post);
assertTrue(poster != null);
assertEquals("root", poster.getUserId());
assertTrue(poster.getPostCount() >= 6);
}
use of it.vige.rubia.model.Message in project rubia-forums by flashboss.
the class MyForumsForumTest method verifyProfile.
@Test
public void verifyProfile() {
Post post = new Post();
Message message = new Message();
message.setSubject("Second Test Topic");
post.setMessage(message);
Poster poster = ViewAllForumsSelectForum.selectProfile(driver, post);
assertTrue(poster != null);
assertEquals("root", poster.getUserId());
assertTrue(poster.getPostCount() >= 12);
}
use of it.vige.rubia.model.Message in project rubia-forums by flashboss.
the class MyForumsForumTest method verifyPost.
@Test
public void verifyPost() {
Post post = new Post();
Message message = new Message();
message.setSubject("Second Test Topic");
post.setMessage(message);
Topic result = ViewAllForumsSelectPost.selectPost(driver, post);
assertTrue(result != null);
assertEquals(message.getSubject(), result.getSubject());
assertEquals("root", result.getPoster().getUserId());
assertEquals(1, result.getPosts().size());
assertEquals(message.getSubject(), result.getPosts().get(0).getMessage().getSubject());
assertEquals("Second Test Body", result.getPosts().get(0).getMessage().getText());
assertEquals("Second Test Question", result.getPoll().getTitle());
}
use of it.vige.rubia.model.Message in project rubia-forums by flashboss.
the class MyForumsForumTest method verifyAllForumsProfile.
@Test
public void verifyAllForumsProfile() {
Post post = new Post();
Message message = new Message();
message.setSubject("Fourth Test Topic");
post.setMessage(message);
Poster poster = ViewAllForumsSelectForum.selectAllForumsProfile(driver, post);
assertTrue(poster != null);
assertEquals("root", poster.getUserId());
assertTrue(poster.getPostCount() >= 16);
}
Aggregations