1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
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 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 52.4% |
Uncovered Elements: 20 (42) |
Complexity: 13 |
Complexity Density: 0.48 |
|
35 |
|
public class PresentationAdministrationSectionPage extends AdministrationSectionPage |
36 |
|
{ |
37 |
|
|
38 |
|
|
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 |
|
|
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
2 |
public PresentationAdministrationSectionPage()... |
53 |
|
{ |
54 |
2 |
super("Presentation"); |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
2 |
private List<WebElement> getColorThemeOptions()... |
58 |
|
{ |
59 |
2 |
return iconThemeInput.findElements(By.tagName("option")); |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0 |
private List<WebElement> getColibriThemeOptions()... |
63 |
|
{ |
64 |
0 |
return iconThemeInput.findElements(By.xpath("//optgroup[@label='Colibri Themes']//option")); |
65 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
0 |
private List<WebElement> getFlamingoThemeOptions()... |
67 |
|
{ |
68 |
0 |
return iconThemeInput.findElements(By.xpath("//optgroup[@label='Flamingo Themes']//option")); |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
@return |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
74 |
0 |
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 |
|
|
85 |
|
@param |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
87 |
1 |
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 |
99 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
100 |
1 |
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 |
112 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
113 |
0 |
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 |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
125 |
0 |
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 |
|
|
136 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
137 |
1 |
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 |
|
|
146 |
|
|
147 |
|
@since |
148 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
149 |
1 |
public void manageColorThemes()... |
150 |
|
{ |
151 |
1 |
manageColorThemesButton.click(); |
152 |
|
} |
153 |
|
} |