1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.user.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 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@version |
32 |
|
@since |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 5 |
Complexity Density: 0.36 |
|
34 |
|
public class NetworkUserProfilePage extends AbstractUserProfilePage |
35 |
|
{ |
36 |
|
|
37 |
|
@param |
38 |
|
@return |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
40 |
2 |
public static NetworkUserProfilePage gotoPage(String username)... |
41 |
|
{ |
42 |
2 |
getUtil().gotoPage("XWiki", username, "view", "category=network"); |
43 |
2 |
NetworkUserProfilePage page = new NetworkUserProfilePage(username); |
44 |
2 |
return page; |
45 |
|
} |
46 |
|
|
47 |
|
|
48 |
|
@param |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
2 |
public NetworkUserProfilePage(String username)... |
51 |
|
{ |
52 |
2 |
super(username); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
55 |
3 |
public List<String> getFollowedUsers()... |
56 |
|
{ |
57 |
3 |
List<String> result = new ArrayList<String>(); |
58 |
|
|
59 |
3 |
boolean empty = |
60 |
|
getDriver().findElementWithoutWaiting(By.cssSelector(".following")).getText() |
61 |
|
.contains("You are not following the activity of any user"); |
62 |
3 |
if (!empty) { |
63 |
1 |
List<WebElement> userElements = |
64 |
|
getDriver().findElementsWithoutWaiting(By.cssSelector("#networkPane .following .user-id")); |
65 |
1 |
for (WebElement userElement : userElements) { |
66 |
1 |
String rawValue = userElement.getText(); |
67 |
|
|
68 |
1 |
result.add(rawValue.substring(1, rawValue.length() - 1)); |
69 |
|
} |
70 |
|
} |
71 |
|
|
72 |
3 |
return result; |
73 |
|
} |
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
75 |
1 |
public void unfollowUser(String username)... |
76 |
|
{ |
77 |
1 |
WebElement unfollowButton = |
78 |
|
getDriver().findElementWithoutWaiting( |
79 |
|
By.xpath(String.format("//li[.//span[@class='user-id' and .='(%s)']]//a[contains(@class,'action')]", |
80 |
|
username))); |
81 |
1 |
unfollowButton.click(); |
82 |
|
} |
83 |
|
} |