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 java.util.List; |
23 |
|
|
24 |
|
import org.openqa.selenium.By; |
25 |
|
import org.openqa.selenium.WebDriver; |
26 |
|
import org.openqa.selenium.WebElement; |
27 |
|
import org.openqa.selenium.support.FindBy; |
28 |
|
import org.openqa.selenium.support.ui.ExpectedCondition; |
29 |
|
import org.xwiki.test.ui.po.DocumentPicker; |
30 |
|
import org.xwiki.test.ui.po.ViewPage; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 91.7% |
Uncovered Elements: 2 (24) |
Complexity: 10 |
Complexity Density: 0.71 |
|
38 |
|
public class ApplicationCreatePage extends ViewPage |
39 |
|
{ |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
private DocumentPicker locationPicker = new DocumentPicker(); |
44 |
|
|
45 |
|
@FindBy(id = "wizard-next") |
46 |
|
private WebElement nextStepButton; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@return |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
53 |
6 |
public static ApplicationCreatePage gotoPage()... |
54 |
|
{ |
55 |
6 |
getUtil().gotoPage("AppWithinMinutes", "CreateApplication"); |
56 |
6 |
return new ApplicationCreatePage(); |
57 |
|
} |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
@param |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
14 |
public void setApplicationName(String appName)... |
65 |
|
{ |
66 |
14 |
this.locationPicker.setTitle(appName); |
67 |
|
} |
68 |
|
|
69 |
|
|
70 |
|
@return |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
5 |
public WebElement getApplicationNameInput()... |
73 |
|
{ |
74 |
5 |
return this.locationPicker.getTitleInput(); |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
80 |
14 |
public void waitForApplicationNamePreview()... |
81 |
|
{ |
82 |
14 |
final String appName = this.locationPicker.getTitle(); |
83 |
14 |
getDriver().waitUntilCondition(new ExpectedCondition<Boolean>() |
84 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
85 |
28 |
@Override... |
86 |
|
public Boolean apply(WebDriver driver) |
87 |
|
{ |
88 |
28 |
List<WebElement> previews = driver.findElements(By.className("appName-preview")); |
89 |
28 |
return previews.size() == 1 && previews.get(0).getText().contains(appName); |
90 |
|
} |
91 |
|
}); |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
97 |
3 |
public void waitForApplicationNameError()... |
98 |
|
{ |
99 |
3 |
getDriver().waitUntilElementIsVisible(By.cssSelector("#appTitle.xErrorField")); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
@param |
106 |
|
@since |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
0 |
public void setLocation(String location)... |
109 |
|
{ |
110 |
0 |
this.locationPicker.setParent(location); |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
@return |
115 |
|
@since |
116 |
|
@since |
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
2 |
public DocumentPicker getLocationPicker()... |
119 |
|
{ |
120 |
2 |
return this.locationPicker; |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
@return |
127 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
128 |
11 |
public ApplicationClassEditPage clickNextStep()... |
129 |
|
{ |
130 |
11 |
clickNextStepButton(); |
131 |
11 |
return new ApplicationClassEditPage(); |
132 |
|
} |
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
@link |
138 |
|
|
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
140 |
13 |
public void clickNextStepButton()... |
141 |
|
{ |
142 |
13 |
nextStepButton.click(); |
143 |
|
} |
144 |
|
} |