| 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.editor; |
| 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.FormElement; |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
@version |
| 31 |
|
@since |
| 32 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (34) |
Complexity: 11 |
Complexity Density: 0.5 |
|
| 33 |
|
public class ClassEditPage extends EditPage |
| 34 |
|
{ |
| 35 |
|
@FindBy(name = "action_propupdate") |
| 36 |
|
private WebElement saveandview; |
| 37 |
|
|
| 38 |
|
@FindBy(id = "propupdate") |
| 39 |
|
private WebElement propertyForm; |
| 40 |
|
|
| 41 |
|
@FindBy(id = "propname") |
| 42 |
|
private WebElement propertyNameField; |
| 43 |
|
|
| 44 |
|
@FindBy(id = "proptype") |
| 45 |
|
private WebElement propertyTypeField; |
| 46 |
|
|
| 47 |
|
@FindBy(name = "action_propadd") |
| 48 |
|
private WebElement propertySubmit; |
| 49 |
|
|
| 50 |
|
private FormElement form; |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 55 |
9 |
public static ClassEditPage gotoPage(String space, String page)... |
| 56 |
|
{ |
| 57 |
9 |
getUtil().gotoPage(space, page, "edit", "editor=class"); |
| 58 |
9 |
return new ClassEditPage(); |
| 59 |
|
} |
| 60 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 61 |
12 |
public ClassPropertyEditPane addProperty(String propertyName, String propertyType)... |
| 62 |
|
{ |
| 63 |
12 |
addPropertyWithoutWaiting(propertyName, propertyType); |
| 64 |
|
|
| 65 |
|
|
| 66 |
12 |
return getPropertyEditPane(propertyName); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
|
| 70 |
|
@since |
| 71 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 72 |
13 |
public void addPropertyWithoutWaiting(String propertyName, String propertyType)... |
| 73 |
|
{ |
| 74 |
13 |
getForm().setFieldValue(this.propertyNameField, propertyName); |
| 75 |
13 |
getForm().setFieldValue(this.propertyTypeField, propertyType); |
| 76 |
13 |
this.propertySubmit.click(); |
| 77 |
|
} |
| 78 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 79 |
2 |
public void deleteProperty(String propertyName)... |
| 80 |
|
{ |
| 81 |
2 |
final By propertyLocator = By.id("xproperty_" + propertyName); |
| 82 |
2 |
final WebElement propertyContainer = getDriver().findElement(propertyLocator); |
| 83 |
2 |
WebElement deleteLink = propertyContainer.findElement(By.className("delete")); |
| 84 |
2 |
deleteLink.click(); |
| 85 |
|
|
| 86 |
|
|
| 87 |
2 |
getDriver().waitUntilElementIsVisible(By.className("xdialog-box-confirmation")); |
| 88 |
2 |
getDriver().findElement(By.cssSelector(".xdialog-box-confirmation input[value='Yes']")).click(); |
| 89 |
2 |
getDriver().waitUntilElementDisappears(propertyLocator); |
| 90 |
|
} |
| 91 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 92 |
49 |
private FormElement getForm()... |
| 93 |
|
{ |
| 94 |
49 |
if (this.form == null) { |
| 95 |
17 |
this.form = new FormElement(this.propertyForm); |
| 96 |
|
} |
| 97 |
49 |
return this.form; |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
|
@param |
| 105 |
|
@return |
| 106 |
|
@since |
| 107 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 108 |
12 |
public ClassPropertyEditPane getPropertyEditPane(String propertyName)... |
| 109 |
|
{ |
| 110 |
12 |
return new ClassPropertyEditPane(getForm(), propertyName).expand(); |
| 111 |
|
} |
| 112 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 113 |
2 |
public DatabaseListClassEditElement getDatabaseListClassEditElement(String propertyName)... |
| 114 |
|
{ |
| 115 |
2 |
return (DatabaseListClassEditElement) new DatabaseListClassEditElement(getForm(), propertyName).expand(); |
| 116 |
|
} |
| 117 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 118 |
5 |
public StaticListClassEditElement getStaticListClassEditElement(String propertyName)... |
| 119 |
|
{ |
| 120 |
5 |
return (StaticListClassEditElement) new StaticListClassEditElement(getForm(), propertyName).expand(); |
| 121 |
|
} |
| 122 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 123 |
4 |
public NumberClassEditElement getNumberClassEditElement(String propertyName)... |
| 124 |
|
{ |
| 125 |
4 |
return (NumberClassEditElement) new NumberClassEditElement(getForm(), propertyName).expand(); |
| 126 |
|
} |
| 127 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 128 |
15 |
@Override... |
| 129 |
|
public WebElement getSaveAndViewButton() |
| 130 |
|
{ |
| 131 |
15 |
return saveandview; |
| 132 |
|
} |
| 133 |
|
} |