use of it.vige.rubia.model.Category 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.Category 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.Category 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));
}
use of it.vige.rubia.model.Category in project rubia-forums by flashboss.
the class AdminPanelForumTest 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 = createForum(driver, new Forum("Second Test Forum", "Second Test Description", new Category("First Test Category")));
assertTrue(message.equals(CREATED_FORUM_1_MESSAGE));
}
use of it.vige.rubia.model.Category in project rubia-forums by flashboss.
the class VerifyTopic method addParents.
private static void addParents(WebDriver driver, Topic topic) {
Forum forum = new Forum();
forum.setName(driver.findElement(linkText(driver.findElement(FORUM_TEMPLATE_LINK.getValue()).getText())).getText());
topic.setForum(forum);
Category category = new Category();
category.setTitle(driver.findElement(CATEGORY_TEMPLATE_LINK.getValue()).getText());
forum.setCategory(category);
}
Aggregations