Search in sources :

Example 1 with Attachment

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

the class SearchTopicTest 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));
    message = createCategory(driver, new Category("Second Test Category"));
    assertTrue(message.equals(CREATED_CATEGORY_2_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 with a large subject name triing to truncate over the 25 character 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"))) }), 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 with a large subject name triing to truncate over the 25 character Topic"));
    message = createTopic(driver, new Topic(forum, "Second Test Topic", asList(new Post[] { new Post("Second Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))) }), IMPORTANT, new Poll("Second Test Question", asList(new PollOption[] { new PollOption("Third Test Answer"), new PollOption("Fourth Test Answer") }), 8)));
    assertTrue(message.equals("Second Test Topic"));
    message = registerForum(driver, forum, EMAIL_LINKED_NOTIFICATION, CONFIRM);
    assertTrue(message.equals("First Test Forum"));
    forum = new Forum("Second Test Forum", "Second Test Description", new Category("First Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_1_MESSAGE));
    message = createTopic(driver, new Topic(forum, "Third Test Topic", asList(new Post[] { new Post("Third Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))) }), ADVICE, new Poll("Third Test Question", asList(new PollOption[] { new PollOption("Fifth Test with Truncation over 25 characters Answer"), new PollOption("Sixth Test Answer") }), 9)));
    assertTrue(message.equals("Third Test Topic"));
    message = createTopic(driver, new Topic(forum, "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body", asList(new Attachment("fourth", "Fourth Test File"), new Attachment("fifth", "Fifth Test with Truncation over 25 characters File"), new Attachment("sixth", "Sixth Test File"))) }), IMPORTANT, new Poll("Fourth Test Question", asList(new PollOption[] { new PollOption("Seventh Test Answer"), new PollOption("Eight Test Answer") }), 0)));
    assertTrue(message.equals("Fourth Test Topic"));
    message = registerForum(driver, forum, EMAIL_EMBEDED_NOTIFICATION, CONFIRM);
    assertTrue(message.equals("Second Test Forum"));
    forum = new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_2_MESSAGE));
    message = registerForum(driver, forum, EMAIL_NO_NOTIFICATION, CONFIRM);
    assertTrue(message.equals("Third Test Forum"));
    forum = new Forum("Fourth Test Forum", "Fourth Test Description", new Category("Second Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_3_MESSAGE));
    forum = new Forum("Fifth Test with Truncation over 25 characters Forum", "Fifth Test with Truncation over 25 characters Description", new Category("Second Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_4_MESSAGE));
    message = registerForum(driver, forum, EMAIL_NO_NOTIFICATION, CONFIRM);
    assertTrue(message.equals("Fifth Test with Truncation over 25 characters Forum"));
}
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) ViewPageTopicSearch.getPosterLastPost(it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getPosterLastPost) Post(it.vige.rubia.model.Post) Poll(it.vige.rubia.model.Poll) Attachment(it.vige.rubia.model.Attachment) PollOption(it.vige.rubia.model.PollOption) RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) ViewPageTopicSearch.searchTopic(it.vige.rubia.selenium.search.action.ViewPageTopicSearch.searchTopic) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) ViewPageTopicSearch.getTopic(it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getTopic) Forum(it.vige.rubia.model.Forum) 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) ViewPageTopicSearch.getLastPostOfCurrentForum(it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getLastPostOfCurrentForum) SubscriptionForum.registerForum(it.vige.rubia.selenium.forum.action.SubscriptionForum.registerForum) BeforeClass(org.junit.BeforeClass)

Example 2 with Attachment

use of it.vige.rubia.model.Attachment 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 3 with Attachment

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

the class VerifyAttachment method getAttachmentsOfCurrentPostNoParent.

private static List<Attachment> getAttachmentsOfCurrentPostNoParent(WebDriver driver, WebElement postComponent) {
    List<Attachment> attachments = new LinkedList<Attachment>();
    List<WebElement> attachmentComponents = postComponent.findElements(className(ATTACHMENT_LIST));
    for (WebElement attachmentComponent : attachmentComponents) {
        Attachment attachment = getAttachment(attachmentComponent);
        attachments.add(attachment);
    }
    return attachments;
}
Also used : Attachment(it.vige.rubia.model.Attachment) WebElement(org.openqa.selenium.WebElement) LinkedList(java.util.LinkedList)

Example 4 with Attachment

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

the class VerifyAttachment method getAttachment.

private static Attachment getAttachment(WebElement attachmentComponent) {
    String attachmentName = attachmentComponent.findElement(xpath(ATTACHMENT_NAME_OUTPUT_TEXT)).getText();
    String attachmentComment = attachmentComponent.findElement(xpath(ATTACHMENT_COMMENT_OUTPUT_TEXT)).getText();
    String attachmentSize = attachmentComponent.findElement(xpath(ATTACHMENT_SIZE_OUTPUT_TEXT)).getText();
    attachmentComponent.findElement(xpath(ATTACHMENT_DOWNLOAD_LINK)).click();
    File file = new File(download_url + "/" + attachmentName);
    int attachmentSizeValue = new Integer(attachmentSize.split(" B")[0]);
    byte[] content = new byte[attachmentSizeValue];
    Attachment attachment = new Attachment();
    try {
        writeFile(content, file);
    } catch (IOException e) {
        return attachment;
    }
    attachment.setComment(attachmentComment);
    attachment.setName(attachmentName);
    attachment.setSize(attachmentSizeValue);
    attachment.setContent(content);
    return attachment;
}
Also used : Attachment(it.vige.rubia.model.Attachment) IOException(java.io.IOException) File(java.io.File)

Example 5 with Attachment

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

the class MyForumsForumTest 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));
    message = createCategory(driver, new Category("Second Test Category"));
    assertTrue(message.equals(CREATED_CATEGORY_2_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"))) }), 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"));
    message = createTopic(driver, new Topic(forum, "Second Test Topic", asList(new Post[] { new Post("Second Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))) }), IMPORTANT, new Poll("Second Test Question", asList(new PollOption[] { new PollOption("Third Test Answer"), new PollOption("Fourth Test Answer") }), 8)));
    assertTrue(message.equals("Second Test Topic"));
    message = registerForum(driver, forum, EMAIL_LINKED_NOTIFICATION, CONFIRM);
    assertTrue(message.equals("First Test Forum"));
    forum = new Forum("Second Test Forum", "Second Test Description", new Category("First Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_1_MESSAGE));
    message = createTopic(driver, new Topic(forum, "Third Test Topic", asList(new Post[] { new Post("Third Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))) }), ADVICE, new Poll("Third Test Question", asList(new PollOption[] { new PollOption("Fifth Test with Truncation over 25 characters Answer"), new PollOption("Sixth Test Answer") }), 9)));
    assertTrue(message.equals("Third Test Topic"));
    message = createTopic(driver, new Topic(forum, "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body", asList(new Attachment("fourth", "Fourth Test File"), new Attachment("fifth", "Fifth Test with Truncation over 25 characters File"), new Attachment("sixth", "Sixth Test File"))) }), IMPORTANT, new Poll("Fourth Test Question", asList(new PollOption[] { new PollOption("Seventh Test Answer"), new PollOption("Eight Test Answer") }), 0)));
    assertTrue(message.equals("Fourth Test Topic"));
    message = registerForum(driver, forum, EMAIL_EMBEDED_NOTIFICATION, CONFIRM);
    assertTrue(message.equals("Second Test Forum"));
    forum = new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_2_MESSAGE));
    message = registerForum(driver, forum, EMAIL_NO_NOTIFICATION, CONFIRM);
    assertTrue(message.equals("Third Test Forum"));
    forum = new Forum("Fourth Test Forum", "Fourth Test Description", new Category("Second Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_3_MESSAGE));
    forum = new Forum("Fifth Test with Truncation over 25 characters Forum", "Fifth Test Description", new Category("Second Test Category"));
    message = createForum(driver, forum);
    assertTrue(message.equals(CREATED_FORUM_4_MESSAGE));
    message = registerForum(driver, forum, EMAIL_NO_NOTIFICATION, CONFIRM);
    assertTrue(message.equals("Fifth Test with Truncation over 25 characters Forum"));
}
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) Poll(it.vige.rubia.model.Poll) Attachment(it.vige.rubia.model.Attachment) PollOption(it.vige.rubia.model.PollOption) 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) BeforeClass(org.junit.BeforeClass)

Aggregations

Attachment (it.vige.rubia.model.Attachment)34 Post (it.vige.rubia.model.Post)25 Topic (it.vige.rubia.model.Topic)23 Forum (it.vige.rubia.model.Forum)21 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)20 Poll (it.vige.rubia.model.Poll)19 CreateForum.createForum (it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)19 PollOption (it.vige.rubia.model.PollOption)18 RemoveForum.removeForum (it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum)18 Category (it.vige.rubia.model.Category)15 CreateCategory.createCategory (it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory)13 RemoveCategory.removeCategory (it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory)13 BeforeClass (org.junit.BeforeClass)11 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)10 CreatePost.createPost (it.vige.rubia.selenium.forum.action.CreatePost.createPost)9 Test (org.junit.Test)7 WebElement (org.openqa.selenium.WebElement)7 LockTopic.lockTopic (it.vige.rubia.selenium.moderate.action.LockTopic.lockTopic)5 MoveTopic.moveTopic (it.vige.rubia.selenium.moderate.action.MoveTopic.moveTopic)5 RemoveTopic.removeTopic (it.vige.rubia.selenium.moderate.action.RemoveTopic.removeTopic)5