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 |
|
import org.xwiki.test.ui.po.LiveTableElement; |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@version |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 7 |
Complexity Density: 0.41 |
|
35 |
|
public class WikiIndexPage extends ExtendedViewPage |
36 |
|
{ |
37 |
|
@FindBy(id = "wikis") |
38 |
|
private WebElement wikisTable; |
39 |
|
|
40 |
|
@FindBy(xpath = "//table[@id='wikis']//td[@class='wikiprettyname linkfield typetext']/a\n") |
41 |
|
private List<WebElement> wikiPrettyNames; |
42 |
|
|
43 |
|
@FindBy(id = "tmCreateWiki") |
44 |
|
private WebElement createWikiMenuButton; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
private LiveTableElement liveTable = new LiveTableElement("wikis"); |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
54 |
8 |
public static WikiIndexPage gotoPage()... |
55 |
|
{ |
56 |
8 |
getUtil().gotoPage("WikiManager", "WebHome"); |
57 |
8 |
return new WikiIndexPage(); |
58 |
|
} |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
60 |
5 |
public List<WikiLink> getWikiPrettyNames()... |
61 |
|
{ |
62 |
5 |
List<WikiLink> list = new ArrayList<>(); |
63 |
5 |
for (WebElement prettyName : wikiPrettyNames) { |
64 |
14 |
list.add(new WikiLink(prettyName)); |
65 |
|
} |
66 |
5 |
return list; |
67 |
|
} |
68 |
|
|
69 |
|
|
70 |
|
@since |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
72 |
5 |
public WikiLink getWikiLink(String wikiName)... |
73 |
|
{ |
74 |
5 |
for (WikiLink link : getWikiPrettyNames()) { |
75 |
14 |
if (link.getWikiName().equals(wikiName)) { |
76 |
2 |
return link; |
77 |
|
} |
78 |
|
} |
79 |
|
|
80 |
3 |
return null; |
81 |
|
} |
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
83 |
5 |
@Override... |
84 |
|
public WikiIndexPage waitUntilPageIsLoaded() |
85 |
|
{ |
86 |
5 |
this.liveTable.waitUntilReady(); |
87 |
5 |
return this; |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
|
@since |
92 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
93 |
4 |
public CreateWikiPage createWiki()... |
94 |
|
{ |
95 |
4 |
this.createWikiMenuButton.click(); |
96 |
4 |
return new CreateWikiPage(); |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
@since |
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
102 |
3 |
public DeleteWikiPage deleteWiki(String wikiName)... |
103 |
|
{ |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
3 |
WebElement deleteWikiLink = getDriver().findElement( |
108 |
|
By.xpath(String.format("//a[contains(@class, 'actiondelete') and contains(@href, '%s')]", wikiName))); |
109 |
3 |
deleteWikiLink.click(); |
110 |
3 |
return new DeleteWikiPage(); |
111 |
|
} |
112 |
|
} |