1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.wiki.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 |
|
|
|
|
| 94.4% |
Uncovered Elements: 2 (36) |
Complexity: 12 |
Complexity Density: 0.55 |
|
29 |
|
public class CreateWikiPage extends ExtendedViewPage |
30 |
|
{ |
31 |
|
@FindBy(name = "wikiprettyname") |
32 |
|
private WebElement prettyNameField; |
33 |
|
|
34 |
|
@FindBy(name = "wikiname") |
35 |
|
private WebElement wikiNameField; |
36 |
|
|
37 |
|
@FindBy(name = "description") |
38 |
|
private WebElement descriptionField; |
39 |
|
|
40 |
|
@FindBy(name = "template") |
41 |
|
private WebElement templateField; |
42 |
|
|
43 |
|
@FindBy(name = "set_as_template") |
44 |
|
private WebElement setAsTemplateField; |
45 |
|
|
46 |
|
@FindBy(id = "wizard-next") |
47 |
|
private WebElement nextStepButton; |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
49 |
3 |
public void setPrettyName(String prettyName)... |
50 |
|
{ |
51 |
3 |
prettyNameField.clear(); |
52 |
3 |
prettyNameField.sendKeys(prettyName); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
55 |
3 |
public String getName()... |
56 |
|
{ |
57 |
3 |
return wikiNameField.getAttribute("value"); |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
|
@since |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
63 |
3 |
public String getComputedName()... |
64 |
|
{ |
65 |
3 |
getDriver().waitUntilElementHasNonEmptyAttributeValue(By.name("wikiname"), "value"); |
66 |
3 |
return getName(); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
69 |
3 |
public void setDescription(String description)... |
70 |
|
{ |
71 |
3 |
descriptionField.clear(); |
72 |
3 |
descriptionField.sendKeys(description); |
73 |
|
} |
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
75 |
3 |
public void setIsTemplate(boolean template)... |
76 |
|
{ |
77 |
3 |
if (template != setAsTemplateField.isSelected()) { |
78 |
1 |
setAsTemplateField.click(); |
79 |
|
} |
80 |
|
} |
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
82 |
2 |
public void setTemplate(String templateId)... |
83 |
|
{ |
84 |
2 |
List<WebElement> elements = templateField.findElements(By.tagName("option")); |
85 |
2 |
for (WebElement element : elements) { |
86 |
4 |
if (element.getAttribute("value").equals(templateId)) { |
87 |
2 |
element.click(); |
88 |
|
} |
89 |
|
} |
90 |
|
} |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
92 |
1 |
public List<String> getTemplateList()... |
93 |
|
{ |
94 |
1 |
List<String> list = new ArrayList<String>(); |
95 |
1 |
List<WebElement> elements = templateField.findElements(By.tagName("option")); |
96 |
1 |
for (WebElement element : elements) { |
97 |
2 |
list.add(element.getAttribute("value")); |
98 |
|
} |
99 |
1 |
return list; |
100 |
|
} |
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
1 |
public boolean isNextStepEnabled()... |
103 |
|
{ |
104 |
1 |
return nextStepButton.isEnabled(); |
105 |
|
} |
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
107 |
3 |
public CreateWikiPageStepUser goUserStep()... |
108 |
|
{ |
109 |
3 |
nextStepButton.click(); |
110 |
3 |
return new CreateWikiPageStepUser().waitUntilPageIsLoaded(); |
111 |
|
} |
112 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
113 |
0 |
public void goNextStep()... |
114 |
|
{ |
115 |
0 |
nextStepButton.click(); |
116 |
|
} |
117 |
|
|
118 |
|
} |