Search in sources :

Example 11 with WikiEditPage

use of org.xwiki.test.ui.po.editor.WikiEditPage in project xwiki-platform by xwiki.

the class SectionTest method testSectionEditInWikiEditorWhenSyntax2x.

private void testSectionEditInWikiEditorWhenSyntax2x(String syntaxId) {
    ViewPage vp = createTestPages(syntaxId);
    // Edit the second section in the wiki editor
    WikiEditPage wikiEditPage = vp.editSection(2).editWiki();
    Assert.assertEquals("= Section2 = Content2 == Section3 == Content3 " + "{{include document=\"Test.SectionEditingIncluded\"/}}", wikiEditPage.getContent());
    vp = wikiEditPage.clickCancel();
    // Edit the third section in the wiki editor
    wikiEditPage = vp.editSection(3).editWiki();
    Assert.assertEquals("== Section3 == Content3 {{include document=\"Test.SectionEditingIncluded\"/}}", wikiEditPage.getContent());
    vp = wikiEditPage.clickCancel();
    // Edit the fourth section in the wiki editor
    // Note: we prove that included documents don't generate editable sections by checking that the fourth section
    // is "Section7".
    wikiEditPage = vp.editSection(4).editWiki();
    Assert.assertEquals("= Section7 = Content7", wikiEditPage.getContent());
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage)

Example 12 with WikiEditPage

use of org.xwiki.test.ui.po.editor.WikiEditPage 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 13 with WikiEditPage

use of org.xwiki.test.ui.po.editor.WikiEditPage in project xwiki-platform by xwiki.

the class NewPagePanelTest method testCreatePageFromPanel.

/**
 * Tests if a new page can be created using the create page panel.
 */
@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 testCreatePageFromPanel() {
    NewPagePanel newPagePanel = NewPagePanel.gotoPage();
    CreatePagePage createPagePage = newPagePanel.createPage(getTestClassName(), getTestMethodName());
    createPagePage.clickCreate();
    WikiEditPage editPage = new WikiEditPage();
    Assert.assertEquals(getTestMethodName(), editPage.getDocumentTitle());
    Assert.assertEquals("WebHome", editPage.getMetaDataValue("page"));
    Assert.assertEquals(getTestClassName() + "." + getTestMethodName(), editPage.getMetaDataValue("space"));
}
Also used : NewPagePanel(org.xwiki.panels.test.po.NewPagePanel) CreatePagePage(org.xwiki.test.ui.po.CreatePagePage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 14 with WikiEditPage

use of org.xwiki.test.ui.po.editor.WikiEditPage in project xwiki-platform by xwiki.

the class EditObjectsTest method testEmptyGroupObjects.

/**
 * XWIKI-5832: Cannot create groups or add members to existing groups using the object editor.
 */
@Test
public void testEmptyGroupObjects() {
    // Create a doc
    WikiEditPage wep = WikiEditPage.gotoPage("Test", "EditObjectsTestObject");
    wep.setContent("this is the content");
    ViewPage vp = wep.clickSaveAndView();
    // Add an XWikiGroups object
    ObjectEditPage oep = vp.editObjects();
    oep.addObject("XWiki.XWikiGroups");
    vp = oep.clickSaveAndView();
    oep = vp.editObjects();
    Assert.assertEquals(1, oep.getObjectsOfClass("XWiki.XWikiGroups").size());
}
Also used : ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) Test(org.junit.Test)

Example 15 with WikiEditPage

use of org.xwiki.test.ui.po.editor.WikiEditPage in project xwiki-platform by xwiki.

the class EditObjectsTest method testChangeListMultipleSelect.

/**
 * Prove that a list can be changed from relational storage to plain storage and back without database corruption.
 * XWIKI-299 test
 */
@Test
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146")
public void testChangeListMultipleSelect() {
    // Create class page
    WikiEditPage wep = WikiEditPage.gotoPage("Test", "EditObjectsTestClass");
    wep.setContent("this is the content");
    ViewPage vp = wep.clickSaveAndView();
    // Add class
    ClassEditPage cep = vp.editClass();
    cep.addProperty("prop", "StaticList");
    StaticListClassEditElement slcee = cep.getStaticListClassEditElement("prop");
    slcee.setMultiSelect(false);
    slcee.setValues("choice 1|choice 2|choice 3|choice 4|choice 5");
    vp = cep.clickSaveAndView();
    Assert.assertEquals("this is the content", vp.getContent());
    // Create object page
    wep = WikiEditPage.gotoPage("Test", "EditObjectsTestObject");
    wep.setContent("this is the content: {{velocity}}$doc.display('prop'){{/velocity}}");
    vp = wep.clickSaveAndView();
    // Add object
    ObjectEditPage oep = vp.editObjects();
    FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
    objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "choice 3");
    vp = oep.clickSaveAndView();
    Assert.assertEquals("this is the content: choice 3", vp.getContent());
    // Change list to a multiple select.
    cep = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
    cep.getStaticListClassEditElement("prop").setMultiSelect(true);
    vp = cep.clickSaveAndView();
    Assert.assertEquals("this is the content", vp.getContent());
    // Verify conversion
    oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
    oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "choice 3");
    oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "choice 4");
    vp = oep.clickSaveAndView();
    Assert.assertEquals("this is the content: choice 3 choice 4", vp.getContent());
}
Also used : ClassEditPage(org.xwiki.test.ui.po.editor.ClassEditPage) StaticListClassEditElement(org.xwiki.test.ui.po.editor.StaticListClassEditElement) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) FormElement(org.xwiki.test.ui.po.FormElement) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Aggregations

WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)24 Test (org.junit.Test)20 ViewPage (org.xwiki.test.ui.po.ViewPage)17 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)8 ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)8 AbstractTest (org.xwiki.test.ui.AbstractTest)6 FormElement (org.xwiki.test.ui.po.FormElement)6 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)5 IgnoreBrowser (org.xwiki.test.ui.browser.IgnoreBrowser)4 HashMap (java.util.HashMap)3 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)3 ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)2 AdministrationPage (org.xwiki.administration.test.po.AdministrationPage)2 LocalizationAdministrationSectionPage (org.xwiki.administration.test.po.LocalizationAdministrationSectionPage)2 NotificationsTrayPage (org.xwiki.platform.notifications.test.po.NotificationsTrayPage)2 NotificationsUserProfilePage (org.xwiki.platform.notifications.test.po.NotificationsUserProfilePage)2 CommentsTab (org.xwiki.test.ui.po.CommentsTab)2 CreatePagePage (org.xwiki.test.ui.po.CreatePagePage)2 HistoryPane (org.xwiki.test.ui.po.HistoryPane)2 LiveTableElement (org.xwiki.test.ui.po.LiveTableElement)2