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

File NetworkUserProfilePage.java

 

Coverage histogram

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

Code metrics

2
14
4
1
83
42
5
0.36
3.5
4
1.25

Classes

Class Line # Actions
NetworkUserProfilePage 34 14 0% 5 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

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 java.util.ArrayList;
23    import java.util.List;
24   
25    import org.openqa.selenium.By;
26    import org.openqa.selenium.WebElement;
27   
28    /**
29    * Represents the user profile's Network tab.
30    *
31    * @version $Id: 8572d967817bbf929f8b7e5f7548d314acda894d $
32    * @since 7.1M1
33    */
 
34    public class NetworkUserProfilePage extends AbstractUserProfilePage
35    {
36    /**
37    * @param username the user profile document name
38    * @return the network profile tab page object
39    */
 
40  2 toggle 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 username the user profile document name
49    */
 
50  2 toggle public NetworkUserProfilePage(String username)
51    {
52  2 super(username);
53    }
54   
 
55  3 toggle 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    // Remove wrapping parenthesis in which the userID is displayed.
68  1 result.add(rawValue.substring(1, rawValue.length() - 1));
69    }
70    }
71   
72  3 return result;
73    }
74   
 
75  1 toggle 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    }