Search in sources :

Example 16 with Post

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);
}
Also used : ViewPagePostSearch.searchPost(it.vige.rubia.selenium.search.action.ViewPagePostSearch.searchPost) Post(it.vige.rubia.model.Post) SearchCriteria(it.vige.rubia.search.SearchCriteria) Test(org.junit.Test)

Example 17 with Post

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));
}
Also used : CreateCategory.createCategory(it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory) RemoveCategory.removeCategory(it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory) Category(it.vige.rubia.model.Category) ViewPagePostSearch.searchPost(it.vige.rubia.selenium.search.action.ViewPagePostSearch.searchPost) Post(it.vige.rubia.model.Post) RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) ViewAllTopicsRemoveTopic.viewAllTopicsRemoveTopic(it.vige.rubia.selenium.myforums.action.ViewAllTopicsRemoveTopic.viewAllTopicsRemoveTopic) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) SubscriptionTopic.registerTopic(it.vige.rubia.selenium.forum.action.SubscriptionTopic.registerTopic) SubscriptionTopic.unregisterTopic(it.vige.rubia.selenium.forum.action.SubscriptionTopic.unregisterTopic) Forum(it.vige.rubia.model.Forum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) AfterClass(org.junit.AfterClass)

Example 18 with Post

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;
}
Also used : TestUser(it.vige.rubia.selenium.forum.model.TestUser) User(it.vige.rubia.auth.User) Message(it.vige.rubia.model.Message) Post(it.vige.rubia.model.Post) Poster(it.vige.rubia.model.Poster) ParseException(java.text.ParseException) WebElement(org.openqa.selenium.WebElement) TestUser(it.vige.rubia.selenium.forum.model.TestUser) Forum(it.vige.rubia.model.Forum)

Example 19 with Post

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));
}
Also used : CreateCategory.createCategory(it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory) RemoveCategory.removeCategory(it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory) Category(it.vige.rubia.model.Category) Post(it.vige.rubia.model.Post) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) Forum(it.vige.rubia.model.Forum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) AfterClass(org.junit.AfterClass)

Example 20 with Post

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));
}
Also used : CreateCategory.createCategory(it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory) RemoveCategory.removeCategory(it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory) Category(it.vige.rubia.model.Category) ViewAllForumsSelectPost(it.vige.rubia.selenium.myforums.action.ViewAllForumsSelectPost) Post(it.vige.rubia.model.Post) RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) Forum(it.vige.rubia.model.Forum) ViewAllForumsSelectForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsSelectForum) ViewAllForumsUpdateForum.viewAllForumsUpdateForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsUpdateForum.viewAllForumsUpdateForum) ViewAllForumsRemoveForum.viewAllForumsRemoveForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsRemoveForum.viewAllForumsRemoveForum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) SubscriptionForum.unregisterForum(it.vige.rubia.selenium.forum.action.SubscriptionForum.unregisterForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) ViewAllForumsRemoveForum.viewAllEditForumsRemoveForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsRemoveForum.viewAllEditForumsRemoveForum) SubscriptionForum.registerForum(it.vige.rubia.selenium.forum.action.SubscriptionForum.registerForum) AfterClass(org.junit.AfterClass)

Aggregations

Post (it.vige.rubia.model.Post)98 Topic (it.vige.rubia.model.Topic)62 Forum (it.vige.rubia.model.Forum)52 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)43 CreateForum.createForum (it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)38 Category (it.vige.rubia.model.Category)34 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)32 RemoveForum.removeForum (it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum)31 CreateCategory.createCategory (it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory)28 RemoveCategory.removeCategory (it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory)28 Attachment (it.vige.rubia.model.Attachment)25 Test (org.junit.Test)25 Poll (it.vige.rubia.model.Poll)21 Poster (it.vige.rubia.model.Poster)20 PollOption (it.vige.rubia.model.PollOption)19 CreatePost.createPost (it.vige.rubia.selenium.forum.action.CreatePost.createPost)17 Message (it.vige.rubia.model.Message)14 Date (java.util.Date)14 BeforeClass (org.junit.BeforeClass)12 WebElement (org.openqa.selenium.WebElement)12