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 org.apache.commons.lang.StringUtils; |
23 |
|
import org.openqa.selenium.By; |
24 |
|
import org.openqa.selenium.WebElement; |
25 |
|
import org.openqa.selenium.support.FindBy; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@version |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (46) |
Complexity: 18 |
Complexity Density: 0.67 |
|
32 |
|
public class ProfileUserProfilePage extends AbstractUserProfilePage |
33 |
|
{ |
34 |
|
@FindBy(xpath = "//div[@class='userInfo']/div[@class='editProfileCategory']/a") |
35 |
|
private WebElement editProfile; |
36 |
|
|
37 |
|
@FindBy(className = "given-name") |
38 |
|
private WebElement userFirstName; |
39 |
|
|
40 |
|
@FindBy(className = "family-name") |
41 |
|
private WebElement userLastName; |
42 |
|
|
43 |
|
@FindBy(className = "org") |
44 |
|
private WebElement userCompany; |
45 |
|
|
46 |
|
@FindBy(className = "note") |
47 |
|
private WebElement userAbout; |
48 |
|
|
49 |
|
@FindBy(className = "email") |
50 |
|
private WebElement userEmail; |
51 |
|
|
52 |
|
@FindBy(className = "tel") |
53 |
|
private WebElement userPhone; |
54 |
|
|
55 |
|
@FindBy(className = "adr") |
56 |
|
private WebElement userAddress; |
57 |
|
|
58 |
|
@FindBy(xpath = "//dd[preceding-sibling::dt[1]/label[. = 'Blog']]//a") |
59 |
|
private WebElement userBlog; |
60 |
|
|
61 |
|
@FindBy(xpath = "//dd[preceding-sibling::dt[1]/label[. = 'Blog Feed']]//a") |
62 |
|
private WebElement userBlogFeed; |
63 |
|
|
64 |
|
@FindBy(xpath = "//div[@id='avatar']//a") |
65 |
|
private WebElement changeAvatar; |
66 |
|
|
67 |
|
@FindBy(xpath = "//div[@id='avatar']//img") |
68 |
|
private WebElement userAvatarImage; |
69 |
|
|
70 |
|
@FindBy(css = ".activity-follow a") |
71 |
|
private WebElement followUnfollowButton; |
72 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
73 |
13 |
public static ProfileUserProfilePage gotoPage(String username)... |
74 |
|
{ |
75 |
13 |
getUtil().gotoPage("XWiki", username); |
76 |
13 |
ProfileUserProfilePage page = new ProfileUserProfilePage(username); |
77 |
13 |
return page; |
78 |
|
} |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
14 |
public ProfileUserProfilePage(String username)... |
81 |
|
{ |
82 |
14 |
super(username); |
83 |
|
} |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
85 |
1 |
public ProfileEditPage editProfile()... |
86 |
|
{ |
87 |
1 |
this.editProfile.click(); |
88 |
1 |
return new ProfileEditPage(); |
89 |
|
} |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
2 |
public String getURL()... |
92 |
|
{ |
93 |
2 |
return getUtil().getURL("XWiki", getUsername()); |
94 |
|
} |
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
1 |
public String getUserFirstName()... |
97 |
|
{ |
98 |
1 |
return this.userFirstName.getText(); |
99 |
|
} |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
1 |
public String getUserLastName()... |
102 |
|
{ |
103 |
1 |
return this.userLastName.getText(); |
104 |
|
} |
105 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
1 |
public String getUserCompany()... |
107 |
|
{ |
108 |
1 |
return this.userCompany.getText(); |
109 |
|
} |
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
111 |
1 |
public String getUserAbout()... |
112 |
|
{ |
113 |
|
|
114 |
1 |
return this.userAbout.getText(); |
115 |
|
} |
116 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
117 |
1 |
public String getUserEmail()... |
118 |
|
{ |
119 |
1 |
return this.userEmail.getText(); |
120 |
|
} |
121 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
1 |
public String getUserPhone()... |
123 |
|
{ |
124 |
1 |
return this.userPhone.getText(); |
125 |
|
} |
126 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
1 |
public String getUserAddress()... |
128 |
|
{ |
129 |
1 |
return this.userAddress.getText(); |
130 |
|
} |
131 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
1 |
public String getUserBlog()... |
133 |
|
{ |
134 |
1 |
return this.userBlog.getText(); |
135 |
|
} |
136 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
137 |
1 |
public String getUserBlogFeed()... |
138 |
|
{ |
139 |
1 |
return this.userBlogFeed.getText(); |
140 |
|
} |
141 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
142 |
1 |
public ChangeAvatarPage changeAvatarImage()... |
143 |
|
{ |
144 |
1 |
this.changeAvatar.click(); |
145 |
1 |
getDriver().waitUntilElementIsVisible(By.id("uploadAttachment")); |
146 |
1 |
return new ChangeAvatarPage(); |
147 |
|
} |
148 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
149 |
1 |
public String getAvatarImageName()... |
150 |
|
{ |
151 |
1 |
return StringUtils.substringBefore( |
152 |
|
StringUtils.substringAfterLast(this.userAvatarImage.getAttribute("src"), "/"), "?"); |
153 |
|
} |
154 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
155 |
2 |
public boolean isFollowed()... |
156 |
|
{ |
157 |
2 |
String[] classNames = followUnfollowButton.getAttribute("class").split(" "); |
158 |
2 |
for (String className : classNames) { |
159 |
4 |
if ("unfollow".equals(className)) { |
160 |
1 |
return true; |
161 |
|
} |
162 |
|
} |
163 |
|
|
164 |
1 |
return false; |
165 |
|
} |
166 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
167 |
1 |
public ProfileUserProfilePage toggleFollowButton()... |
168 |
|
{ |
169 |
1 |
this.followUnfollowButton.click(); |
170 |
1 |
return new ProfileUserProfilePage(this.getUsername()); |
171 |
|
} |
172 |
|
} |