Search in sources :

Example 1 with EditThemePage

use of org.xwiki.flamingo.test.po.EditThemePage 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 2 with EditThemePage

use of org.xwiki.flamingo.test.po.EditThemePage 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)

Aggregations

Test (org.junit.Test)2 AdministrationPage (org.xwiki.administration.test.po.AdministrationPage)2 ThemesAdministrationSectionPage (org.xwiki.administration.test.po.ThemesAdministrationSectionPage)2 EditThemePage (org.xwiki.flamingo.test.po.EditThemePage)2 AbstractTest (org.xwiki.test.ui.AbstractTest)2 ThemeApplicationWebHomePage (org.xwiki.flamingo.test.po.ThemeApplicationWebHomePage)1 ViewThemePage (org.xwiki.flamingo.test.po.ViewThemePage)1 ConfirmationPage (org.xwiki.test.ui.po.ConfirmationPage)1