1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.tag.test.po; |
21 |
|
|
22 |
|
import org.openqa.selenium.By; |
23 |
|
import org.openqa.selenium.WebDriver; |
24 |
|
import org.openqa.selenium.WebElement; |
25 |
|
import org.openqa.selenium.support.FindBy; |
26 |
|
import org.openqa.selenium.support.ui.ExpectedCondition; |
27 |
|
import org.xwiki.test.ui.po.BaseElement; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 5 |
Complexity Density: 0.56 |
|
35 |
|
public class AddTagsPane extends BaseElement |
36 |
|
{ |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
private static final String FORM_CLASS_NAME = "tag-add-form"; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
@FindBy(id = "tag") |
46 |
|
private WebElement tagsInput; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@FindBy(className = FORM_CLASS_NAME) |
52 |
|
private WebElement addTagsForm; |
53 |
|
|
54 |
|
|
55 |
|
@link |
56 |
|
|
57 |
|
private By addButtonLocator = By.xpath("//form[@class = 'tag-add-form']//input[@type = 'submit']"); |
58 |
|
|
59 |
|
|
60 |
|
@param |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
62 |
12 |
public void setTags(String tags)... |
63 |
|
{ |
64 |
12 |
tagsInput.clear(); |
65 |
12 |
tagsInput.sendKeys(tags); |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
@return |
72 |
|
|
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
74 |
11 |
public boolean add()... |
75 |
|
{ |
76 |
|
|
77 |
11 |
getDriver().waitUntilCondition(new ExpectedCondition<Boolean>() |
78 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
11 |
@Override... |
80 |
|
public Boolean apply(WebDriver driver) |
81 |
|
{ |
82 |
11 |
return getDriver().findElements(By.className("xnotification-error")).size() == 0; |
83 |
|
} |
84 |
|
}); |
85 |
|
|
86 |
11 |
addTagsForm.findElement(addButtonLocator).click(); |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
11 |
getDriver().waitUntilCondition(new ExpectedCondition<Boolean>() |
91 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
22 |
@Override... |
93 |
|
public Boolean apply(WebDriver driver) |
94 |
|
{ |
95 |
22 |
return getDriver().findElements(By.className(FORM_CLASS_NAME)).size() == 0 |
96 |
|
|| getDriver().findElements(By.className("xnotification-error")).size() > 0; |
97 |
|
} |
98 |
|
}); |
99 |
|
|
100 |
|
|
101 |
11 |
return getDriver().findElementsWithoutWaiting(By.className(FORM_CLASS_NAME)).size() == 0; |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
2 |
public void cancel()... |
108 |
|
{ |
109 |
2 |
addTagsForm.findElement(By.xpath("//form[@class = 'tag-add-form']//input[@type = 'reset']")).click(); |
110 |
|
} |
111 |
|
} |