1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.appwithinminutes.test.po; |
21 |
|
|
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
import org.openqa.selenium.By; |
25 |
|
import org.openqa.selenium.Keys; |
26 |
|
import org.openqa.selenium.WebElement; |
27 |
|
import org.openqa.selenium.interactions.Actions; |
28 |
|
import org.openqa.selenium.support.FindBy; |
29 |
|
import org.openqa.selenium.support.ui.Select; |
30 |
|
import org.xwiki.test.ui.po.ViewPage; |
31 |
|
import org.xwiki.test.ui.po.editor.wysiwyg.EditorElement; |
32 |
|
import org.xwiki.test.ui.po.editor.wysiwyg.RichTextAreaElement; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@version |
39 |
|
@since |
40 |
|
|
|
|
| 94% |
Uncovered Elements: 3 (50) |
Complexity: 16 |
Complexity Density: 0.48 |
|
41 |
|
public class ApplicationHomeEditPage extends ApplicationEditPage |
42 |
|
{ |
43 |
|
@FindBy(id = "availableColumns") |
44 |
|
private WebElement availableColumns; |
45 |
|
|
46 |
|
@FindBy(xpath = "//div[@class = 'columnPicker']/input[@type = 'image' and @alt = 'Add']") |
47 |
|
private WebElement addColumnButton; |
48 |
|
|
49 |
|
@FindBy(id = "applicationIcon") |
50 |
|
private WebElement applicationIconInput; |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
private final EditorElement descriptionEditor = new EditorElement("AppWithinMinutes.LiveTableClass_0_description"); |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@return |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
62 |
0 |
public ApplicationTemplateProviderEditPage clickPreviousStep()... |
63 |
|
{ |
64 |
0 |
previousStepButton.click(); |
65 |
0 |
return new ApplicationTemplateProviderEditPage(); |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
@return |
72 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
73 |
9 |
public ApplicationHomePage clickFinish()... |
74 |
|
{ |
75 |
9 |
nextStepButton.click(); |
76 |
9 |
return new ApplicationHomePage(); |
77 |
|
} |
78 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
7 |
@SuppressWarnings("unchecked")... |
80 |
|
@Override |
81 |
|
protected <T extends ViewPage> T createViewPage() |
82 |
|
{ |
83 |
7 |
return (T) new ApplicationHomePage(); |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
@param |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
91 |
5 |
public void setDescription(String description)... |
92 |
|
{ |
93 |
5 |
descriptionEditor.waitToLoad(); |
94 |
5 |
RichTextAreaElement descriptionTextArea = descriptionEditor.getRichTextArea(); |
95 |
5 |
descriptionTextArea.clear(); |
96 |
5 |
descriptionTextArea.sendKeys(description); |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
@param |
103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
104 |
1 |
public void setIcon(String icon)... |
105 |
|
{ |
106 |
1 |
applicationIconInput.clear(); |
107 |
1 |
applicationIconInput.sendKeys(icon); |
108 |
|
|
109 |
1 |
applicationIconInput.sendKeys(Keys.ESCAPE); |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
@return |
114 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
1 |
public String getIcon()... |
116 |
|
{ |
117 |
1 |
return applicationIconInput.getAttribute("value"); |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
@param |
124 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
125 |
6 |
public void addLiveTableColumn(String columnLabel)... |
126 |
|
{ |
127 |
6 |
Select select = new Select(availableColumns); |
128 |
6 |
select.selectByVisibleText(columnLabel); |
129 |
6 |
addColumnButton.click(); |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
@param |
136 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
137 |
3 |
public void removeLiveTableColumn(String columnLabel)... |
138 |
|
{ |
139 |
3 |
WebElement column = getLiveTableColumn(columnLabel); |
140 |
|
|
141 |
|
|
142 |
3 |
new Actions(getDriver()).moveToElement(column).perform(); |
143 |
3 |
column.findElement(By.className("delete")).click(); |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
@param |
150 |
|
@param |
151 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
152 |
2 |
public void moveLiveTableColumnBefore(String columnToMove, String beforeColumn)... |
153 |
|
{ |
154 |
2 |
new Actions(getDriver()).clickAndHold(getLiveTableColumn(columnToMove)) |
155 |
|
.moveToElement(getLiveTableColumn(beforeColumn), 0, 0).release().perform(); |
156 |
|
} |
157 |
|
|
158 |
|
|
159 |
|
@param |
160 |
|
@return |
161 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
162 |
10 |
private WebElement getLiveTableColumn(String columnLabel)... |
163 |
|
{ |
164 |
10 |
String escapedColumnLabel = columnLabel.replace("\\", "\\\\").replace("'", "\\'"); |
165 |
10 |
String xpath = "//ul[@class = 'hList']/li[starts-with(., '" + escapedColumnLabel + "')]"; |
166 |
10 |
return getDriver().findElementWithoutWaiting(getForm(), By.xpath(xpath)); |
167 |
|
} |
168 |
|
|
169 |
|
|
170 |
|
@param |
171 |
|
@return |
172 |
|
|
173 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
174 |
5 |
public boolean hasLiveTableColumn(String columnLabel)... |
175 |
|
{ |
176 |
5 |
String escapedColumnLabel = columnLabel.replace("\\", "\\\\").replace("'", "\\'"); |
177 |
5 |
String xpath = "//ul[@class = 'hList']/li[starts-with(., '" + escapedColumnLabel + "')]"; |
178 |
5 |
return getDriver().findElementsWithoutWaiting(getForm(), By.xpath(xpath)).size() > 0; |
179 |
|
} |
180 |
|
|
181 |
|
|
182 |
|
@param |
183 |
|
@return |
184 |
|
|
185 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
186 |
3 |
public boolean isLiveTableColumnDeprecated(String columnLabel)... |
187 |
|
{ |
188 |
3 |
return "deprecated".equals(getLiveTableColumn(columnLabel).getAttribute("class")); |
189 |
|
} |
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
@param |
195 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
196 |
2 |
public void removeAllDeprecatedLiveTableColumns(boolean yes)... |
197 |
|
{ |
198 |
2 |
WebElement warningMessage = getDriver().findElementWithoutWaiting(getForm(), By.className("warningmessage")); |
199 |
2 |
getDriver().findElementWithoutWaiting(warningMessage, By.linkText(yes ? "Yes" : "No")).click(); |
200 |
|
} |
201 |
|
|
202 |
|
|
203 |
|
@return |
204 |
|
|
205 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
206 |
5 |
public boolean isDeprecatedLiveTableColumnsWarningDisplayed()... |
207 |
|
{ |
208 |
5 |
List<WebElement> warnings = getDriver().findElementsWithoutWaiting(getForm(), By.className("warningmessage")); |
209 |
5 |
return warnings.size() == 1 && warnings.get(0).isDisplayed(); |
210 |
|
} |
211 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
212 |
16 |
@Override... |
213 |
|
public ApplicationHomeEditPage waitUntilPageIsLoaded() |
214 |
|
{ |
215 |
16 |
descriptionEditor.waitToLoad(); |
216 |
16 |
return this; |
217 |
|
} |
218 |
|
} |