Skip to content

Commit dea99c1

Browse files
authored
adjust to removal of idle executors (#1605)
1 parent c2e0469 commit dea99c1

3 files changed

Lines changed: 11 additions & 38 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<properties>
3131
<changelist>999999-SNAPSHOT</changelist>
3232
<spotbugs.skip>true</spotbugs.skip>
33-
<jenkins.version>2.462</jenkins.version>
33+
<jenkins.version>2.463</jenkins.version>
3434
<selenium.version>4.22.0</selenium.version>
3535
<guava.version>33.2.1-jre</guava.version> <!-- aligned with selenium -->
3636
<maven.version>3.8.1</maven.version>
Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.jenkinsci.test.acceptance.plugins.dashboard_view.read;
22

33
import java.util.List;
4-
import java.util.stream.Collectors;
54
import org.jenkinsci.test.acceptance.po.PageAreaImpl;
65
import org.jenkinsci.test.acceptance.po.PageObject;
76
import org.openqa.selenium.By;
@@ -18,30 +17,22 @@ public class BuildExecutorStatus extends PageAreaImpl {
1817
* Container for all further elements.
1918
*/
2019
private final By executors = By.xpath("//div[@id=\"side-panel\"]/div[@id=\"executors\"]");
21-
/**
22-
* Main table of nodes and executors.
23-
*/
24-
private final By table = By.xpath("//table/tbody");
2520
/**
2621
* Header in the table for the name of the node. If only one node, the header is not shown.
2722
*/
28-
private final By header = By.xpath("//th");
29-
/**
30-
* All Executors. (not split by header)
31-
*/
32-
private final By executor = By.xpath("//tr/td[2]");
23+
private final By header = By.xpath("//div[@class=\"computer-caption\"] | //table//th");
3324

3425
public BuildExecutorStatus(PageObject context, String path) {
3526
super(context, path);
3627
}
3728

3829
/**
39-
* Get the main table containing the nodes and executors.
30+
* Get the div containing the nodes and executors.
4031
*
41-
* @return the WebElement for the table.
32+
* @return the WebElement for the div.
4233
*/
43-
public WebElement getTable() {
44-
return find(executors).findElement(table);
34+
public WebElement getExecutorsDiv() {
35+
return find(executors);
4536
}
4637

4738
/**
@@ -51,22 +42,7 @@ public WebElement getTable() {
5142
*
5243
* @return the names of all displayed nodes/agents.
5344
*/
54-
public List<String> getHeaders() {
55-
return getTable().findElements(header).stream()
56-
.map(WebElement::getText)
57-
.map(String::trim)
58-
.collect(Collectors.toList());
45+
public List<WebElement> getHeaders() {
46+
return getExecutorsDiv().findElements(header);
5947
}
60-
61-
/**
62-
* Get all the executors displayed in the table.
63-
* @return the list of executor names.
64-
*/
65-
public List<String> getExecutors() {
66-
return getTable().findElements(executor).stream()
67-
.map(WebElement::getText)
68-
.map(String::trim)
69-
.collect(Collectors.toList());
70-
}
71-
7248
}

src/test/java/plugins/DashboardViewPluginTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.jenkinsci.test.acceptance.po.Node;
2525
import org.jenkinsci.test.acceptance.slave.SlaveController;
2626
import org.junit.Test;
27+
import org.openqa.selenium.WebElement;
2728

2829
@WithPlugins("dashboard-view")
2930
public class DashboardViewPluginTest extends AbstractJobRelatedTest {
@@ -258,21 +259,17 @@ public void configureDashboardFilterBuildExecutors() throws Exception {
258259
});
259260
v.open();
260261

261-
final List<String> headers = v.buildExecutorStatus.getHeaders();
262-
final List<String> executors = v.buildExecutorStatus.getExecutors();
262+
final List<WebElement> headers = v.buildExecutorStatus.getHeaders();
263263
assertThat(headers.size(), is(2));
264-
assertThat(executors.size(), greaterThan(1));
265264

266265
job.configure(() -> {
267266
job.setLabelExpression("test");
268267
});
269268
v.open();
270269

271-
final List<String> headers2 = v.buildExecutorStatus.getHeaders();
272-
final List<String> executors2 = v.buildExecutorStatus.getExecutors();
270+
final List<WebElement> headers2 = v.buildExecutorStatus.getHeaders();
273271
// If only one node, the title header is not shown.
274272
assertThat(headers2.size(), is(0));
275-
assertThat(executors2.size(), is(1));
276273
}
277274

278275
@Test

0 commit comments

Comments
 (0)