1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.scheduler.test.po; |
21 |
|
|
22 |
|
import org.openqa.selenium.By; |
23 |
|
import org.openqa.selenium.WebElement; |
24 |
|
import org.openqa.selenium.support.FindBy; |
25 |
|
import org.xwiki.scheduler.test.po.editor.SchedulerEditPage; |
26 |
|
import org.xwiki.test.ui.po.ConfirmationPage; |
27 |
|
import org.xwiki.test.ui.po.ViewPage; |
28 |
|
|
|
|
| 94.4% |
Uncovered Elements: 2 (36) |
Complexity: 15 |
Complexity Density: 0.71 |
|
29 |
|
public class SchedulerHomePage extends ViewPage |
30 |
|
{ |
31 |
|
@FindBy(xpath = "//form[@id='newdoc']//input[@type='submit' and @value='Add']") |
32 |
|
private WebElement addButton; |
33 |
|
|
34 |
|
@FindBy(id = "page") |
35 |
|
private WebElement nameInput; |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
37 |
2 |
public static SchedulerHomePage gotoPage()... |
38 |
|
{ |
39 |
2 |
getUtil().gotoPage("Scheduler", "WebHome", "view"); |
40 |
2 |
return new SchedulerHomePage(); |
41 |
|
} |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
1 |
public String getURL()... |
44 |
|
{ |
45 |
1 |
return getUtil().getURL("Scheduler", "WebHome"); |
46 |
|
} |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
48 |
1 |
public void setJobName(String jobName)... |
49 |
|
{ |
50 |
1 |
this.nameInput.clear(); |
51 |
1 |
this.nameInput.sendKeys(jobName); |
52 |
|
} |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
54 |
1 |
public SchedulerPage clickJobActionView(String jobName)... |
55 |
|
{ |
56 |
1 |
clickAction(jobName, "View"); |
57 |
1 |
return new SchedulerPage(); |
58 |
|
} |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
60 |
1 |
public SchedulerEditPage clickJobActionEdit(String jobName)... |
61 |
|
{ |
62 |
1 |
clickAction(jobName, "Edit"); |
63 |
1 |
return new SchedulerEditPage(); |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
66 |
1 |
public ConfirmationPage clickJobActionDelete(String jobName)... |
67 |
|
{ |
68 |
1 |
clickAction(jobName, "Delete"); |
69 |
1 |
return new ConfirmationPage(); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
1 |
public void clickJobActionSchedule(String jobName)... |
73 |
|
{ |
74 |
1 |
clickAction(jobName, "Schedule"); |
75 |
|
} |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
2 |
public void clickJobActionTrigger(String jobName)... |
78 |
|
{ |
79 |
2 |
clickAction(jobName, "Trigger"); |
80 |
|
} |
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
1 |
public void clickJobActionPause(String jobName)... |
83 |
|
{ |
84 |
1 |
clickAction(jobName, "Pause"); |
85 |
|
} |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
1 |
public void clickJobActionResume(String jobName)... |
88 |
|
{ |
89 |
1 |
clickAction(jobName, "Resume"); |
90 |
|
} |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
1 |
public void clickJobActionUnschedule(String jobName)... |
93 |
|
{ |
94 |
1 |
clickAction(jobName, "Unschedule"); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
9 |
private void clickAction(String jobName, String actionLinkName)... |
101 |
|
{ |
102 |
9 |
getDriver().findElement( |
103 |
|
By.xpath("//tr[td[.='" + jobName + "']]//a[.='" + actionLinkName + "']")).click(); |
104 |
|
} |
105 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
106 |
1 |
public SchedulerEditPage clickAdd()... |
107 |
|
{ |
108 |
1 |
this.addButton.click(); |
109 |
1 |
return new SchedulerEditPage(); |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
@return |
114 |
|
|
115 |
|
@since |
116 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
117 |
5 |
public boolean hasError()... |
118 |
|
{ |
119 |
5 |
return getDriver().findElementsWithoutWaiting( |
120 |
|
By.xpath("//div[contains(@class, 'errormessage')]")).size() > 0; |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
@return@link |
125 |
|
@since |
126 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
0 |
public String getErrorMessage()... |
128 |
|
{ |
129 |
0 |
return getDriver().findElementWithoutWaiting( |
130 |
|
By.xpath("//div[contains(@class, 'errormessage')]")).getText(); |
131 |
|
} |
132 |
|
} |