Search in sources :

Example 41 with Poster

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

the class VerifyTopic method getPoster.

public static Poster getPoster(WebDriver driver, Topic topic) {
    WebElement profileLink = driver.findElements(className(PROFILE_LINK)).get(0).findElement(xpath("../tr/td/h3/a[contains(text(),'" + topic.getSubject() + "')]")).findElement(xpath("../../a"));
    String userId = profileLink.getText();
    profileLink.click();
    Poster poster = verifyProfile(driver, userId);
    return poster;
}
Also used : Poster(it.vige.rubia.model.Poster) WebElement(org.openqa.selenium.WebElement)

Example 42 with Poster

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

the class VerifyTopic method getTopic.

public static Topic getTopic(WebDriver driver) {
    Topic topic = new Topic();
    WebElement topicTable = driver.findElements(className(TOPIC_TABLE)).get(1);
    WebElement subjectComponent = topicTable.findElement(TOPIC_TEMPLATE_LINK.getValue());
    String subjectText = subjectComponent.getText();
    topic.setSubject(subjectText);
    String user = topicTable.findElement(xpath(USER_IN_TOPIC_LINK)).getText();
    Date lastPostDate = null;
    try {
        DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd, yyyy HH:mm a");
        String posted = bundle.getString("Posted");
        String permanentLink = topicTable.findElement(xpath(LAST_POST_DATE_IN_TOPIC_OUTPUT_TEXT)).getText();
        lastPostDate = dateFormat.parse(permanentLink.substring(permanentLink.indexOf(posted) + posted.length() + 1, permanentLink.indexOf(bundle.getString("Post_subject"))).trim());
    } catch (ParseException e) {
        log.error(e);
    }
    topic.setLastPostDate(lastPostDate);
    Poster poster = new Poster();
    poster.setUserId(user);
    topic.setPoster(poster);
    subjectComponent.click();
    topic.setPoll(getPollOfCurrentTopic(driver));
    topic.setPosts(getPostsOfCurrentTopic(driver));
    addParents(driver, topic);
    return topic;
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Poster(it.vige.rubia.model.Poster) ParseException(java.text.ParseException) VerifyPost.getPostsOfCurrentTopic(it.vige.rubia.selenium.forum.action.VerifyPost.getPostsOfCurrentTopic) Topic(it.vige.rubia.model.Topic) VerifyPoll.getPollOfCurrentTopic(it.vige.rubia.selenium.forum.action.VerifyPoll.getPollOfCurrentTopic) WebElement(org.openqa.selenium.WebElement) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 43 with Poster

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

the class MyForumsTopicTest method verifyPostProfile.

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

Example 44 with Poster

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

the class MyForumsForumTest method verifyProfile.

@Test
public void verifyProfile() {
    Post post = new Post();
    Message message = new Message();
    message.setSubject("Second Test Topic");
    post.setMessage(message);
    Poster poster = ViewAllForumsSelectForum.selectProfile(driver, post);
    assertTrue(poster != null);
    assertEquals("root", poster.getUserId());
    assertTrue(poster.getPostCount() >= 12);
}
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 45 with Poster

use of it.vige.rubia.model.Poster 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)

Aggregations

Poster (it.vige.rubia.model.Poster)46 Post (it.vige.rubia.model.Post)20 WebElement (org.openqa.selenium.WebElement)18 Topic (it.vige.rubia.model.Topic)17 Forum (it.vige.rubia.model.Forum)14 Test (org.junit.Test)13 Message (it.vige.rubia.model.Message)11 ParseException (java.text.ParseException)10 Category (it.vige.rubia.model.Category)7 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)7 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)7 Date (java.util.Date)7 CreateForum.createForum (it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)6 RemoveForum.removeForum (it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum)6 NoResultException (javax.persistence.NoResultException)6 NonUniqueResultException (javax.persistence.NonUniqueResultException)6 VerifyPost.getLastPostOfCurrentForum (it.vige.rubia.selenium.forum.action.VerifyPost.getLastPostOfCurrentForum)5 VerifyTopic (it.vige.rubia.selenium.forum.action.VerifyTopic)5 VerifyTopic.getPoster (it.vige.rubia.selenium.forum.action.VerifyTopic.getPoster)5 DateFormat (java.text.DateFormat)5