1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.administration.test.po

File PresentationAdministrationSectionPage.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart6.png
69% of files have more coverage

Code metrics

4
27
11
1
153
83
13
0.48
2.45
11
1.18

Classes

Class Line # Actions
PresentationAdministrationSectionPage 35 27 0% 13 20
0.5238095552.4%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.administration.test.po;
21   
22    import java.util.ArrayList;
23    import java.util.List;
24   
25    import org.openqa.selenium.By;
26    import org.openqa.selenium.WebElement;
27    import org.openqa.selenium.support.FindBy;
28   
29    /**
30    * Represents the actions possible on the Presentation administration section.
31    *
32    * @version $Id: c0de20c77b5fe73f40bcb7f5c6d9c911289e876d $
33    * @since 6.3M1
34    */
 
35    public class PresentationAdministrationSectionPage extends AdministrationSectionPage
36    {
37    /**
38    * The select input to set the color theme.
39    */
40    @FindBy(id = "XWiki.XWikiPreferences_0_colorTheme")
41    private WebElement iconThemeInput;
42   
43    @FindBy(xpath = "//label[@class='colorTheme']//a[contains(text(), 'Customize')]")
44    private WebElement customizeButton;
45   
46    @FindBy(xpath = "//a[contains(text(), 'Manage color themes')]")
47    private WebElement manageColorThemesButton;
48   
49    /**
50    * Default constructor.
51    */
 
52  2 toggle public PresentationAdministrationSectionPage()
53    {
54  2 super("Presentation");
55    }
56   
 
57  2 toggle private List<WebElement> getColorThemeOptions()
58    {
59  2 return iconThemeInput.findElements(By.tagName("option"));
60    }
61   
 
62  0 toggle private List<WebElement> getColibriThemeOptions()
63    {
64  0 return iconThemeInput.findElements(By.xpath("//optgroup[@label='Colibri Themes']//option"));
65    }
 
66  0 toggle private List<WebElement> getFlamingoThemeOptions()
67    {
68  0 return iconThemeInput.findElements(By.xpath("//optgroup[@label='Flamingo Themes']//option"));
69    }
70   
71    /**
72    * @return the list of available color themes
73    */
 
74  0 toggle public List<String> getColorThemes()
75    {
76  0 List<String> results = new ArrayList<>();
77  0 for (WebElement option : getColorThemeOptions()) {
78  0 results.add(option.getText());
79    }
80  0 return results;
81    }
82   
83    /**
84    * Select the specified color theme.
85    * @param colorThemeName name of the color theme to select
86    */
 
87  1 toggle public void setColorTheme(String colorThemeName)
88    {
89  1 for (WebElement option : getColorThemeOptions()) {
90  2 if (colorThemeName.equals(option.getText())) {
91  1 option.click();
92  1 break;
93    }
94    }
95    }
96   
97    /**
98    * @return the current color theme
99    */
 
100  1 toggle public String getCurrentColorTheme()
101    {
102  1 for (WebElement option : getColorThemeOptions()) {
103  2 if (option.isSelected()) {
104  1 return option.getText();
105    }
106    }
107  0 return null;
108    }
109   
110    /**
111    * @return the list of colibri themes
112    */
 
113  0 toggle public List<String> getColibriColorThemes()
114    {
115  0 List<String> results = new ArrayList<>();
116  0 for (WebElement option : getColibriThemeOptions()) {
117  0 results.add(option.getText());
118    }
119  0 return results;
120    }
121   
122    /**
123    * @return the list of flamingo themes
124    */
 
125  0 toggle public List<String> getFlamingoThemes()
126    {
127  0 List<String> results = new ArrayList<>();
128  0 for (WebElement option : getFlamingoThemeOptions()) {
129  0 results.add(option.getText());
130    }
131  0 return results;
132    }
133   
134    /**
135    * Click on the 'customize' button
136    */
 
137  1 toggle public void clickOnCustomize()
138    {
139  1 getDriver().waitUntilElementIsVisible(
140    By.xpath("//label[@class='colorTheme']//a[contains(text(), 'Customize')]"));
141  1 customizeButton.click();
142    }
143   
144    /**
145    * Click on "manage color theme".
146    *
147    * @since 6.3RC1
148    */
 
149  1 toggle public void manageColorThemes()
150    {
151  1 manageColorThemesButton.click();
152    }
153    }