1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.blog.test.po; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import org.apache.commons.codec.binary.StringUtils; |
26 |
|
import org.openqa.selenium.By; |
27 |
|
import org.openqa.selenium.WebElement; |
28 |
|
import org.openqa.selenium.support.FindBy; |
29 |
|
import org.xwiki.test.ui.po.ViewPage; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 5 |
Complexity Density: 0.56 |
|
37 |
|
public class BlogPostViewPage extends ViewPage |
38 |
|
{ |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@FindBy(className = "hentry") |
43 |
|
private WebElement entry; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@FindBy(className = "warningmessage") |
49 |
|
private WebElement warningMessage; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@FindBy(className = "entry-content") |
55 |
|
private WebElement content; |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@FindBy(className = "entry-footer") |
61 |
|
private WebElement footer; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
@FindBy(xpath = "//*[@class = 'blog-entry-toolbox']//a[contains(@title, 'Edit')]") |
66 |
|
private WebElement editIcon; |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
68 |
2 |
@Override... |
69 |
|
public String getContent() |
70 |
|
{ |
71 |
2 |
return content.getText(); |
72 |
|
} |
73 |
|
|
74 |
|
|
75 |
|
@return |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
77 |
2 |
public List<String> getCategories()... |
78 |
|
{ |
79 |
2 |
List<String> categories = new ArrayList<String>(); |
80 |
2 |
for (WebElement categoryLink : footer.findElements(By.xpath("//a[@rel = 'tag']"))) { |
81 |
3 |
categories.add(categoryLink.getText()); |
82 |
|
} |
83 |
2 |
return categories; |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
|
@return |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
2 |
public boolean isPublished()... |
90 |
|
{ |
91 |
2 |
return !getDriver().hasElementWithoutWaiting(entry, By.className("warningmessage")) |
92 |
|
|| !StringUtils.equals("This blog post is not published yet.", warningMessage.getText()); |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
@return |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
1 |
public boolean isHidden()... |
99 |
|
{ |
100 |
1 |
return getDriver().hasElementWithoutWaiting(entry, By.className("warningmessage")) |
101 |
|
&& StringUtils.equals("This blog post is hidden.", warningMessage.getText()); |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
@return |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
109 |
1 |
public BlogPostInlinePage clickEditBlogPostIcon()... |
110 |
|
{ |
111 |
1 |
editIcon.click(); |
112 |
1 |
return new BlogPostInlinePage(); |
113 |
|
} |
114 |
|
} |