| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.test.ui.po; |
| 21 |
|
|
| 22 |
|
import org.openqa.selenium.By; |
| 23 |
|
import org.openqa.selenium.WebElement; |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
@version |
| 29 |
|
@since |
| 30 |
|
|
| |
|
| 91.3% |
Uncovered Elements: 2 (23) |
Complexity: 9 |
Complexity Density: 0.69 |
|
| 31 |
|
public class CommentForm extends BaseElement |
| 32 |
|
{ |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
private By containerLocator; |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
@param |
| 42 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 43 |
13 |
public CommentForm(By containerLocator)... |
| 44 |
|
{ |
| 45 |
13 |
this.containerLocator = containerLocator; |
| 46 |
|
} |
| 47 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 48 |
35 |
private WebElement getContainer()... |
| 49 |
|
{ |
| 50 |
35 |
return getDriver().findElement(this.containerLocator); |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
|
| 54 |
|
@return |
| 55 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 56 |
16 |
public WebElement getContentField()... |
| 57 |
|
{ |
| 58 |
16 |
return getContainer().findElement(By.tagName("textarea")); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
|
@return |
| 65 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 66 |
3 |
public WebElement clickPreview()... |
| 67 |
|
{ |
| 68 |
3 |
getContainer().findElement(By.xpath(".//input[@type = 'button' and @value = 'Preview']")).click(); |
| 69 |
3 |
By previewLocator = By.className("commentPreview"); |
| 70 |
3 |
getDriver().waitUntilElementIsVisible(previewLocator); |
| 71 |
3 |
return getContainer().findElement(previewLocator); |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 77 |
1 |
public void clickBack()... |
| 78 |
|
{ |
| 79 |
1 |
getContainer().findElement(By.xpath(".//input[@type = 'button' and @value = 'Back']")).click(); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 86 |
5 |
public void clickSubmit()... |
| 87 |
|
{ |
| 88 |
5 |
clickSubmit(true); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
|
@param |
| 98 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 99 |
12 |
public void clickSubmit(boolean wait)... |
| 100 |
|
{ |
| 101 |
12 |
getContainer().findElement(By.xpath(".//input[@type = 'submit']")).click(); |
| 102 |
12 |
if (wait) { |
| 103 |
|
|
| 104 |
11 |
waitForNotificationSuccessMessage("Comment posted"); |
| 105 |
|
} |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 111 |
0 |
public void clickCancel()... |
| 112 |
|
{ |
| 113 |
0 |
getContainer().findElement(By.className("cancel")).click(); |
| 114 |
|
} |
| 115 |
|
} |