use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class OperationPostTest method verifyPostProfileFromForumPage.
@Test
public void verifyPostProfileFromForumPage() {
Forum forum = new Forum("Second Test Forum", "Second Test Description", new Category("First Test Category"));
goTo(driver, forum);
Topic topic = new Topic(forum, "Third Test Topic");
Poster poster = getPoster(driver, topic);
assertTrue(poster != null);
assertEquals("root", poster.getUserId());
assertTrue(poster.getPostCount() >= 14);
}
use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class OperationPostTest method stop.
@AfterClass
public static void stop() {
String message = removePost(driver, new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "First Test Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "Second Test Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "Third Test Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "Fourth Test Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("First Test Forum"), "Second Test Topic"), "Fifth Test with Truncation over 25 characters Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("First Test Forum"), "Second Test Topic"), "Sixth Test Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("First Test Forum"), "Second Test Topic"), "Seventh Test Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("Second Test Forum"), "Third Test Topic"), "Eight Test Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("Second Test Forum"), "Third Test Topic"), "Ninth Test Post"));
assertTrue(message.equals(OK));
message = removePost(driver, new Post(new Topic(new Forum("Second Test Forum"), "Fourth Test Topic"), "Ten Test Post"));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("First Test Forum"), "Second Test Topic", asList(new Post[] { new Post("Second Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Third Test Topic", asList(new Post[] { new Post("Third Test Body") })));
assertTrue(message.equals(OK));
message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body") })));
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));
}
use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class ViewAtomLink method getPage.
public static Forum getPage(WebDriver driver, Forum forum) {
VerifyForum.goTo(driver, forum);
goTo(driver);
Forum result = new Forum();
result.setName(driver.findElement(id(FEED_TITLE_TEXT)).getText().split(": ")[1]);
result.setCategory(new Category(driver.findElement(id(FEED_SUBTITLE_TEXT)).getText().split(" in category ")[1]));
Map<String, Topic> topics = new HashMap<String, Topic>();
int entriesSize = driver.findElements(className(ENTRY_LINK)).size();
DateFormat dateFormat = new SimpleDateFormat("d MMM yyyy, HH:mm");
for (int i = 0; i < entriesSize; i++) {
WebElement entry = driver.findElements(className(ENTRY_LINK)).get(i);
String[] entryText = entry.getText().split(BY);
String lastUpdated = entry.findElement(className(LAST_UPDATED)).getText();
String topicTitle = entryText[0].replace(RE, "");
Topic topic = topics.get(topicTitle);
if (topic == null) {
topic = new Topic(topicTitle);
topics.put(topicTitle, topic);
}
Post post = new Post(entry.findElement(className(FEED_ENTRY_CONTENT)).getText());
post.setPoster(new Poster(entryText[1].split("\n")[0]));
try {
post.setCreateDate(dateFormat.parse(lastUpdated));
} catch (ParseException e) {
}
post.getMessage().setSubject(entryText[0]);
topic.getPosts().add(post);
WebElement entryLink = driver.findElement(linkText(entry.getText().split("\n")[0]));
entryLink.click();
List<Attachment> attachments = getAttachmentsOfCurrentPostInPage(driver, post);
post.setAttachments(attachments);
if (topic.getPoll() == null) {
Poll poll = getPollOfCurrentTopic(driver);
topic.setPoll(poll);
}
VerifyForum.goTo(driver, forum);
goTo(driver);
}
result.setTopics(new ArrayList<Topic>(topics.values()));
returnToHome(driver);
return result;
}
use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class AdminPanelForumTest method verifyUpdateForum.
@Test
public void verifyUpdateForum() {
String message = updateForum(driver, new Forum("Second Test Forum"), new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category")));
assertTrue(message.equals(UPDATED_FORUM_1_MESSAGE));
message = updateForum(driver, new Forum("Third Test Forum"), new Forum("Second Test Forum", "First Test Description", new Category("First Test Category")));
assertTrue(message.equals(UPDATED_FORUM_0_MESSAGE));
}
use of it.vige.rubia.model.Forum in project rubia-forums by flashboss.
the class AdminPanelForumTest method stop.
@AfterClass
public static void stop() {
String 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"), AdminPanelCategoryTest.SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_0_MESSAGE));
message = removeCategory(driver, new Category("Second Test Category"), AdminPanelCategoryTest.SELECT_CATEGORY_TYPE);
assertTrue(message.equals(REMOVED_CATEGORY_1_MESSAGE));
}
Aggregations