Search in sources :

Example 11 with Topic

use of it.vige.rubia.model.Topic in project rubia-forums by flashboss.

the class ExternalLinksTest method verifyAtomTopic.

@Test
public void verifyAtomTopic() {
    Topic topic = new Topic(new Forum("First Test Forum"), "First Test Topic");
    Topic result = ViewAtomLink.getPage(driver, topic);
    assertNotNull(result);
    assertEquals("First Test Category", result.getForum().getCategory().getTitle());
    assertEquals(topic.getForum().getName(), result.getForum().getName());
    assertEquals(2, result.getPosts().size());
    assertEquals("root", result.getPosts().get(0).getPoster().getUserId());
    assertEquals("root", result.getPosts().get(1).getPoster().getUserId());
    assertEquals("First Test Topic", result.getPosts().get(0).getMessage().getSubject());
    assertEquals(RE + "First Test Topic", result.getPosts().get(1).getMessage().getSubject());
    assertEquals("First Test Body", result.getPosts().get(0).getMessage().getText());
    assertEquals("Second Test Body", result.getPosts().get(1).getMessage().getText());
    assertNotNull(result.getPosts().get(0).getCreateDate());
    assertNotNull(result.getPosts().get(1).getCreateDate());
    assertEquals("First Test Topic", result.getSubject());
    assertEquals("First Test Question", result.getPoll().getTitle());
    assertEquals(2, result.getPoll().getOptions().size());
    assertEquals("First Test Answer", result.getPoll().getOptions().get(0).getQuestion());
    assertEquals("Second Test Answer", result.getPoll().getOptions().get(1).getQuestion());
    assertNotNull(result.getPosts().get(0).getAttachments());
    assertEquals(3, result.getPosts().get(0).getAttachments().size());
    assertEquals("First Test File", ((Attachment) result.getPosts().get(0).getAttachments().toArray()[0]).getComment());
    assertEquals("Second Test File", ((Attachment) result.getPosts().get(0).getAttachments().toArray()[1]).getComment());
    assertEquals("Third Test File", ((Attachment) result.getPosts().get(0).getAttachments().toArray()[2]).getComment());
    assertNotNull(result.getPosts().get(1).getAttachments());
    assertEquals(1, result.getPosts().get(1).getAttachments().size());
    assertEquals("Fourth Test File", ((Attachment) result.getPosts().get(1).getAttachments().toArray()[0]).getComment());
}
Also used : 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) Test(org.junit.Test)

Example 12 with Topic

use of it.vige.rubia.model.Topic in project rubia-forums by flashboss.

the class ExternalLinksTest method verifyRSSTopic.

@Test
public void verifyRSSTopic() {
    Topic topic = new Topic(new Forum("First Test Forum"), "First Test Topic");
    Topic result = ViewRSSLink.getPage(driver, topic);
    assertNotNull(result);
    assertEquals("First Test Category", result.getForum().getCategory().getTitle());
    assertEquals(topic.getForum().getName(), result.getForum().getName());
    assertEquals(2, result.getPosts().size());
    assertEquals("root", result.getPosts().get(0).getPoster().getUserId());
    assertEquals("root", result.getPosts().get(1).getPoster().getUserId());
    assertEquals("First Test Topic", result.getPosts().get(0).getMessage().getSubject());
    assertEquals(RE + "First Test Topic", result.getPosts().get(1).getMessage().getSubject());
    assertEquals("First Test Body", result.getPosts().get(0).getMessage().getText());
    assertEquals("Second Test Body", result.getPosts().get(1).getMessage().getText());
    assertNotNull(result.getPosts().get(0).getCreateDate());
    assertNotNull(result.getPosts().get(1).getCreateDate());
    assertEquals("First Test Topic", result.getSubject());
}
Also used : 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) Test(org.junit.Test)

Example 13 with Topic

use of it.vige.rubia.model.Topic in project rubia-forums by flashboss.

the class ExternalLinksTest method setUp.

@BeforeClass
public static void setUp() {
    driver.get(HOME_URL);
    String message = createCategory(driver, new Category("First Test Category"));
    assertTrue(message.equals(CREATED_CATEGORY_1_MESSAGE));
    Forum forum = new Forum("First Test Forum", "First Test Description", new Category("First Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_0_MESSAGE));
    message = createTopic(driver, new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))), new Post("Second Test Body", asList(new Attachment("Fourth", "Fourth Test File"))) }), NORMAL, new Poll("First Test Question", asList(new PollOption[] { new PollOption("First Test Answer"), new PollOption("Second Test Answer") }), 4)));
    assertTrue(message.equals("First Test Topic"));
}
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) Poll(it.vige.rubia.model.Poll) Attachment(it.vige.rubia.model.Attachment) PollOption(it.vige.rubia.model.PollOption) 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) BeforeClass(org.junit.BeforeClass)

Example 14 with Topic

use of it.vige.rubia.model.Topic in project rubia-forums by flashboss.

the class MoveTopic method select.

private static void select(WebDriver driver, Topic topic, Forum forumDest) {
    if (topic != null) {
        List<Post> posts = topic.getPosts();
        if (posts != null)
            for (Post post : posts) {
                WebElement option = driver.findElements(className("forumtablestyle")).get(1).findElement(xpath("tbody/tr/td/p[contains(text(),'" + post.getMessage().getText() + "')]/../../td[3]/input"));
                option.click();
            }
    }
    if (forumDest != null) {
        Select forumSelect = new Select(driver.findElements(className("forumtablestyle")).get(0).findElement(xpath("tbody/tr[4]/td[2]/select")));
        forumSelect.selectByVisibleText(forumDest.getName());
        List<Topic> topics = forumDest.getTopics();
        if (topics != null && topics.size() == 1) {
            WebElement topicSelect = driver.findElements(className("forumtablestyle")).get(0).findElement(xpath("tbody/tr[3]/td[2]/input"));
            topicSelect.clear();
            topicSelect.sendKeys(topics.get(0).getSubject());
        }
    }
}
Also used : Post(it.vige.rubia.model.Post) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement) Topic(it.vige.rubia.model.Topic)

Example 15 with Topic

use of it.vige.rubia.model.Topic in project rubia-forums by flashboss.

the class ModerateForumTest method lock.

@Test
public void lock() {
    Forum forum = new Forum("Third Test Forum");
    forum.setTopics(asList(new Topic[] { new Topic("Fifth Test with Truncation over 25 characters Topic") }));
    goToModerate(driver, forum);
    String message = lockForum(driver, null);
    assertTrue(message.equals(NOT_SELECTED_MESSAGE));
    message = lockForum(driver, forum);
    assertTrue(message.equals(LOCKED_FORUM_MESSAGE));
    message = unlockForum(driver, forum);
    assertTrue(message.equals(NOT_SELECTED_MESSAGE));
    message = unlockForum(driver, forum);
    assertTrue(message.equals(UNLOCKED_FORUM_MESSAGE));
}
Also used : CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) VerifyTopic.verifyTopic(it.vige.rubia.selenium.moderate.action.VerifyTopic.verifyTopic) Forum(it.vige.rubia.model.Forum) LockForum.lockForum(it.vige.rubia.selenium.moderate.action.LockForum.lockForum) MoveForum.moveForum(it.vige.rubia.selenium.moderate.action.MoveForum.moveForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) RemoveForum.removeForum(it.vige.rubia.selenium.moderate.action.RemoveForum.removeForum) LockForum.unlockForum(it.vige.rubia.selenium.moderate.action.LockForum.unlockForum) Test(org.junit.Test)

Aggregations

Topic (it.vige.rubia.model.Topic)112 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)64 Forum (it.vige.rubia.model.Forum)63 Post (it.vige.rubia.model.Post)62 CreateForum.createForum (it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)49 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)48 RemoveForum.removeForum (it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum)39 Category (it.vige.rubia.model.Category)36 Test (org.junit.Test)36 CreateCategory.createCategory (it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory)30 RemoveCategory.removeCategory (it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory)30 Poll (it.vige.rubia.model.Poll)25 PollOption (it.vige.rubia.model.PollOption)24 Attachment (it.vige.rubia.model.Attachment)23 Poster (it.vige.rubia.model.Poster)17 CreatePost.createPost (it.vige.rubia.selenium.forum.action.CreatePost.createPost)16 WebElement (org.openqa.selenium.WebElement)16 SecureActionForum (it.vige.rubia.auth.SecureActionForum)14 Date (java.util.Date)14 Interceptors (javax.interceptor.Interceptors)13