Search in sources :

Example 96 with Post

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

the class MyForumsForumTest method verifyAllForumsProfile.

@Test
public void verifyAllForumsProfile() {
    Post post = new Post();
    Message message = new Message();
    message.setSubject("Fourth Test Topic");
    post.setMessage(message);
    Poster poster = ViewAllForumsSelectForum.selectAllForumsProfile(driver, post);
    assertTrue(poster != null);
    assertEquals("root", poster.getUserId());
    assertTrue(poster.getPostCount() >= 16);
}
Also used : Message(it.vige.rubia.model.Message) ViewAllForumsSelectPost(it.vige.rubia.selenium.myforums.action.ViewAllForumsSelectPost) Post(it.vige.rubia.model.Post) Poster(it.vige.rubia.model.Poster) Test(org.junit.Test)

Example 97 with Post

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

the class CreateTopic method createTopic.

public static String createTopic(WebDriver driver, Topic topic) {
    WebElement home = driver.findElement(linkText(HOME_LINK));
    home.click();
    WebElement forumEl = driver.findElement(linkText(topic.getForum().getName()));
    forumEl.click();
    WebElement createTopic = driver.findElement(xpath(CREATE_TOPIC_LINK));
    createTopic.click();
    WebElement subjectInput = driver.findElement(id(SUBJECT_INPUT_TEXT));
    sleepThread();
    subjectInput.sendKeys(topic.getSubject());
    switchFrame(driver);
    sleepThread();
    WebElement bodytInput = driver.findElement(cssSelector("body"));
    bodytInput.sendKeys(topic.getPosts().get(0).getMessage().getText());
    driver.switchTo().defaultContent();
    sleepThread();
    WebElement topicTypeInput = null;
    topicTypeInput = driver.findElements(xpath("//input[@type='radio']")).get(topic.getType().getValue());
    topicTypeInput.click();
    sleepThread();
    Poll poll = topic.getPoll();
    if (poll != null)
        createOptions(driver, poll);
    sleepThread();
    addAttachments(driver, topic.getPosts().get(0));
    sleepThread();
    WebElement operationButton = driver.findElement(id(SUBMIT_BUTTON));
    operationButton.click();
    sleepThread();
    if (topic.getPosts().size() > 1) {
        for (int i = 1; i < topic.getPosts().size(); i++) {
            Post post = topic.getPosts().get(i);
            if (post.getTopic() == null)
                post.setTopic(topic);
            createPost(driver, post);
        }
    }
    sleepThread();
    WebElement resultCreateTopic = driver.findElement(linkText(topic.getSubject()));
    String updatedTopic = resultCreateTopic.getText();
    return updatedTopic;
}
Also used : Post(it.vige.rubia.model.Post) CreatePost.createPost(it.vige.rubia.selenium.forum.action.CreatePost.createPost) Poll(it.vige.rubia.model.Poll) WebElement(org.openqa.selenium.WebElement)

Example 98 with Post

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

the class ViewRSSLink method getPage.

public static Topic getPage(WebDriver driver, Topic topic) {
    VerifyTopic.goTo(driver, topic);
    goTo(driver);
    Topic result = new Topic();
    result.setSubject(driver.findElement(id(FEED_TITLE_TEXT)).getText().split(": ")[1]);
    String[] splittedText = driver.findElement(id(FEED_SUBTITLE_TEXT)).getText().split(" in topic | in forum | in category ");
    result.setForum(new Forum(splittedText[2]));
    result.getForum().setCategory(new Category(splittedText[3]));
    List<Post> posts = new ArrayList<Post>();
    List<WebElement> entries = driver.findElements(className(ENTRY_LINK));
    DateFormat dateFormat = new SimpleDateFormat("d MMM yyyy, HH:mm");
    for (WebElement entry : entries) {
        String[] entryText = entry.getText().split(BY);
        String lastUpdated = entry.findElement(className(LAST_UPDATED)).getText();
        Post post = new Post(entryText[0]);
        post.setPoster(new Poster(entryText[1].split("\n")[0]));
        try {
            post.setCreateDate(dateFormat.parse(lastUpdated));
        } catch (ParseException e) {
        }
        post.setMessage(new Message(entry.findElement(className(FEED_ENTRY_CONTENT)).getText()));
        post.getMessage().setSubject(entryText[0]);
        posts.add(post);
    }
    result.setPosts(posts);
    returnToHome(driver);
    return result;
}
Also used : Category(it.vige.rubia.model.Category) Message(it.vige.rubia.model.Message) Post(it.vige.rubia.model.Post) ArrayList(java.util.ArrayList) WebElement(org.openqa.selenium.WebElement) Forum(it.vige.rubia.model.Forum) VerifyForum(it.vige.rubia.selenium.forum.action.VerifyForum) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Poster(it.vige.rubia.model.Poster) ParseException(java.text.ParseException) VerifyTopic(it.vige.rubia.selenium.forum.action.VerifyTopic) Topic(it.vige.rubia.model.Topic) SimpleDateFormat(java.text.SimpleDateFormat)

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