11package org .jenkinsci .test .acceptance .plugins .dashboard_view .read ;
22
33import java .util .List ;
4- import java .util .stream .Collectors ;
54import org .jenkinsci .test .acceptance .po .PageAreaImpl ;
65import org .jenkinsci .test .acceptance .po .PageObject ;
76import 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}
0 commit comments