1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.flamingo.test.ui; |
21 |
|
|
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
import org.junit.Rule; |
25 |
|
import org.junit.Test; |
26 |
|
import org.xwiki.administration.test.po.AdministrationPage; |
27 |
|
import org.xwiki.administration.test.po.PresentationAdministrationSectionPage; |
28 |
|
import org.xwiki.flamingo.test.po.EditThemePage; |
29 |
|
import org.xwiki.flamingo.test.po.PreviewBox; |
30 |
|
import org.xwiki.flamingo.test.po.ThemeApplicationWebHomePage; |
31 |
|
import org.xwiki.flamingo.test.po.ViewThemePage; |
32 |
|
import org.xwiki.test.ui.AbstractTest; |
33 |
|
import org.xwiki.test.ui.SuperAdminAuthenticationRule; |
34 |
|
import org.xwiki.test.ui.po.ConfirmationPage; |
35 |
|
|
36 |
|
import static org.junit.Assert.assertEquals; |
37 |
|
import static org.junit.Assert.assertFalse; |
38 |
|
import static org.junit.Assert.assertTrue; |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
@version |
44 |
|
@since |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (78) |
Complexity: 5 |
Complexity Density: 0.07 |
|
46 |
|
public class FlamingoThemeTest extends AbstractTest |
47 |
|
{ |
48 |
|
@Rule |
49 |
|
public SuperAdminAuthenticationRule superAdminAuthenticationRule = new SuperAdminAuthenticationRule(getUtil()); |
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
50 |
1 |
@Test... |
51 |
|
public void editFlamingoTheme() throws Exception |
52 |
|
{ |
53 |
|
|
54 |
1 |
AdministrationPage administrationPage = AdministrationPage.gotoPage(); |
55 |
1 |
PresentationAdministrationSectionPage presentationAdministrationSectionPage = |
56 |
|
administrationPage.clickPresentationSection(); |
57 |
|
|
58 |
|
|
59 |
1 |
presentationAdministrationSectionPage.setColorTheme("Charcoal"); |
60 |
1 |
assertEquals("Charcoal", presentationAdministrationSectionPage.getCurrentColorTheme()); |
61 |
|
|
62 |
|
|
63 |
1 |
presentationAdministrationSectionPage.clickOnCustomize(); |
64 |
1 |
EditThemePage editThemePage = new EditThemePage(); |
65 |
|
|
66 |
|
|
67 |
1 |
assertTrue(editThemePage.isPreviewBoxLoading()); |
68 |
1 |
editThemePage.waitUntilPreviewIsLoaded(); |
69 |
|
|
70 |
|
|
71 |
1 |
editThemePage.setAutoRefresh(false); |
72 |
|
|
73 |
1 |
verifyAllVariablesCategoriesArePresent(editThemePage); |
74 |
1 |
verifyVariablesCategoriesDoesNotDisappear(editThemePage); |
75 |
1 |
verifyThatPreviewWorks(editThemePage); |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
} |
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
|
82 |
1 |
private void verifyAllVariablesCategoriesArePresent(EditThemePage editThemePage) throws Exception... |
83 |
|
{ |
84 |
1 |
List<String> categories = editThemePage.getVariableCategories(); |
85 |
1 |
assertEquals(11, categories.size()); |
86 |
1 |
assertTrue(categories.contains("Logos")); |
87 |
1 |
assertTrue(categories.contains("Base colors")); |
88 |
1 |
assertTrue(categories.contains("Typography")); |
89 |
1 |
assertTrue(categories.contains("Tables")); |
90 |
1 |
assertTrue(categories.contains("Buttons")); |
91 |
1 |
assertTrue(categories.contains("Navigation Bar")); |
92 |
1 |
assertTrue(categories.contains("Drop downs")); |
93 |
1 |
assertTrue(categories.contains("Forms")); |
94 |
1 |
assertTrue(categories.contains("Panels")); |
95 |
1 |
assertTrue(categories.contains("Breadcrumb")); |
96 |
1 |
assertTrue(categories.contains("Advanced")); |
97 |
|
} |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
99 |
1 |
private void verifyVariablesCategoriesDoesNotDisappear(EditThemePage editThemePage) throws Exception... |
100 |
|
{ |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
1 |
assertEquals(11, editThemePage.getVariableCategories().size()); |
105 |
|
|
106 |
1 |
editThemePage.selectVariableCategory("Base colors"); |
107 |
1 |
editThemePage.selectVariableCategory("Typography"); |
108 |
|
|
109 |
1 |
assertEquals(11, editThemePage.getVariableCategories().size()); |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
@since |
114 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
|
115 |
1 |
private void verifyThatPreviewWorks(EditThemePage editThemePage) throws Exception... |
116 |
|
{ |
117 |
|
|
118 |
1 |
PreviewBox previewBox = editThemePage.getPreviewBox(); |
119 |
1 |
assertFalse(previewBox.hasError()); |
120 |
|
|
121 |
1 |
editThemePage.selectVariableCategory("Base colors"); |
122 |
1 |
editThemePage.setVariableValue("xwiki-page-content-bg", "#ff0000"); |
123 |
|
|
124 |
1 |
editThemePage.selectVariableCategory("Typography"); |
125 |
1 |
editThemePage.setVariableValue("font-family-base", "Monospace"); |
126 |
|
|
127 |
1 |
editThemePage.selectVariableCategory("Advanced"); |
128 |
1 |
editThemePage.setTextareaValue("lessCode", ".main{ color: #0000ff; }"); |
129 |
|
|
130 |
1 |
editThemePage.refreshPreview(); |
131 |
|
|
132 |
1 |
assertFalse(previewBox.hasError()); |
133 |
|
|
134 |
1 |
assertEquals("rgba(255, 0, 0, 1)", previewBox.getPageBackgroundColor()); |
135 |
1 |
assertEquals("monospace", previewBox.getFontFamily()); |
136 |
|
|
137 |
1 |
assertEquals("rgba(0, 0, 255, 1)", previewBox.getTextColor()); |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
|
@since |
142 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (31) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
143 |
1 |
@Test... |
144 |
|
public void createNewTheme() throws Exception |
145 |
|
{ |
146 |
|
|
147 |
1 |
AdministrationPage administrationPage = AdministrationPage.gotoPage(); |
148 |
1 |
PresentationAdministrationSectionPage presentationAdministrationSectionPage = |
149 |
|
administrationPage.clickPresentationSection(); |
150 |
|
|
151 |
|
|
152 |
1 |
presentationAdministrationSectionPage.manageColorThemes(); |
153 |
1 |
ThemeApplicationWebHomePage themeApplicationWebHomePage = new ThemeApplicationWebHomePage(); |
154 |
|
|
155 |
|
|
156 |
1 |
assertEquals("Charcoal", themeApplicationWebHomePage.getCurrentTheme()); |
157 |
|
|
158 |
1 |
List<String> otherThemes = themeApplicationWebHomePage.getOtherThemes(); |
159 |
1 |
assertTrue(otherThemes.contains("Marina")); |
160 |
1 |
assertTrue(otherThemes.contains("Garden")); |
161 |
1 |
assertTrue(otherThemes.contains("Kitty")); |
162 |
1 |
assertFalse(otherThemes.contains("Charcoal")); |
163 |
|
|
164 |
|
|
165 |
1 |
EditThemePage editThemePage = themeApplicationWebHomePage.createNewTheme("Test"); |
166 |
1 |
editThemePage.waitUntilPreviewIsLoaded(); |
167 |
|
|
168 |
|
|
169 |
|
|
170 |
1 |
editThemePage.setAutoRefresh(false); |
171 |
|
|
172 |
|
|
173 |
1 |
editThemePage.selectVariableCategory("Base colors"); |
174 |
1 |
editThemePage.setVariableValue("xwiki-page-content-bg", "#ff0000"); |
175 |
1 |
editThemePage.selectVariableCategory("Typography"); |
176 |
1 |
editThemePage.setVariableValue("font-family-base", "Monospace"); |
177 |
1 |
editThemePage.selectVariableCategory("Advanced"); |
178 |
|
|
179 |
1 |
editThemePage.setTextareaValue("lessCode", ".main{ color: #0000ff; }"); |
180 |
|
|
181 |
1 |
editThemePage.clickSaveAndView(); |
182 |
|
|
183 |
|
|
184 |
1 |
themeApplicationWebHomePage = ThemeApplicationWebHomePage.gotoPage(); |
185 |
|
|
186 |
1 |
themeApplicationWebHomePage.useTheme("Test"); |
187 |
|
|
188 |
1 |
assertEquals("Test", themeApplicationWebHomePage.getCurrentTheme()); |
189 |
|
|
190 |
1 |
assertEquals("rgba(255, 0, 0, 1)", themeApplicationWebHomePage.getPageBackgroundColor()); |
191 |
1 |
assertEquals("monospace", themeApplicationWebHomePage.getFontFamily().toLowerCase()); |
192 |
|
|
193 |
1 |
assertEquals("rgba(0, 0, 255, 1)", themeApplicationWebHomePage.getTextColor()); |
194 |
|
|
195 |
|
|
196 |
1 |
themeApplicationWebHomePage.useTheme("Charcoal"); |
197 |
|
|
198 |
|
|
199 |
1 |
ViewThemePage themePage = themeApplicationWebHomePage.seeTheme("Test"); |
200 |
1 |
themePage.waitUntilPreviewIsLoaded(); |
201 |
1 |
ConfirmationPage confirmationPage = themePage.delete(); |
202 |
1 |
confirmationPage.confirmDeletePage().waitUntilIsTerminated(); |
203 |
|
} |
204 |
|
|
205 |
|
} |