use of org.xwiki.test.ui.po.CommentsTab in project xwiki-platform by xwiki.
the class CommentAsGuestTest method testReplyCommentAsAnonymous.
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testReplyCommentAsAnonymous() {
CommentsTab commentsTab = this.vp.openCommentsDocExtraPane();
commentsTab.postCommentAsGuest(COMMENT_CONTENT, COMMENT_AUTHOR, true);
commentsTab.replyToCommentByID(commentsTab.getCommentID(COMMENT_CONTENT), COMMENT_REPLY);
Assert.assertEquals(COMMENT_REPLY, commentsTab.getCommentContentByID(commentsTab.getCommentID(COMMENT_REPLY)));
Assert.assertEquals(COMMENT_AUTHOR, commentsTab.getCommentAuthorByID(commentsTab.getCommentID(COMMENT_REPLY)));
}
use of org.xwiki.test.ui.po.CommentsTab in project xwiki-platform by xwiki.
the class CommentAsGuestTest method testPostCommentAsGuestNoJs.
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testPostCommentAsGuestNoJs() {
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "view", "xpage=xpart&vm=commentsinline.vm");
CommentsTab commentsTab = new CommentsTab();
commentsTab.postComment(COMMENT_CONTENT, false);
// This opens with ?viewer=comments, don't explicitly load the comments tab
new ViewPage().waitUntilPageIsLoaded();
Assert.assertEquals(COMMENT_CONTENT, commentsTab.getCommentContentByID(commentsTab.getCommentID(COMMENT_CONTENT)));
Assert.assertEquals(COMMENT_AUTHOR, commentsTab.getCommentAuthorByID(commentsTab.getCommentID(COMMENT_CONTENT)));
}
use of org.xwiki.test.ui.po.CommentsTab in project xwiki-platform by xwiki.
the class CompareVersionsTest method setUp.
@Before
public void setUp() throws Exception {
String pageName = "PageWithManyVersions";
// Check if the test page exists.
testPage = getUtil().gotoPage(getTestClassName(), pageName);
if (testPage.exists()) {
// TODO: Remove when XWIKI-6688 (Possible race condition when clicking on a tab at the bottom of a page in
// view mode) is fixed.
testPage.waitForDocExtraPaneActive("comments");
// versions of the test page.
return;
}
// Since this test also verifies diffs when the parent/child relationship is modified, use this mode (which
// isn't the default) for testing purpose. Also note that in the "reference" mode there's no diff to display
// when the document is moved to a different parent since it means changing the identity of the document for
// now and thus changing it means getting a new document.
getUtil().setHierarchyMode("parentchild");
getDriver().navigate().refresh();
// Create the test page.
testPage = getUtil().createPage(getTestClassName(), pageName, "one\ntwo\nthree", "Test");
// Change the content and the meta data.
WikiEditPage wikiEditPage = testPage.editWiki();
wikiEditPage.setContent("one\n**two**\nfour");
wikiEditPage.setTitle("Compare verSions test");
wikiEditPage.setParent("Sandbox.WebHome");
wikiEditPage.setEditComment("Changed content and meta data.");
wikiEditPage.clickSaveAndContinue();
wikiEditPage.setTitle("Compare versions test");
wikiEditPage.setMinorEdit(true);
wikiEditPage.setEditComment("Fix typo in title.");
wikiEditPage.clickSaveAndContinue();
// Add objects.
ObjectEditPage objectEditPage = wikiEditPage.editObjects();
FormElement form = objectEditPage.addObject("XWiki.JavaScriptExtension");
Map<String, String> assignment = new HashMap<String, String>();
assignment.put("XWiki.JavaScriptExtension_0_name", "JavaScript code");
assignment.put("XWiki.JavaScriptExtension_0_code", "var tmp = alice;\nalice = bob;\nbob = tmp;");
assignment.put("XWiki.JavaScriptExtension_0_use", "onDemand");
form.fillFieldsByName(assignment);
objectEditPage.clickSaveAndContinue();
assignment.put("XWiki.JavaScriptExtension_0_name", "Code snippet");
assignment.put("XWiki.JavaScriptExtension_0_code", "var tmp = alice;\nalice = 2 * bob;\nbob = tmp;");
form.fillFieldsByName(assignment);
objectEditPage.clickSaveAndContinue();
// Create class.
ClassEditPage classEditPage = objectEditPage.editClass();
classEditPage.addProperty("age", "Number");
classEditPage.addProperty("color", "String");
classEditPage.getNumberClassEditElement("age").setNumberType("integer");
classEditPage.clickSaveAndContinue();
classEditPage.deleteProperty("color");
testPage = classEditPage.clickSaveAndView();
// Add tags.
TaggablePage taggablePage = new TaggablePage();
AddTagsPane addTagsPane = taggablePage.addTags();
addTagsPane.setTags("foo,bar");
addTagsPane.add();
taggablePage.removeTag("foo");
// Attach files.
AttachmentsPane attachmentsPane = testPage.openAttachmentsDocExtraPane();
// TODO: Update this code when we (re)add support for uploading multiple files at once.
for (String fileName : new String[] { "SmallAttachment.txt", "SmallAttachment2.txt", "SmallAttachment.txt" }) {
attachmentsPane.setFileToUpload(this.getClass().getResource('/' + fileName).getPath());
attachmentsPane.waitForUploadToFinish(fileName);
attachmentsPane.clickHideProgress();
}
attachmentsPane.deleteAttachmentByFileByName("SmallAttachment2.txt");
// Add comments.
getUtil().createUserAndLogin("Alice", "ecila");
testPage = getUtil().gotoPage(getTestClassName(), pageName);
CommentsTab commentsTab = testPage.openCommentsDocExtraPane();
commentsTab.postComment("first line\nsecond line", true);
commentsTab.editCommentByID(0, "first line\nline in between\nsecond line");
commentsTab.replyToCommentByID(0, "this is a reply");
commentsTab.deleteCommentByID(1);
}
use of org.xwiki.test.ui.po.CommentsTab in project xwiki-platform by xwiki.
the class NotificationsIT method testCompositeNotifications.
@Test
public void testCompositeNotifications() throws Exception {
NotificationsUserProfilePage p;
NotificationsTrayPage tray;
// Now we enable "create", "update" and "comment" for user 2
getUtil().login(SECOND_USER_NAME, SECOND_USER_PASSWORD);
p = NotificationsUserProfilePage.gotoPage(SECOND_USER_NAME);
p.getApplication(SYSTEM).setCollapsed(false);
p.setEventTypeState(SYSTEM, CREATE, ALERT_FORMAT, BootstrapSwitch.State.OFF);
p.setEventTypeState(SYSTEM, UPDATE, ALERT_FORMAT, BootstrapSwitch.State.ON);
p.setEventTypeState(SYSTEM, ADD_COMMENT, ALERT_FORMAT, BootstrapSwitch.State.ON);
getUtil().gotoPage("Main", "WebHome");
tray = new NotificationsTrayPage();
tray.clearAllNotifications();
// Create a page, edit it twice, and finally add a comment
getUtil().login(FIRST_USER_NAME, FIRST_USER_PASSWORD);
getUtil().createPage(getTestClassName(), "Linux", "Simple content", "Linux as a title");
ViewPage page = getUtil().gotoPage(getTestClassName(), "Linux");
page.edit();
WikiEditPage edit = new WikiEditPage();
edit.setContent("Linux is a part of GNU/Linux");
edit.clickSaveAndContinue(true);
edit.setContent("Linux is a part of GNU/Linux - it's the kernel");
edit.clickSaveAndView(true);
page = getUtil().gotoPage(getTestClassName(), "Linux");
CommentsTab commentsTab = page.openCommentsDocExtraPane();
commentsTab.postComment("Linux is a great OS", true);
// Check that events have been grouped together (see: https://jira.xwiki.org/browse/XWIKI-14114)
getUtil().login(SECOND_USER_NAME, SECOND_USER_PASSWORD);
getUtil().gotoPage(getTestClassName(), "WebHome");
tray = new NotificationsTrayPage();
assertEquals(2, tray.getNotificationsCount());
assertEquals("Linux as a title", tray.getNotificationPage(0));
assertTrue(tray.getNotificationDescription(0).startsWith("commented by user1"));
assertEquals("Linux as a title", tray.getNotificationPage(1));
assertEquals("update", tray.getNotificationType(1));
assertTrue(tray.getNotificationDescription(1).startsWith("edited by user1"));
tray.clearAllNotifications();
}
use of org.xwiki.test.ui.po.CommentsTab in project xwiki-platform by xwiki.
the class CommentAsGuestTest method testCannotEditCommentAsAnonymous.
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testCannotEditCommentAsAnonymous() {
CommentsTab commentsTab = this.vp.openCommentsDocExtraPane();
commentsTab.postCommentAsGuest(COMMENT_CONTENT, COMMENT_AUTHOR, true);
Assert.assertFalse(commentsTab.hasEditButtonForCommentByID(commentsTab.getCommentID(COMMENT_CONTENT)));
}
Aggregations