| 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.List; |
| 23 |
|
|
| 24 |
|
import org.openqa.selenium.By; |
| 25 |
|
import org.openqa.selenium.WebElement; |
| 26 |
|
import org.xwiki.extension.ExtensionId; |
| 27 |
|
import org.xwiki.test.ui.po.BaseElement; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
@version |
| 33 |
|
@since |
| 34 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 9 |
Complexity Density: 0.69 |
|
| 35 |
|
public class SearchResultsPane extends BaseElement |
| 36 |
|
{ |
| 37 |
|
|
| 38 |
|
@return |
| 39 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 40 |
6 |
public PaginationFilterPane getPagination()... |
| 41 |
|
{ |
| 42 |
6 |
return getDriver().hasElementWithoutWaiting(By.className("paginationFilter")) ? new PaginationFilterPane() |
| 43 |
|
: null; |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
@return |
| 48 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 49 |
13 |
public int getDisplayedResultsCount()... |
| 50 |
|
{ |
| 51 |
13 |
return getDriver().findElementsWithoutWaiting(By.className("extension-item")).size(); |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
@return |
| 56 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 57 |
7 |
public String getNoResultsMessage()... |
| 58 |
|
{ |
| 59 |
7 |
String xpath = |
| 60 |
|
"//div[contains(@class, 'infomessage') and preceding-sibling::div[1][@class = 'extension-search-bar']]"; |
| 61 |
7 |
List<WebElement> found = getDriver().findElementsWithoutWaiting(By.xpath(xpath)); |
| 62 |
7 |
return found.size() > 0 ? found.get(0).getText() : null; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
@param |
| 69 |
|
@param |
| 70 |
|
@return |
| 71 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 72 |
15 |
public ExtensionPane getExtension(String name, String version)... |
| 73 |
|
{ |
| 74 |
15 |
String nameAndVersion = name + " " + version; |
| 75 |
15 |
By xpath = |
| 76 |
|
By.xpath("//form[contains(@class, 'extension-item') and descendant::*[contains(@class, " |
| 77 |
|
+ "'extension-title') and normalize-space(.) = '" + nameAndVersion + "']]"); |
| 78 |
15 |
List<WebElement> found = getDriver().findElements(xpath); |
| 79 |
15 |
return found.size() == 1 ? new ExtensionPane(found.get(0)) : null; |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
@param |
| 86 |
|
@return |
| 87 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 88 |
15 |
public ExtensionPane getExtension(ExtensionId extensionId)... |
| 89 |
|
{ |
| 90 |
15 |
return getExtension(extensionId.getId(), extensionId.getVersion().getValue()); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
@param |
| 97 |
|
@return |
| 98 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 99 |
25 |
public ExtensionPane getExtension(int index)... |
| 100 |
|
{ |
| 101 |
25 |
int position = index + 1; |
| 102 |
25 |
By xpath = By.xpath("//form[contains(@class, 'extension-item')][" + position + "]"); |
| 103 |
25 |
return new ExtensionPane(getDriver().findElement(xpath)); |
| 104 |
|
} |
| 105 |
|
} |