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 org.openqa.selenium.By; |
23 |
|
import org.openqa.selenium.WebElement; |
24 |
|
import org.openqa.selenium.support.FindBy; |
25 |
|
import org.xwiki.test.ui.po.BaseElement; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@version |
31 |
|
@since |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 9 |
Complexity Density: 0.75 |
|
33 |
|
public class PaginationFilterPane extends BaseElement |
34 |
|
{ |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
private static final String NEXT_PAGE_CLASS_NAME = "nextPagination"; |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
private static final String PREVIOUS_PAGE_CLASS_NAME = "prevPagination"; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@FindBy(className = "totalResultsNo") |
49 |
|
private WebElement resultsCount; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@FindBy(className = "currentResultsNo") |
55 |
|
private WebElement currentRange; |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@FindBy(className = "currentPage") |
61 |
|
private WebElement currentPageIndex; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
@FindBy(xpath = "//span[@class = 'pagination']/*[last()]") |
67 |
|
private WebElement lastPageIndex; |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
@FindBy(className = PREVIOUS_PAGE_CLASS_NAME) |
73 |
|
private WebElement previousPageButton; |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
@FindBy(className = NEXT_PAGE_CLASS_NAME) |
79 |
|
private WebElement nextPageButton; |
80 |
|
|
81 |
|
|
82 |
|
@return |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
84 |
5 |
public int getResultsCount()... |
85 |
|
{ |
86 |
5 |
return Integer.parseInt(resultsCount.getText()); |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
|
@return |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
4 |
public String getCurrentRange()... |
93 |
|
{ |
94 |
4 |
return currentRange.getText(); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
@return |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
5 |
public int getCurrentPageIndex()... |
101 |
|
{ |
102 |
5 |
return Integer.parseInt(currentPageIndex.getText()); |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
|
@return |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
4 |
public int getPageCount()... |
109 |
|
{ |
110 |
4 |
return Integer.parseInt(lastPageIndex.getText()); |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
@return |
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
118 |
1 |
public PaginationFilterPane nextPage()... |
119 |
|
{ |
120 |
1 |
nextPageButton.click(); |
121 |
1 |
return new PaginationFilterPane(); |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
@return |
126 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
3 |
public boolean hasNextPage()... |
128 |
|
{ |
129 |
3 |
return getDriver().findElements(By.className(NEXT_PAGE_CLASS_NAME)).size() > 0; |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
@return |
136 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
137 |
1 |
public PaginationFilterPane previousPage()... |
138 |
|
{ |
139 |
1 |
previousPageButton.click(); |
140 |
1 |
return new PaginationFilterPane(); |
141 |
|
} |
142 |
|
|
143 |
|
|
144 |
|
@return |
145 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
146 |
2 |
public boolean hasPreviousPage()... |
147 |
|
{ |
148 |
2 |
return getDriver().findElements(By.className(PREVIOUS_PAGE_CLASS_NAME)).size() > 0; |
149 |
|
} |
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
@param |
155 |
|
@return |
156 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
157 |
2 |
public PaginationFilterPane gotoPage(int index)... |
158 |
|
{ |
159 |
2 |
getDriver().findElement(By.xpath("//span[@class = 'pagination']/a[. = '" + index + "']")).click(); |
160 |
2 |
return new PaginationFilterPane(); |
161 |
|
} |
162 |
|
} |