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