1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.user.test.po

File ProfileUserProfilePage.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

2
27
17
1
172
115
18
0.67
1.59
17
1.06

Classes

Class Line # Actions
ProfileUserProfilePage 32 27 0% 18 0
1.0100%
 

Contributing tests

This file is covered by 6 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
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    * Represents the User Profile Profile Tab.
29    *
30    * @version $Id: 0525e55313c53cda8578f9c8f8ef49317447937b $
31    */
 
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   
 
73  13 toggle 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   
 
80  14 toggle public ProfileUserProfilePage(String username)
81    {
82  14 super(username);
83    }
84   
 
85  1 toggle public ProfileEditPage editProfile()
86    {
87  1 this.editProfile.click();
88  1 return new ProfileEditPage();
89    }
90   
 
91  2 toggle public String getURL()
92    {
93  2 return getUtil().getURL("XWiki", getUsername());
94    }
95   
 
96  1 toggle public String getUserFirstName()
97    {
98  1 return this.userFirstName.getText();
99    }
100   
 
101  1 toggle public String getUserLastName()
102    {
103  1 return this.userLastName.getText();
104    }
105   
 
106  1 toggle public String getUserCompany()
107    {
108  1 return this.userCompany.getText();
109    }
110   
 
111  1 toggle public String getUserAbout()
112    {
113   
114  1 return this.userAbout.getText();
115    }
116   
 
117  1 toggle public String getUserEmail()
118    {
119  1 return this.userEmail.getText();
120    }
121   
 
122  1 toggle public String getUserPhone()
123    {
124  1 return this.userPhone.getText();
125    }
126   
 
127  1 toggle public String getUserAddress()
128    {
129  1 return this.userAddress.getText();
130    }
131   
 
132  1 toggle public String getUserBlog()
133    {
134  1 return this.userBlog.getText();
135    }
136   
 
137  1 toggle public String getUserBlogFeed()
138    {
139  1 return this.userBlogFeed.getText();
140    }
141   
 
142  1 toggle public ChangeAvatarPage changeAvatarImage()
143    {
144  1 this.changeAvatar.click();
145  1 getDriver().waitUntilElementIsVisible(By.id("uploadAttachment"));
146  1 return new ChangeAvatarPage();
147    }
148   
 
149  1 toggle public String getAvatarImageName()
150    {
151  1 return StringUtils.substringBefore(
152    StringUtils.substringAfterLast(this.userAvatarImage.getAttribute("src"), "/"), "?");
153    }
154   
 
155  2 toggle 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   
 
167  1 toggle public ProfileUserProfilePage toggleFollowButton()
168    {
169  1 this.followUnfollowButton.click();
170  1 return new ProfileUserProfilePage(this.getUsername());
171    }
172    }