-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathMainPanel.java
More file actions
53 lines (45 loc) · 1.61 KB
/
MainPanel.java
File metadata and controls
53 lines (45 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package io.jenkins.plugins.coverage;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.jenkinsci.test.acceptance.po.Job;
import org.jenkinsci.test.acceptance.po.PageObject;
/**
* {@link PageObject} representing the Job status on the build page of a job.
*/
public class MainPanel extends PageObject {
private static final String VALUE_OF_TOOL_ATTRIBUTE_IN_CHART = "coverage";
/**
* Constructor to create MainPanel-PageObject out of a job.
*
* @param parent
* job of wanted MainPanel.
*/
public MainPanel(final Job parent) {
super(parent, parent.url);
}
/**
* Getter for Coverage-Overview-Chart Data.
*
* @return Json Value of Coverage-Overview Chart
*/
public String getCoverageTrendChart() {
waitFor().until(this::isChartDisplayed);
return ChartUtil.getDataOfOnlyChartOnPageWithGivenToolAttribute(this, VALUE_OF_TOOL_ATTRIBUTE_IN_CHART);
}
/**
* Returns if TrendChart is displayed in MainPanel.
* @return if TrendChart is displayed
*/
public boolean isChartDisplayed() {
ensureMainPanelPageIsOpen();
return ChartUtil.isChartDisplayedByDivToolAttribute(this, VALUE_OF_TOOL_ATTRIBUTE_IN_CHART);
}
/**
* Ensures MainPanel Page is opened.
*/
private void ensureMainPanelPageIsOpen() {
MatcherAssert.assertThat("main panel page was not opened", this.driver.getCurrentUrl(),
CoreMatchers.anyOf(CoreMatchers.containsString(this.url.toString()),
CoreMatchers.containsString(this.url + "/")));
}
}