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);
}
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;
}
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;
}
Aggregations