use of it.vige.rubia.model.Post in project rubia-forums by flashboss.
the class SearchPostTest method searchPostsWithReset.
@Test
public void searchPostsWithReset() {
goTo(driver);
SearchCriteria searchTopicCriteria = new SearchCriteria();
searchTopicCriteria.setAuthor(null);
searchTopicCriteria.setCategory(null);
searchTopicCriteria.setDisplayAs(POSTS.name());
searchTopicCriteria.setForum(null);
searchTopicCriteria.setKeywords("First");
searchTopicCriteria.setPageNumber(0);
searchTopicCriteria.setPageSize(0);
searchTopicCriteria.setSearching(null);
searchTopicCriteria.setSortBy(null);
searchTopicCriteria.setSortOrder(null);
searchTopicCriteria.setTimePeriod(null);
reset(driver, searchTopicCriteria);
List<Post> posts = getPosts(driver, searchTopicCriteria);
assertTrue(posts == null);
}
use of it.vige.rubia.model.Post in project rubia-forums by flashboss.
the class SearchPostTest method stop.
@AfterClass
public static void stop() {
Topic topic = new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body") }));
String message = unregisterTopic(driver, topic);
assertTrue(message.equals(OK));
message = removeTopic(driver, topic);
assertTrue(message.equals(OK));
topic = new Topic(new Forum("First Test Forum"), "Second Test Topic", asList(new Post[] { new Post("Second Test Body") }));
message = unregisterTopic(driver, topic);
assertTrue(message.equals(OK));
message = removeTopic(driver, topic);
assertTrue(message.equals(OK));
topic = new Topic(new Forum("Second Test Forum"), "Third Test Topic", asList(new Post[] { new Post("Third Test Body") }));
message = unregisterTopic(driver, topic);
assertTrue(message.equals(OK));
message = removeTopic(driver, topic);
assertTrue(message.equals(OK));
topic = new Topic(new Forum("Second Test Forum"), "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body") }));
message = viewAllTopicsRemoveTopic(driver, topic);
assertTrue(message.equals(OK));
message = removeTopic(driver, topic);
assertTrue(message.equals(OK));
topic = new Topic(new Forum("Third Test Forum"), "Fifth Test with Truncation over 25 characters Topic", asList(new Post[] { new Post("Fifth Test with Truncation over 25 characters Body") }));
message = viewAllTopicsRemoveTopic(driver, topic);
assertTrue(message.equals(OK));
message = removeTopic(driver, topic);
assertTrue(message.equals(OK));
topic = new Topic(new Forum("Third Test Forum"), "Sixth Test Topic", asList(new Post[] { new Post("Sixth Test Body") }));
message = removeTopic(driver, topic);
assertTrue(message.equals(OK));
message = removeForum(driver, new Forum("First Test Forum"), "Second Test Forum");
assertTrue(message.equals(REMOVED_FORUM_0_MESSAGE));
message = removeForum(driver, new Forum("Second Test Forum"), SELECT_FORUM_TYPE);
assertTrue(message.equals(REMOVED_FORUM_1_MESSAGE));
message = removeForum(driver, new Forum("Third Test Forum"), SELECT_FORUM_TYPE);
assertTrue(message.equals(REMOVED_FORUM_2_MESSAGE));
message = removeCategory(driver, new Category("First Test Category"), SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_0_MESSAGE));
message = removeCategory(driver, new Category("Second Test Category"), SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_1_MESSAGE));
}
use of it.vige.rubia.model.Post 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;
}
use of it.vige.rubia.model.Post in project rubia-forums by flashboss.
the class OperationTopicTest method stop.
@AfterClass
public static void stop() {
String message = removeTopic(driver, new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Third Test Topic", asList(new Post[] { new Post("Third Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Fifth Test with Truncation over 25 characters Topic", asList(new Post[] { new Post("Fifth Test with Truncation over 25 characters Body") })));
assertTrue(message.equals(OK));
message = removeForum(driver, new Forum("First Test Forum"), "Second Test Forum");
assertTrue(message.equals(REMOVED_FORUM_0_MESSAGE));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Second Test Topic", asList(new Post[] { new Post("Second Test Body") })));
assertTrue(message.equals(OK));
message = removeForum(driver, new Forum("Second Test Forum"), SELECT_FORUM_TYPE);
assertTrue(message.equals(REMOVED_FORUM_1_MESSAGE));
message = removeCategory(driver, new Category("First Test Category"), SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_0_MESSAGE));
message = removeCategory(driver, new Category("Second Test Category"), SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_1_MESSAGE));
}
use of it.vige.rubia.model.Post in project rubia-forums by flashboss.
the class MyForumsForumTest method stop.
@AfterClass
public static void stop() {
String message = removeTopic(driver, new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("First Test Forum"), "Second Test Topic", asList(new Post[] { new Post("Second Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Third Test Topic", asList(new Post[] { new Post("Third Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body") })));
assertTrue(message.equals(OK));
Forum forum = new Forum("First Test Forum");
message = unregisterForum(driver, forum);
assertTrue(message.equals(OK));
message = removeForum(driver, forum, "Third Test Forum");
assertTrue(message.equals(REMOVED_FORUM_0_MESSAGE));
forum = new Forum("Second Test Forum");
message = unregisterForum(driver, forum);
assertTrue(message.equals(OK));
message = removeForum(driver, forum, SELECT_FORUM_TYPE);
assertTrue(message.equals(REMOVED_FORUM_1_MESSAGE));
forum = new Forum("Third Test Forum");
message = viewAllForumsRemoveForum(driver, forum);
assertTrue(message.equals(OK));
message = removeForum(driver, forum, SELECT_FORUM_TYPE);
assertTrue(message.equals(REMOVED_FORUM_2_MESSAGE));
forum = new Forum("Fourth Test Forum");
message = removeForum(driver, forum, SELECT_FORUM_TYPE);
assertTrue(message.equals(REMOVED_FORUM_3_MESSAGE));
forum = new Forum("Fifth Test with Truncation over 25 characters Forum");
message = viewAllEditForumsRemoveForum(driver, forum);
assertTrue(message.equals(OK));
message = removeForum(driver, forum, SELECT_FORUM_TYPE);
assertTrue(message.equals(REMOVED_FORUM_4_MESSAGE));
message = removeCategory(driver, new Category("First Test Category"), SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_0_MESSAGE));
message = removeCategory(driver, new Category("Second Test Category"), SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_1_MESSAGE));
}
Aggregations