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.ArrayList; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import org.apache.commons.lang3.StringUtils; |
26 |
|
import org.openqa.selenium.By; |
27 |
|
import org.openqa.selenium.WebElement; |
28 |
|
import org.xwiki.test.ui.po.FormElement; |
29 |
|
import org.xwiki.test.ui.po.InlinePage; |
30 |
|
import org.xwiki.test.ui.po.editor.wysiwyg.EditorElement; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 5 |
Complexity Density: 0.5 |
|
38 |
|
public class EntryEditPage extends InlinePage |
39 |
|
{ |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
private static final String LABEL_XPATH_FORMAT = "//label[substring(@for, string-length(@for) - %s - 2) = '_0_%s']"; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@param |
55 |
|
@return |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
57 |
2 |
public String getLabel(String fieldName)... |
58 |
|
{ |
59 |
2 |
String xpath = String.format(LABEL_XPATH_FORMAT, fieldName.length(), fieldName); |
60 |
2 |
WebElement label = getForm().findElement(By.xpath(xpath)); |
61 |
2 |
return label.getText(); |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
@return |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
67 |
3 |
public List<String> getFieldNames()... |
68 |
|
{ |
69 |
3 |
List<String> fieldNames = new ArrayList<String>(); |
70 |
3 |
for (WebElement field : getForm().findElements(By.xpath("//*[contains(@name, '_0_')]"))) { |
71 |
5 |
fieldNames.add(StringUtils.substringAfter(field.getAttribute("name"), "_0_")); |
72 |
|
} |
73 |
3 |
return fieldNames; |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
3 |
public void setTitle(String title)... |
82 |
|
{ |
83 |
3 |
new FormElement(getForm()).setFieldValue(By.name("title"), title); |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
|
@return |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
1 |
public String getTitle()... |
90 |
|
{ |
91 |
1 |
return getForm().findElement(By.name("title")).getAttribute("value"); |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
|
@return |
96 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
97 |
1 |
public EditorElement getContentEditor()... |
98 |
|
{ |
99 |
1 |
return new EditorElement("content"); |
100 |
|
} |
101 |
|
} |