1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.appwithinminutes.test.po; |
21 |
|
|
22 |
|
import org.openqa.selenium.By; |
23 |
|
import org.openqa.selenium.Keys; |
24 |
|
import org.openqa.selenium.NotFoundException; |
25 |
|
import org.openqa.selenium.StaleElementReferenceException; |
26 |
|
import org.openqa.selenium.WebDriver; |
27 |
|
import org.openqa.selenium.WebElement; |
28 |
|
import org.openqa.selenium.interactions.Actions; |
29 |
|
import org.openqa.selenium.support.FindBy; |
30 |
|
import org.openqa.selenium.support.ui.ExpectedCondition; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 89.3% |
Uncovered Elements: 3 (28) |
Complexity: 10 |
Complexity Density: 0.53 |
|
39 |
|
public class ApplicationClassEditPage extends ApplicationEditPage |
40 |
|
{ |
41 |
|
@FindBy(id = "palette") |
42 |
|
private WebElement palette; |
43 |
|
|
44 |
|
@FindBy(id = "fields") |
45 |
|
private WebElement fields; |
46 |
|
|
47 |
|
@FindBy(id = "canvas") |
48 |
|
private WebElement fieldsCanvas; |
49 |
|
|
50 |
|
@FindBy(id = "updateClassSheet") |
51 |
|
private WebElement updateClassSheetCheckbox; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@return |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
58 |
11 |
public ApplicationTemplateProviderEditPage clickNextStep()... |
59 |
|
{ |
60 |
11 |
nextStepButton.click(); |
61 |
11 |
return new ApplicationTemplateProviderEditPage(); |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
@return |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
69 |
1 |
public ApplicationCreatePage clickPreviousStep()... |
70 |
|
{ |
71 |
1 |
previousStepButton.click(); |
72 |
1 |
return new ApplicationCreatePage(); |
73 |
|
} |
74 |
|
|
75 |
|
|
76 |
|
@return |
77 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
1 |
public boolean hasPreviousStep()... |
79 |
|
{ |
80 |
1 |
return getDriver().findElementsWithoutWaiting(By.linkText("Previous Step")).size() > 0; |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
@param |
87 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
88 |
42 |
public ClassFieldEditPane addField(String fieldType)... |
89 |
|
{ |
90 |
42 |
String fieldXPath = "//span[@class = 'field' and normalize-space(.) = '%s']"; |
91 |
42 |
WebElement field = palette.findElement(By.xpath(String.format(fieldXPath, fieldType))); |
92 |
|
|
93 |
|
|
94 |
42 |
palette.sendKeys(Keys.HOME); |
95 |
42 |
new Actions(getDriver()).dragAndDrop(field, fieldsCanvas).perform(); |
96 |
42 |
final WebElement addedField = fieldsCanvas.findElement(By.xpath("./ul[@id='fields']/li[last()]")); |
97 |
|
|
98 |
42 |
getDriver().waitUntilCondition(new ExpectedCondition<Boolean>() |
99 |
|
{ |
|
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 3 |
Complexity Density: 0.75 |
|
100 |
81 |
@Override... |
101 |
|
public Boolean apply(WebDriver driver) |
102 |
|
{ |
103 |
81 |
try { |
104 |
81 |
return !addedField.getAttribute("class").contains("loading"); |
105 |
|
} catch (NotFoundException e) { |
106 |
0 |
return false; |
107 |
|
} catch (StaleElementReferenceException e) { |
108 |
|
|
109 |
0 |
return false; |
110 |
|
} |
111 |
|
} |
112 |
|
}); |
113 |
|
|
114 |
42 |
return new ClassFieldEditPane(addedField.getAttribute("id").substring("field-".length())); |
115 |
|
} |
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
@param |
121 |
|
@param |
122 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
1 |
public void moveFieldBefore(String fieldToMove, String beforeField)... |
124 |
|
{ |
125 |
1 |
new ClassFieldEditPane(fieldToMove).dragTo(fieldsCanvas.findElement(By.id("field-" + beforeField)), 0, 0); |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
@param |
132 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
133 |
1 |
public void setUpdateClassSheet(boolean update)... |
134 |
|
{ |
135 |
1 |
if (updateClassSheetCheckbox.isSelected() != update) { |
136 |
1 |
updateClassSheetCheckbox.click(); |
137 |
|
} |
138 |
|
} |
139 |
|
} |