use of org.xwiki.test.ui.po.ViewPage 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.ViewPage 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());
}
use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.
the class ClassEditorTest method testDeleteField.
/**
* Tests that class fields can be deleted and that documents having objects of that class are updated.
*/
@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 testDeleteField() {
// Add two fields.
editor.addField("Boolean").setPrettyName("Available");
editor.addField("Date").setPrettyName("Day");
// Save and assert they are present.
ViewPage classView = editor.clickSaveAndView();
Assert.assertTrue(classView.getContent().contains("Available (boolean1: Boolean)"));
Assert.assertTrue(classView.getContent().contains("Day (date1: Date)"));
// Edit again and delete one of the fields.
classView.edit();
new ClassFieldEditPane("boolean1").delete().clickYes();
// Save and check if the field was removed.
classView = new ApplicationClassEditPage().clickSaveAndView();
Assert.assertFalse(classView.getContent().contains("Available (boolean1: Boolean)"));
Assert.assertTrue(classView.getContent().contains("Day (date1: Date)"));
// Edit the class template and see if the deleted field is now deprecated.
ObjectEditPage objectEditor = new ClassSheetPage().clickTemplateLink().editObjects();
String className = String.format("%s.%s", getTestClassName(), getTestMethodName());
Assert.assertTrue(objectEditor.isPropertyDeprecated(className, "boolean1"));
Assert.assertFalse(objectEditor.isPropertyDeprecated(className, "date1"));
}
use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.
the class ClassEditorTest method testSaveAndContinue.
/**
* Tests the Save & Continue button.
*/
@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 testSaveAndContinue() {
editor.addField("Date");
editor.clickSaveAndContinue();
// Check if the field was added.
ViewPage viewer = editor.clickCancel();
Assert.assertTrue(viewer.getContent().contains("Date (date1: Date)"));
// Edit again. This time check the error message.
viewer.edit();
editor = new ApplicationClassEditPage();
// Try to set the field name to an invalid value.
ClassFieldEditPane field = new ClassFieldEditPane("date1");
field.openConfigPanel();
field.setName("-delta");
editor.clickSaveAndContinue(false);
editor.waitForNotificationErrorMessage("Failed to save the page.");
// Double check that the field wasn't renamed.
Assert.assertTrue(editor.clickCancel().getContent().contains("Date (date1: Date)"));
}
use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.
the class ClassEditorTest method testRenameField.
/**
* Tests that class fields can be renamed.
*/
@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 testRenameField() {
// Add a class field.
editor.addField("Number").setDefaultValue("13");
// Save and edit the class template.
editor.clickSaveAndView();
new ClassSheetPage().clickTemplateLink().edit();
// Change the field value.
EntryEditPage inlineEditor = new EntryEditPage();
Assert.assertEquals("13", inlineEditor.getValue("number1"));
inlineEditor.setValue("number1", "27");
// Save and edit again the class.
inlineEditor.clickSaveAndView();
getUtil().gotoPage(getTestClassName(), getTestMethodName());
new ViewPage().edit();
// Rename the class field.
ClassFieldEditPane field = new ClassFieldEditPane("number1");
field.openConfigPanel();
field.setName("age");
// Save and edit again the class template.
new ApplicationClassEditPage().clickSaveAndView();
new ClassSheetPage().clickTemplateLink().edit();
Assert.assertEquals("27", new EntryEditPage().getValue("age"));
}
Aggregations