Search in sources :

Example 1 with CommentsTab

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)));
}
Also used : CommentsTab(org.xwiki.test.ui.po.CommentsTab) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 2 with CommentsTab

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)));
}
Also used : CommentsTab(org.xwiki.test.ui.po.CommentsTab) ViewPage(org.xwiki.test.ui.po.ViewPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 3 with CommentsTab

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);
}
Also used : ClassEditPage(org.xwiki.test.ui.po.editor.ClassEditPage) HashMap(java.util.HashMap) AttachmentsPane(org.xwiki.test.ui.po.AttachmentsPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) CommentsTab(org.xwiki.test.ui.po.CommentsTab) TaggablePage(org.xwiki.tag.test.po.TaggablePage) AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) FormElement(org.xwiki.test.ui.po.FormElement) Before(org.junit.Before)

Example 4 with CommentsTab

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();
}
Also used : NotificationsUserProfilePage(org.xwiki.platform.notifications.test.po.NotificationsUserProfilePage) CommentsTab(org.xwiki.test.ui.po.CommentsTab) NotificationsTrayPage(org.xwiki.platform.notifications.test.po.NotificationsTrayPage) ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test) ServerSetupTest(com.icegreen.greenmail.util.ServerSetupTest)

Example 5 with CommentsTab

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)));
}
Also used : CommentsTab(org.xwiki.test.ui.po.CommentsTab) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Aggregations

CommentsTab (org.xwiki.test.ui.po.CommentsTab)6 Test (org.junit.Test)5 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)4 ViewPage (org.xwiki.test.ui.po.ViewPage)2 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)2 ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 NotificationsTrayPage (org.xwiki.platform.notifications.test.po.NotificationsTrayPage)1 NotificationsUserProfilePage (org.xwiki.platform.notifications.test.po.NotificationsUserProfilePage)1 AddTagsPane (org.xwiki.tag.test.po.AddTagsPane)1 TaggablePage (org.xwiki.tag.test.po.TaggablePage)1 AbstractTest (org.xwiki.test.ui.AbstractTest)1 AttachmentsPane (org.xwiki.test.ui.po.AttachmentsPane)1 FormElement (org.xwiki.test.ui.po.FormElement)1 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)1 ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)1