use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.
the class UserProfileTest method testChangePassword.
/**
* Functionality check: changing the password.
*/
@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 testChangePassword() {
// Change the password
PreferencesUserProfilePage preferencesPage = this.customProfilePage.switchToPreferences();
ChangePasswordPage changePasswordPage = preferencesPage.changePassword();
String newPassword = RandomStringUtils.randomAlphanumeric(6);
changePasswordPage.changePassword(DEFAULT_PASSWORD, newPassword, newPassword);
changePasswordPage.submit();
// Logout
getUtil().forceGuestUser();
// Login with the new password and navigate to a page to verify that the user is logged in
getUtil().loginAndGotoPage(this.userName, newPassword, getUtil().getURL(getTestClassName(), getTestMethodName()));
ViewPage vp = new ViewPage();
Assert.assertTrue(vp.isAuthenticated());
getUtil().recacheSecretToken();
// Reset the password
getUtil().loginAsSuperAdminAndGotoPage(this.customProfilePage.getURL());
preferencesPage = this.customProfilePage.switchToPreferences();
changePasswordPage = preferencesPage.changePassword();
changePasswordPage.changePasswordAsAdmin(DEFAULT_PASSWORD, DEFAULT_PASSWORD);
changePasswordPage.submit();
Assert.assertEquals("Your password has been successfully changed.", changePasswordPage.getSuccessMessage());
}
use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.
the class ResourceTest method accessResources.
@Test
public void accessResources() throws Exception {
// Verify that accessing /view/A/B goes to A.B.WebHome (Nested Documents URL shortcut feature)
getUtil().gotoPage(getUtil().getURL("view", new String[] { "A", "B" }, null));
// Edit the page and verify the URL
// The wiki is empty and there's no WYSIWYG so clicking edit will go to the wiki editor
new ViewPage().edit();
EditPage ep = new EditPage();
assertTrue(new URL(ep.getPageURL()).getPath().endsWith("A/B/WebHome"));
// Verify that accessing /edit/A/B edits A.B (Nested Documents URL shortcut feature is only for view mode)
getUtil().gotoPage(getUtil().getURL("edit", new String[] { "A", "B" }, null));
ep = new EditPage();
assertTrue(new URL(ep.getPageURL()).getPath().endsWith("A/B"));
// Verify that the spaceRedirect=false query string parameter and value can be used to disable the automatic
// space redirect
getUtil().gotoPage(getUtil().getURL("view", new String[] { "A", "B" }, "spaceRedirect=false"));
new ViewPage().edit();
ep = new EditPage();
assertTrue(new URL(ep.getPageURL()).getPath().endsWith("A/B"));
}
use of org.xwiki.test.ui.po.ViewPage 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.ViewPage 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());
}
use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.
the class EditObjectsTest method testChangeMultiselectProperty.
/**
* Tests that XWIKI-1621 remains fixed.
*/
@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 testChangeMultiselectProperty() {
// Create a class with a database list property set to return all documents
ClassEditPage cep = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
cep.addProperty("prop", "DBList");
cep.getDatabaseListClassEditElement("prop").setHibernateQuery("select doc.fullName from XWikiDocument doc where doc.space = 'Test'");
cep.clickSaveAndView();
// Create a second page to hold the Object and set its content
WikiEditPage wep = WikiEditPage.gotoPage("Test", "EditObjectsTestObject");
wep.setContent("this is the content");
ViewPage vp = wep.clickSaveAndView();
// Add an object of the class created and set the value to be the test page
ObjectEditPage oep = vp.editObjects();
FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "Test.EditObjectsTestClass");
oep.clickSaveAndView();
// Set multiselect to true
cep = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
cep.getDatabaseListClassEditElement("prop").setMultiSelect(true);
cep.clickSaveAndView();
// Select a second document in the DB list select field.
oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "Test.EditObjectsTestObject");
vp = oep.clickSaveAndView();
Assert.assertEquals("this is the content", vp.getContent());
}
Aggregations