Search in sources :

Example 71 with ViewPage

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());
}
Also used : ChangePasswordPage(org.xwiki.user.test.po.ChangePasswordPage) ViewPage(org.xwiki.test.ui.po.ViewPage) PreferencesUserProfilePage(org.xwiki.user.test.po.PreferencesUserProfilePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 72 with ViewPage

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"));
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) EditPage(org.xwiki.test.ui.po.editor.EditPage) URL(java.net.URL) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 73 with ViewPage

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());
}
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 74 with ViewPage

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

Example 75 with ViewPage

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());
}
Also used : ClassEditPage(org.xwiki.test.ui.po.editor.ClassEditPage) 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) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Aggregations

ViewPage (org.xwiki.test.ui.po.ViewPage)93 Test (org.junit.Test)75 AbstractTest (org.xwiki.test.ui.AbstractTest)41 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)26 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)18 ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)11 IgnoreBrowser (org.xwiki.test.ui.browser.IgnoreBrowser)10 DocumentReference (org.xwiki.model.reference.DocumentReference)8 CreatePagePage (org.xwiki.test.ui.po.CreatePagePage)8 FormElement (org.xwiki.test.ui.po.FormElement)7 HistoryPane (org.xwiki.test.ui.po.HistoryPane)7 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)7 WebElement (org.openqa.selenium.WebElement)6 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)6 AttachmentsPane (org.xwiki.test.ui.po.AttachmentsPane)6 URL (java.net.URL)5 ApplicationClassEditPage (org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage)5 ClassFieldEditPane (org.xwiki.appwithinminutes.test.po.ClassFieldEditPane)5 ExtensionId (org.xwiki.extension.ExtensionId)5 ExtensionAdministrationPage (org.xwiki.extension.test.po.ExtensionAdministrationPage)5