| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.extension.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.xwiki.test.ui.po.BaseElement; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
@version |
| 33 |
|
@since |
| 34 |
|
|
| |
|
| 84.6% |
Uncovered Elements: 6 (39) |
Complexity: 13 |
Complexity Density: 0.52 |
|
| 35 |
|
public class ExtensionDescriptionPane extends BaseElement |
| 36 |
|
{ |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
private static final String DEFINITION_FOR_TERM_XPATH = ".//dd[preceding-sibling::dt[1][. = '%s']]"; |
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
private final WebElement container; |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
@param |
| 51 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 52 |
2 |
public ExtensionDescriptionPane(WebElement container)... |
| 53 |
|
{ |
| 54 |
2 |
this.container = container; |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
|
| 58 |
|
@return |
| 59 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 60 |
1 |
public String getLicense()... |
| 61 |
|
{ |
| 62 |
1 |
return getMetaData("License"); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
@return |
| 67 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 68 |
1 |
public WebElement getWebSite()... |
| 69 |
|
{ |
| 70 |
1 |
return getMetaDataLink("Website"); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
|
| 74 |
|
@return |
| 75 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 76 |
1 |
public String getId()... |
| 77 |
|
{ |
| 78 |
1 |
return getMetaData("Id"); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
|
| 82 |
|
@return |
| 83 |
|
|
| |
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 84 |
1 |
public List<String> getFeatures()... |
| 85 |
|
{ |
| 86 |
1 |
By xpath = By.xpath(String.format(DEFINITION_FOR_TERM_XPATH, "Feature")); |
| 87 |
1 |
List<WebElement> featureElements = getDriver().findElementsWithoutWaiting(container, xpath); |
| 88 |
1 |
if (featureElements.isEmpty()) { |
| 89 |
0 |
featureElements = getMetaDataList("Features"); |
| 90 |
|
} |
| 91 |
1 |
List<String> features = new ArrayList<>(); |
| 92 |
1 |
for (WebElement element : featureElements) { |
| 93 |
1 |
features.add(element.getText()); |
| 94 |
|
} |
| 95 |
1 |
return features; |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
|
| 99 |
|
@return |
| 100 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 101 |
1 |
public String getType()... |
| 102 |
|
{ |
| 103 |
1 |
return getMetaData("Type"); |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
|
| 107 |
|
@return |
| 108 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 109 |
0 |
public WebElement getSources()... |
| 110 |
|
{ |
| 111 |
0 |
return getMetaDataLink("Sources"); |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
|
| 115 |
|
@return |
| 116 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 117 |
0 |
public WebElement getIssues()... |
| 118 |
|
{ |
| 119 |
0 |
return getMetaDataLink("Issues"); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
|
| 123 |
|
@return |
| 124 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 125 |
1 |
public List<String> getNamespaces()... |
| 126 |
|
{ |
| 127 |
1 |
List<String> namespaces = new ArrayList<>(); |
| 128 |
1 |
for (WebElement element : getMetaDataList("Installed on the following namespaces")) { |
| 129 |
1 |
namespaces.add(element.getText()); |
| 130 |
|
} |
| 131 |
1 |
return namespaces; |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
|
| 135 |
|
@param |
| 136 |
|
@return |
| 137 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 138 |
3 |
private String getMetaData(String label)... |
| 139 |
|
{ |
| 140 |
3 |
By xpath = By.xpath(String.format(DEFINITION_FOR_TERM_XPATH, label)); |
| 141 |
3 |
return getDriver().findElementWithoutWaiting(container, xpath).getText(); |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
|
| 145 |
|
@param |
| 146 |
|
@return |
| 147 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 148 |
1 |
private WebElement getMetaDataLink(String label)... |
| 149 |
|
{ |
| 150 |
1 |
By xpath = By.xpath(String.format(DEFINITION_FOR_TERM_XPATH + "/a", label)); |
| 151 |
1 |
return getDriver().findElementWithoutWaiting(container, xpath); |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
|
| 155 |
|
@param |
| 156 |
|
@return |
| 157 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 158 |
1 |
private List<WebElement> getMetaDataList(String label)... |
| 159 |
|
{ |
| 160 |
1 |
By xpath = By.xpath(String.format(DEFINITION_FOR_TERM_XPATH + "//li", label)); |
| 161 |
1 |
return getDriver().findElementsWithoutWaiting(container, xpath); |
| 162 |
|
} |
| 163 |
|
} |