Search in sources :

Example 1 with ObjectEditPage

use of org.xwiki.test.ui.po.editor.ObjectEditPage in project xwiki-platform by xwiki.

the class NotificationsIT method testNotificationDisplayerClass.

@Test
public void testNotificationDisplayerClass() throws Exception {
    // Create the pages and a custom displayer for "update" events
    getUtil().login(SUPERADMIN_USER_NAME, SUPERADMIN_PASSWORD);
    getUtil().gotoPage(getTestClassName(), "WebHome");
    getUtil().createPage(getTestClassName(), "ARandomPageThatShouldBeModified", "Page used for the tests of the NotificationDisplayerClass XObject.", "Test page");
    getUtil().createPage(getTestClassName(), "NotificationDisplayerClassTest", "Page used for the tests of the NotificationDisplayerClass XObject.", "Test page 2");
    Map<String, String> notificationDisplayerParameters = new HashMap<String, String>() {

        {
            put("XWiki.Notifications.Code.NotificationDisplayerClass_0_eventType", "update");
            put("XWiki.Notifications.Code.NotificationDisplayerClass_0_notificationTemplate", "This is a test template");
        }
    };
    ObjectEditPage editObjects = getUtil().editObjects(getTestClassName(), "NotificationDisplayerClassTest");
    editObjects.addObject("XWiki.Notifications.Code.NotificationDisplayerClass");
    editObjects.getObjectsOfClass("XWiki.Notifications.Code.NotificationDisplayerClass").get(0).fillFieldsByName(notificationDisplayerParameters);
    editObjects.clickSaveAndContinue(true);
    // Login as first user, and enable notifications on document updates
    getUtil().login(FIRST_USER_NAME, FIRST_USER_PASSWORD);
    NotificationsUserProfilePage p = NotificationsUserProfilePage.gotoPage(FIRST_USER_NAME);
    p.getApplication(SYSTEM).setCollapsed(false);
    p.setEventTypeState(SYSTEM, UPDATE, ALERT_FORMAT, BootstrapSwitch.State.ON);
    // Login as second user and modify ARandomPageThatShouldBeModified
    getUtil().login(SECOND_USER_NAME, SECOND_USER_PASSWORD);
    ViewPage viewPage = getUtil().gotoPage(getTestClassName(), "ARandomPageThatShouldBeModified");
    viewPage.edit();
    WikiEditPage editPage = new WikiEditPage();
    editPage.setContent("Something");
    editPage.clickSaveAndView(true);
    // Login as the first user, ensure that the notification is displayed with a custom template
    getUtil().login(FIRST_USER_NAME, FIRST_USER_PASSWORD);
    getUtil().gotoPage(getTestClassName(), "WebHome");
    NotificationsTrayPage tray = new NotificationsTrayPage();
    assertEquals("This is a test template", tray.getNotificationRawContent(0));
}
Also used : NotificationsUserProfilePage(org.xwiki.platform.notifications.test.po.NotificationsUserProfilePage) HashMap(java.util.HashMap) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) NotificationsTrayPage(org.xwiki.platform.notifications.test.po.NotificationsTrayPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test) ServerSetupTest(com.icegreen.greenmail.util.ServerSetupTest)

Example 2 with ObjectEditPage

use of org.xwiki.test.ui.po.editor.ObjectEditPage in project xwiki-platform by xwiki.

the class RepositoryTest method getNumberOfExtensionVersionsObjects.

private int getNumberOfExtensionVersionsObjects(String extensionName) {
    ObjectEditPage objectEditPage = goToObjectEditPage(extensionName);
    List<ObjectEditPane> versionObjects = objectEditPage.getObjectsOfClass(XWikiRepositoryModel.EXTENSIONVERSION_CLASSNAME);
    return versionObjects.size();
}
Also used : ObjectEditPane(org.xwiki.test.ui.po.editor.ObjectEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage)

Example 3 with ObjectEditPage

use of org.xwiki.test.ui.po.editor.ObjectEditPage in project xwiki-platform by xwiki.

the class RepositoryTest method getNumberOfExtensionVersionsDependenciesObjects.

private int getNumberOfExtensionVersionsDependenciesObjects(String extensionName) {
    ObjectEditPage objectEditPage = goToObjectEditPage(extensionName);
    List<ObjectEditPane> dependenciesObjects = objectEditPage.getObjectsOfClass(XWikiRepositoryModel.EXTENSIONDEPENDENCY_CLASSNAME);
    return dependenciesObjects.size();
}
Also used : ObjectEditPane(org.xwiki.test.ui.po.editor.ObjectEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage)

Example 4 with ObjectEditPage

use of org.xwiki.test.ui.po.editor.ObjectEditPage in project xwiki-platform by xwiki.

the class RepositoryTestUtils method gotoExtensionObjectsEditPage.

/**
 * @since 9.5RC1
 */
public ObjectEditPage gotoExtensionObjectsEditPage(String extensionName) {
    LocalDocumentReference extensionPageReference = getExtensionPageReference(extensionName);
    testUtils.gotoPage(extensionPageReference, "edit", Collections.singletonMap("editor", "object"));
    return new ObjectEditPage();
}
Also used : LocalDocumentReference(org.xwiki.model.reference.LocalDocumentReference) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage)

Example 5 with ObjectEditPage

use of org.xwiki.test.ui.po.editor.ObjectEditPage in project xwiki-platform by xwiki.

the class ApplicationsPanelAdministrationTest method createApplicationUIX.

private void createApplicationUIX(String applicationName) {
    getUtil().deletePage(new LocalDocumentReference(Arrays.asList("Apps", applicationName), "WebHome"));
    ViewPage page = getUtil().gotoPage("Apps", applicationName);
    ObjectEditPage editPage = page.editObjects();
    ObjectEditPane object = editPage.addObject("XWiki.UIExtensionClass");
    fillField(object, "extensionPointId", "org.xwiki.platform.panels.Applications");
    fillField(object, "name", applicationName);
    fillField(object, "parameters", String.format("label=%s\ntarget=Apps.%s\nicon=icon:home", applicationName, applicationName));
    editPage.clickSaveAndView();
}
Also used : LocalDocumentReference(org.xwiki.model.reference.LocalDocumentReference) ObjectEditPane(org.xwiki.test.ui.po.editor.ObjectEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage)

Aggregations

ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)21 Test (org.junit.Test)15 ViewPage (org.xwiki.test.ui.po.ViewPage)11 FormElement (org.xwiki.test.ui.po.FormElement)9 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)9 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)8 ObjectEditPane (org.xwiki.test.ui.po.editor.ObjectEditPane)6 IgnoreBrowser (org.xwiki.test.ui.browser.IgnoreBrowser)5 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)4 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)3 HashMap (java.util.HashMap)2 AbstractTest (org.xwiki.test.ui.AbstractTest)2 StaticListClassEditElement (org.xwiki.test.ui.po.editor.StaticListClassEditElement)2 ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)1 MimeMessage (javax.mail.internet.MimeMessage)1 Before (org.junit.Before)1 TimeoutException (org.openqa.selenium.TimeoutException)1 ApplicationClassEditPage (org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage)1 ClassFieldEditPane (org.xwiki.appwithinminutes.test.po.ClassFieldEditPane)1 LongTextClassFieldEditPane (org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane)1