Search in sources :

Example 1 with Poster

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

the class ViewPagePostSearch method getPosterFromLink.

public static Poster getPosterFromLink(WebDriver driver, Post post) {
    WebElement profileLink = driver.findElements(className(FORUM_TABLE)).get(0).findElement(xpath("tbody/tr/td/p[contains(text(),'" + post.getMessage().getText() + "')]")).findElement(xpath("../../../tr/td/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 2 with Poster

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

the class ViewPagePostSearch method getPosterFromButton.

public static Poster getPosterFromButton(WebDriver driver, Post post) {
    WebElement profileLink = driver.findElements(className(FORUM_TABLE)).get(0).findElement(xpath("tbody/tr/td/p[contains(text(),'" + post.getMessage().getText() + "')]")).findElement(xpath("../../../tr/td"));
    String userId = profileLink.getText();
    WebElement button = driver.findElements(className(FORUM_TABLE)).get(0).findElement(xpath("tbody/tr/td/p[contains(text(),'" + post.getMessage().getText() + "')]")).findElement(xpath("../../../tr[3]/td[2]/ul/li/a"));
    button.click();
    Poster poster = verifyProfile(driver, userId);
    return poster;
}
Also used : Poster(it.vige.rubia.model.Poster) WebElement(org.openqa.selenium.WebElement)

Example 3 with Poster

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

the class ViewPageTopicSearch method getTopic.

private static Topic getTopic(WebDriver driver, WebElement element) {
    Topic topic = new Topic();
    topic.setSubject(element.findElement(xpath(TOPIC_SUBJECT)).getText());
    topic.setPoster(new Poster(element.findElement(xpath(TOPIC_POSTER)).getText()));
    Post lastPost = new Post();
    Message message = new Message();
    message.setSubject(element.findElement(xpath(LAST_POST_SUBJECT)).getText());
    lastPost.setMessage(message);
    lastPost.setPoster(new Poster(element.findElement(xpath(LAST_POST_POSTER)).getText()));
    String createdDate = element.findElement(xpath(LAST_POST_CREATED_DATE)).getText().split("\n")[2];
    try {
        Date date = dateFormat.parse(createdDate);
        lastPost.setCreateDate(date);
        topic.setLastPostDate(date);
    } catch (ParseException e) {
    }
    topic.getPosts().add(lastPost);
    topic.setReplies(new Integer(element.findElement(xpath(TOPIC_REPLIES)).getText()));
    topic.setViewCount(new Integer(element.findElement(xpath(TOPIC_VIEWS)).getText()));
    return topic;
}
Also used : Message(it.vige.rubia.model.Message) Post(it.vige.rubia.model.Post) Poster(it.vige.rubia.model.Poster) ParseException(java.text.ParseException) VerifyPost.getPostsOfCurrentTopic(it.vige.rubia.selenium.forum.action.VerifyPost.getPostsOfCurrentTopic) VerifyTopic(it.vige.rubia.selenium.forum.action.VerifyTopic) Topic(it.vige.rubia.model.Topic) Date(java.util.Date)

Example 4 with Poster

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

the class ViewPageTopicSearch method getPosterLastPost.

public static Poster getPosterLastPost(WebDriver driver, Topic topic) {
    WebElement profileLink = driver.findElement(className(PROFILE_LINK)).findElement(xpath("td[5]/a[contains(text(),'" + truncate(topic.getSubject(), 25) + "')]")).findElement(xpath("../a[2]"));
    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 5 with Poster

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

the class SearchTopicTest method verifyPostFromTopicPageLastPost.

@Test
public void verifyPostFromTopicPageLastPost() {
    goTo(driver);
    SearchCriteria searchForumCriteria = new SearchCriteria();
    searchForumCriteria.setAuthor("root");
    searchForumCriteria.setCategory(null);
    searchForumCriteria.setDisplayAs(TOPICS.name());
    searchForumCriteria.setForum(null);
    searchForumCriteria.setKeywords("Topic");
    searchForumCriteria.setPageNumber(0);
    searchForumCriteria.setPageSize(0);
    searchForumCriteria.setSearching(null);
    searchForumCriteria.setSortBy(null);
    searchForumCriteria.setSortOrder(null);
    searchForumCriteria.setTimePeriod(null);
    List<Topic> topics = searchTopic(driver, searchForumCriteria);
    Poster poster = getPosterLastPost(driver, topics.get(0));
    goTo(driver);
    topics = searchTopic(driver, searchForumCriteria);
    Post post = getLastPostOfCurrentForum(driver, topics.get(0));
    assertTrue(post != null);
    assertEquals("First Test with a large subject name triing to truncate over the 25 character Topic", post.getMessage().getSubject());
    assertTrue(poster != null);
    assertEquals("root", poster.getUserId());
    assertTrue(poster.getPostCount() >= 4);
}
Also used : ViewPageTopicSearch.getPosterLastPost(it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getPosterLastPost) Post(it.vige.rubia.model.Post) Poster(it.vige.rubia.model.Poster) ViewPageTopicSearch.getPoster(it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getPoster) 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) SearchCriteria(it.vige.rubia.search.SearchCriteria) 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