use of org.xwiki.test.ui.po.editor.WikiEditPage in project xwiki-platform by xwiki.
the class PreviewTest method previewWithProgrammingRights.
/**
* @see "XWIKI-2490: Preview doesn't work when the document content has script requiring programming rights"
*/
@Test
public void previewWithProgrammingRights() {
WikiEditPage wikiEditPage = WikiEditPage.gotoPage(getTestClassName(), getTestMethodName());
wikiEditPage.setContent("{{velocity}}$xwiki.hasAccessLevel('programming')" + " $tdoc.author $tdoc.contentAuthor $tdoc.creator{{/velocity}}");
PreviewEditPage previewPage = wikiEditPage.clickPreview();
assertEquals("true XWiki.Admin XWiki.Admin XWiki.Admin", previewPage.getContent());
}
use of org.xwiki.test.ui.po.editor.WikiEditPage in project xwiki-platform by xwiki.
the class SectionTest method testSectionSaveDoesNotOverwriteTheTitle.
/**
* Verify that the document title is not overwritten when saving a section.
*
* @see <a href="https://jira.xwiki.org/browse/XWIKI-8938">XWIKI-8938: Translated title is overwritten by the default
* translation title when editing a document section</a>
*/
@Test
public void testSectionSaveDoesNotOverwriteTheTitle() throws Exception {
LocalDocumentReference pageReference = new LocalDocumentReference(getTestClassName(), getTestMethodName());
// Create the English version.
setLanguageSettings(false, "en", "en");
getUtil().rest().delete(pageReference);
getUtil().rest().savePage(pageReference, "Original content", "Original title");
try {
// Create the French version.
setLanguageSettings(true, "en", "en,fr");
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("language", "fr");
parameters.put("title", "Translated title");
parameters.put("content", "= Chapter 1 =\n\n Once upon a time ...");
getUtil().gotoPage(pageReference, "save", parameters);
// Switch back to monolingual with French as default language.
setLanguageSettings(false, "fr", "fr");
// Edit and save a document section and check if the document title was overwritten.
getUtil().gotoPage(pageReference, "edit", "editor=wiki§ion=1");
Assert.assertEquals("Translated title", new WikiEditPage().clickSaveAndView().getDocumentTitle());
} finally {
// Restore language settings.
setLanguageSettings(false, "en", "en");
}
}
use of org.xwiki.test.ui.po.editor.WikiEditPage in project xwiki-platform by xwiki.
the class SkinxTest method testJavascriptExtension.
/**
* https://jira.xwiki.org/browse/XWIKI-7913
*/
@Test
public void testJavascriptExtension() {
// Create a doc
WikiEditPage wep = WikiEditPage.gotoPage("Test", "SkinxTest");
wep.setContent("this is the content");
ViewPage vp = wep.clickSaveAndView();
// Add an XWikiGroups object
ObjectEditPage oep = vp.editObjects();
FormElement objectForm = oep.addObject("XWiki.JavaScriptExtension");
objectForm.setFieldValue(By.id("XWiki.JavaScriptExtension_0_code"), SCRIPT);
objectForm.getSelectElement(By.id("XWiki.JavaScriptExtension_0_use")).select("always");
oep.clickSaveAndView();
waitForScriptResult();
HomePage.gotoPage();
waitForScriptResult();
oep = ObjectEditPage.gotoPage("Test", "SkinxTest");
objectForm = oep.getObjectsOfClass("XWiki.JavaScriptExtension").get(0);
objectForm.getSelectElement(By.id("XWiki.JavaScriptExtension_0_use")).select("currentPage");
oep.clickSaveAndView();
waitForScriptResult();
HomePage.gotoPage();
try {
waitForScriptResult();
Assert.fail("The JSX should be active only on the current page.");
} catch (TimeoutException e) {
}
oep = ObjectEditPage.gotoPage("Test", "SkinxTest");
objectForm = oep.getObjectsOfClass("XWiki.JavaScriptExtension").get(0);
objectForm.getSelectElement(By.id("XWiki.JavaScriptExtension_0_use")).select("onDemand");
oep.clickSaveAndView();
try {
waitForScriptResult();
Assert.fail("The JSX should be active only on demand.");
} catch (TimeoutException e) {
}
}
use of org.xwiki.test.ui.po.editor.WikiEditPage in project xwiki-platform by xwiki.
the class VersionTest method testDeleteLatestVersion.
/**
* See XWIKI-8781
*/
@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 testDeleteLatestVersion() throws Exception {
getUtil().rest().deletePage(SPACE_NAME, PAGE_NAME);
// Create first version of the page
ViewPage vp = getUtil().createPage(SPACE_NAME, PAGE_NAME, CONTENT1, TITLE);
// Adds second version
WikiEditPage wikiEditPage = vp.editWiki();
wikiEditPage.setContent(CONTENT2);
wikiEditPage.clickSaveAndView();
// TODO: Remove when XWIKI-6688 (Possible race condition when clicking on a tab at the bottom of a page in
// view mode) is fixed.
vp.waitForDocExtraPaneActive("comments");
// Verify and delete the latest version.
HistoryPane historyTab = vp.openHistoryDocExtraPane();
Assert.assertEquals("2.1", historyTab.getCurrentVersion());
historyTab = historyTab.deleteVersion("2.1");
// Verify that the current version is now the previous one.
Assert.assertEquals("1.1", historyTab.getCurrentVersion());
Assert.assertEquals("Administrator", historyTab.getCurrentAuthor());
}
Aggregations