Search in sources :

Example 6 with AdministrationPage

use of org.xwiki.administration.test.po.AdministrationPage in project xwiki-platform by xwiki.

the class MessageStreamTest method verifyGlobalAndSpaceAdministrationSections.

@Test
public void verifyGlobalAndSpaceAdministrationSections() {
    // Go to the wiki's administration page directly (the goal of this test is not to test the navigation
    // from the Drawer menu to the Administration page).
    AdministrationPage wikiAdministrationPage = AdministrationPage.gotoPage();
    // The MessageStream section should be present
    assertTrue(wikiAdministrationPage.hasSection("MessageStream"));
    // Go to a space's administration page (we use the XWiki space).
    AdministrationPage spaceAdministrationPage = AdministrationPage.gotoSpaceAdministrationPage("XWiki");
    // The MessageStream section should not be present since it's only a wiki level option
    assertTrue(spaceAdministrationPage.hasNotSection("MessageStream"));
}
Also used : AdministrationPage(org.xwiki.administration.test.po.AdministrationPage) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 7 with AdministrationPage

use of org.xwiki.administration.test.po.AdministrationPage in project xwiki-platform by xwiki.

the class AdministrationIT method verifyGlobalAndSpaceSections.

/**
 * This method makes the following tests :
 *
 * <ul>
 * <li>Validate presence of default sections for global and space sections.</li>
 * <li>Validate presence of application administration sections at global level only.</li>
 * </ul>
 */
@Test
public void verifyGlobalAndSpaceSections() {
    // Navigate to a (non existent for test performance reasons) page in view mode.
    getUtil().gotoPage("NonExistentSpace", "NonExistentPage");
    // Verify that pages have an Admin menu and navigate to the admin UI.
    AdministrablePage page = new AdministrablePage();
    AdministrationPage administrationPage = page.clickAdministerWiki();
    assertEquals("Global Administration: Home", administrationPage.getDocumentTitle());
    assertTrue(administrationPage.getBreadcrumbContent().endsWith("/Global Administration"));
    // TODO: Move these tests in their own modules, i.e. the modules that brought the Administration UI extension.
    Arrays.asList("Users", "Groups", "Rights", "Registration", "Themes", "Presentation", "Templates", "Localization", "Import", "Export", "Editing", "emailSend", "emailStatus", "emailGeneral", "analytics").stream().forEach(new Consumer<String>() {

        @Override
        public void accept(String sectionId) {
            assertTrue(String.format("Seection %s is missing.", sectionId), administrationPage.hasSection(sectionId));
        }
    });
    // These are page-only sections.
    assertTrue(administrationPage.hasNotSection("PageAndChildrenRights"));
    assertTrue(administrationPage.hasNotSection("PageRights"));
    // Select XWiki space administration.
    AdministrationPage spaceAdministrationPage = AdministrationPage.gotoSpaceAdministrationPage("XWiki");
    assertEquals("Page Administration: XWiki", spaceAdministrationPage.getDocumentTitle());
    assertTrue(spaceAdministrationPage.getBreadcrumbContent().endsWith("/Page Administration"));
    assertTrue(spaceAdministrationPage.hasSection("Themes"));
    assertTrue(spaceAdministrationPage.hasSection("Presentation"));
    assertTrue(spaceAdministrationPage.hasSection("PageAndChildrenRights"));
    assertTrue(spaceAdministrationPage.hasSection("PageRights"));
    // All these sections should not be present (they provide global configuration).
    Arrays.asList("Users", "Groups", "Rights", "Registration", "Templates", "Localization", "Import", "Export", "Editing", "emailSend", "emailStatus", "emailGeneral", "analytics").stream().forEach(new Consumer<String>() {

        @Override
        public void accept(String sectionId) {
            assertTrue(String.format("Seection %s is present.", sectionId), administrationPage.hasNotSection(sectionId));
        }
    });
}
Also used : AdministrationPage(org.xwiki.administration.test.po.AdministrationPage) AdministrablePage(org.xwiki.administration.test.po.AdministrablePage) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 8 with AdministrationPage

use of org.xwiki.administration.test.po.AdministrationPage in project xwiki-platform by xwiki.

the class FlamingoThemeTest method editFlamingoTheme.

@Test
public void editFlamingoTheme() throws Exception {
    // Go to the presentation section of the administration
    AdministrationPage administrationPage = AdministrationPage.gotoPage();
    ThemesAdministrationSectionPage presentationAdministrationSectionPage = administrationPage.clickThemesSection();
    // Select the 'Charcoal' color theme
    presentationAdministrationSectionPage.setColorTheme("Charcoal");
    assertEquals("Charcoal", presentationAdministrationSectionPage.getCurrentColorTheme());
    // Click on the 'customize' button
    presentationAdministrationSectionPage.clickOnCustomize();
    EditThemePage editThemePage = new EditThemePage();
    // Wait for the preview to be fully loaded
    assertTrue(editThemePage.isPreviewBoxLoading());
    editThemePage.waitUntilPreviewIsLoaded();
    // First, disable auto refresh because it slows down the test
    // (and can even make it fails if the computer is slow)
    editThemePage.setAutoRefresh(false);
    verifyAllVariablesCategoriesArePresent(editThemePage);
    verifyVariablesCategoriesDoesNotDisappear(editThemePage);
    verifyThatPreviewWorks(editThemePage);
// We do not have a way top clear the browser's cache with selenium
// (see http://stackoverflow.com/questions/19310888/clear-browser-cache-using-selenium-webdriver).
// So we cannot ensure that saving an existing theme works.
}
Also used : ThemesAdministrationSectionPage(org.xwiki.administration.test.po.ThemesAdministrationSectionPage) AdministrationPage(org.xwiki.administration.test.po.AdministrationPage) EditThemePage(org.xwiki.flamingo.test.po.EditThemePage) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 9 with AdministrationPage

use of org.xwiki.administration.test.po.AdministrationPage in project xwiki-platform by xwiki.

the class FlamingoThemeTest method createNewTheme.

/**
 * @since 6.3RC1
 */
@Test
public void createNewTheme() throws Exception {
    // Go to the presentation section of the administration
    AdministrationPage administrationPage = AdministrationPage.gotoPage();
    ThemesAdministrationSectionPage presentationAdministrationSectionPage = administrationPage.clickThemesSection();
    // Click on "manage color theme"
    presentationAdministrationSectionPage.manageColorThemes();
    ThemeApplicationWebHomePage themeApplicationWebHomePage = new ThemeApplicationWebHomePage();
    // Ensure the current theme is correct
    assertEquals("Charcoal", themeApplicationWebHomePage.getCurrentTheme());
    // Ensure the other themes are correct
    List<String> otherThemes = themeApplicationWebHomePage.getOtherThemes();
    assertTrue(otherThemes.contains("Marina"));
    assertTrue(otherThemes.contains("Garden"));
    assertTrue(otherThemes.contains("Kitty"));
    assertFalse(otherThemes.contains("Charcoal"));
    // Create a new theme
    EditThemePage editThemePage = themeApplicationWebHomePage.createNewTheme("Test");
    editThemePage.waitUntilPreviewIsLoaded();
    // First, disable auto refresh because it slows down the test
    // (and can even make it fails if the computer is slow)
    editThemePage.setAutoRefresh(false);
    // Set variables
    editThemePage.selectVariableCategory("Base colors");
    editThemePage.setVariableValue("xwiki-page-content-bg", "#ff0000");
    editThemePage.selectVariableCategory("Typography");
    editThemePage.setVariableValue("font-family-base", "Monospace");
    editThemePage.selectVariableCategory("Advanced");
    // Insert lessCode too
    editThemePage.setTextareaValue("lessCode", ".main{ color: #0000ff; }");
    // Save the theme
    editThemePage.clickSaveAndView();
    // Go back to the theme application
    themeApplicationWebHomePage = ThemeApplicationWebHomePage.gotoPage();
    // Set the new theme as current
    themeApplicationWebHomePage.useTheme("Test");
    // Verify that the new theme is used
    assertEquals("Test", themeApplicationWebHomePage.getCurrentTheme());
    // Look at the values
    assertEquals("rgba(255, 0, 0, 1)", themeApplicationWebHomePage.getPageBackgroundColor());
    assertEquals("monospace", themeApplicationWebHomePage.getFontFamily().toLowerCase());
    // Test 'lessCode' is correctly handled
    assertEquals("rgba(0, 0, 255, 1)", themeApplicationWebHomePage.getTextColor());
    // Switch back to Charcoal
    themeApplicationWebHomePage.useTheme("Charcoal");
    // Remove the theme
    ViewThemePage themePage = themeApplicationWebHomePage.seeTheme("Test");
    themePage.waitUntilPreviewIsLoaded();
    ConfirmationPage confirmationPage = themePage.delete();
    confirmationPage.confirmDeletePage().waitUntilIsTerminated();
}
Also used : ThemesAdministrationSectionPage(org.xwiki.administration.test.po.ThemesAdministrationSectionPage) AdministrationPage(org.xwiki.administration.test.po.AdministrationPage) ThemeApplicationWebHomePage(org.xwiki.flamingo.test.po.ThemeApplicationWebHomePage) ConfirmationPage(org.xwiki.test.ui.po.ConfirmationPage) ViewThemePage(org.xwiki.flamingo.test.po.ViewThemePage) EditThemePage(org.xwiki.flamingo.test.po.EditThemePage) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 10 with AdministrationPage

use of org.xwiki.administration.test.po.AdministrationPage in project xwiki-platform by xwiki.

the class ApplicationsPanelAdministrationPage method gotoPage.

public static ApplicationsPanelAdministrationPage gotoPage() {
    AdministrationPage administrationPage = AdministrationPage.gotoPage();
    assertTrue(administrationPage.hasSection("panels.applications"));
    administrationPage.clickSection("Look & Feel", "Applications Panel");
    return new ApplicationsPanelAdministrationPage();
}
Also used : AdministrationPage(org.xwiki.administration.test.po.AdministrationPage)

Aggregations

AdministrationPage (org.xwiki.administration.test.po.AdministrationPage)14 Test (org.junit.Test)8 AbstractTest (org.xwiki.test.ui.AbstractTest)6 LocalizationAdministrationSectionPage (org.xwiki.administration.test.po.LocalizationAdministrationSectionPage)3 ViewPage (org.xwiki.test.ui.po.ViewPage)3 Before (org.junit.Before)2 ThemesAdministrationSectionPage (org.xwiki.administration.test.po.ThemesAdministrationSectionPage)2 EditThemePage (org.xwiki.flamingo.test.po.EditThemePage)2 SendMailAdministrationSectionPage (org.xwiki.mail.test.po.SendMailAdministrationSectionPage)2 GreenMail (com.icegreen.greenmail.util.GreenMail)1 ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 UsernamePasswordCredentials (org.apache.commons.httpclient.UsernamePasswordCredentials)1 AdministrablePage (org.xwiki.administration.test.po.AdministrablePage)1 DefaultExtensionDependency (org.xwiki.extension.DefaultExtensionDependency)1 ExtensionId (org.xwiki.extension.ExtensionId)1 DependencyPane (org.xwiki.extension.test.po.DependencyPane)1 ExtensionAdministrationPage (org.xwiki.extension.test.po.ExtensionAdministrationPage)1 ExtensionDependenciesPane (org.xwiki.extension.test.po.ExtensionDependenciesPane)1 ExtensionPane (org.xwiki.extension.test.po.ExtensionPane)1