Search in sources :

Example 21 with Attachment

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

the class VerifyAttachment method getAttachmentsOfTopics.

public static List<Attachment> getAttachmentsOfTopics(WebDriver driver, Topic... topics) {
    List<Attachment> attachments = new LinkedList<Attachment>();
    WebElement home = driver.findElement(linkText(HOME_LINK));
    home.click();
    WebElement tableComponent = driver.findElement(className(FORUM_TABLE));
    List<WebElement> forumSubjectComponents = tableComponent.findElements(xpath(FORUM_SUBJECT));
    int forumComponentSize = forumSubjectComponents.size();
    for (int j = 0; j < forumComponentSize; j++) {
        home = driver.findElement(linkText(HOME_LINK));
        home.click();
        tableComponent = driver.findElement(className(FORUM_TABLE));
        forumSubjectComponents = tableComponent.findElements(xpath(FORUM_SUBJECT));
        WebElement forumEl = forumSubjectComponents.get(j);
        forumEl.click();
        List<WebElement> subjectComponents = driver.findElements(xpath(SUBJECT_LINK));
        int subjectComponentsSize = subjectComponents.size();
        for (int i = 0; i < subjectComponentsSize; i++) {
            subjectComponents = driver.findElements(xpath(SUBJECT_LINK));
            List<String> topicNames = findTopicNames(topics);
            if (topicNames.contains(subjectComponents.get(i).getText())) {
                subjectComponents = driver.findElements(xpath(SUBJECT_LINK));
                WebElement subjectComponent = subjectComponents.get(i);
                subjectComponent.click();
                List<WebElement> postComponents = driver.findElements(className(BODY_OUTPUT_TEXT));
                for (WebElement postComponent : postComponents) {
                    attachments.addAll(getAttachmentsOfCurrentPost(driver, postComponent));
                }
                String forumLinkText = driver.findElement(id(FORUM_LINK)).getText();
                driver.findElement(linkText(forumLinkText)).click();
            }
        }
    }
    return attachments;
}
Also used : Attachment(it.vige.rubia.model.Attachment) WebElement(org.openqa.selenium.WebElement) LinkedList(java.util.LinkedList)

Example 22 with Attachment

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

the class OperationPollTest 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", 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));
    String message = removePoll(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", 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));
    message = removePoll(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", 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));
    message = removePoll(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", 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));
    message = removePoll(driver, topic);
    assertTrue(message.equals(OK));
    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 = 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) UpdatePoll.updatePoll(it.vige.rubia.selenium.forum.action.UpdatePoll.updatePoll) Poll(it.vige.rubia.model.Poll) RemovePoll.removePoll(it.vige.rubia.selenium.forum.action.RemovePoll.removePoll) CreatePoll.addPoll(it.vige.rubia.selenium.forum.action.CreatePoll.addPoll) 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) VerifyPoll.getPollOfCurrentTopic(it.vige.rubia.selenium.forum.action.VerifyPoll.getPollOfCurrentTopic) 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 23 with Attachment

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

the class OperationPollTest 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));
    message = createForum(driver, new Forum("First Test Forum", "First Test Description", new Category("First Test Category")));
    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(new Forum("First Test 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 = createForum(driver, new Forum("Second Test Forum", "Second Test Description", new Category("First Test Category")));
    assertTrue(message.equals(CREATED_FORUM_1_MESSAGE));
    message = createTopic(driver, new Topic(new Forum("Second Test 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(new Forum("Second Test 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"));
}
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) UpdatePoll.updatePoll(it.vige.rubia.selenium.forum.action.UpdatePoll.updatePoll) Poll(it.vige.rubia.model.Poll) RemovePoll.removePoll(it.vige.rubia.selenium.forum.action.RemovePoll.removePoll) CreatePoll.addPoll(it.vige.rubia.selenium.forum.action.CreatePoll.addPoll) 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) VerifyPoll.getPollOfCurrentTopic(it.vige.rubia.selenium.forum.action.VerifyPoll.getPollOfCurrentTopic) 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 24 with Attachment

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

the class OperationTopicTest 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));
    message = createForum(driver, new Forum("First Test Forum", "First Test Description", new Category("First Test Category")));
    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(new Forum("First Test 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 = createForum(driver, new Forum("Second Test Forum", "Second Test Description", new Category("First Test Category")));
    assertTrue(message.equals(CREATED_FORUM_1_MESSAGE));
    message = createTopic(driver, new Topic(new Forum("Second Test 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(new Forum("Second Test 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 = createTopic(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", null) }), IMPORTANT, null));
    assertTrue(message.equals("Fifth Test with Truncation over 25 characters 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 25 with Attachment

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

the class OperationPostTest 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));
    message = createForum(driver, new Forum("First Test Forum", "First Test Description", new Category("First Test Category")));
    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 = createPost(driver, new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "First Test Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("First Test Post"));
    message = createPost(driver, new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "Second Test Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("Second Test Post"));
    message = createPost(driver, new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "Third Test Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("Third Test Post"));
    message = createPost(driver, new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "Fourth Test Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("Fourth Test Post"));
    message = createTopic(driver, new Topic(new Forum("First Test 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 = createPost(driver, new Post(new Topic(new Forum("First Test Forum"), "Second Test Topic"), "Fifth Test with Truncation over 25 characters Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("Fifth Test with Truncation over 25 characters Post"));
    message = createPost(driver, new Post(new Topic(new Forum("First Test Forum"), "Second Test Topic"), "Sixth Test Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("Sixth Test Post"));
    message = createPost(driver, new Post(new Topic(new Forum("First Test Forum"), "Second Test Topic"), "Seventh Test Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("Seventh Test Post"));
    message = createForum(driver, new Forum("Second Test Forum", "Second Test Description", new Category("First Test Category")));
    assertTrue(message.equals(CREATED_FORUM_1_MESSAGE));
    message = createTopic(driver, new Topic(new Forum("Second Test 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 = createPost(driver, new Post(new Topic(new Forum("Second Test Forum"), "Third Test Topic"), "Eight Test Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("Eight Test Post"));
    message = createPost(driver, new Post(new Topic(new Forum("Second Test Forum"), "Third Test Topic"), "Ninth Test Post", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))));
    assertTrue(message.equals("Ninth Test Post"));
    message = createTopic(driver, new Topic(new Forum("Second Test 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 = createPost(driver, new Post(new Topic(new Forum("Second Test Forum"), "Fourth Test Topic"), "Ten Test Post", asList(new Attachment("fourth", "Fourth Test File"), new Attachment("fifth", "Fifth Test with Truncation over 25 characters File"), new Attachment("sixth", "Sixth Test File"))));
    assertTrue(message.equals("Ten Test Post"));
}
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) RemovePost.removePost(it.vige.rubia.selenium.forum.action.RemovePost.removePost) VerifyTopic.getPosterLastPost(it.vige.rubia.selenium.forum.action.VerifyTopic.getPosterLastPost) CreatePost.createPost(it.vige.rubia.selenium.forum.action.CreatePost.createPost) 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) VerifyPost.getLastPostOfCurrentForum(it.vige.rubia.selenium.forum.action.VerifyPost.getLastPostOfCurrentForum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) 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