diff --git a/src/main/java/org/jenkinsci/test/acceptance/plugins/gradle/GradleStep.java b/src/main/java/org/jenkinsci/test/acceptance/plugins/gradle/GradleStep.java index c82f6375de..c68bf1d34f 100644 --- a/src/main/java/org/jenkinsci/test/acceptance/plugins/gradle/GradleStep.java +++ b/src/main/java/org/jenkinsci/test/acceptance/plugins/gradle/GradleStep.java @@ -24,6 +24,9 @@ package org.jenkinsci.test.acceptance.plugins.gradle; import org.jenkinsci.test.acceptance.po.*; +import org.openqa.selenium.WebElement; + +import java.util.List; @Describable("Invoke Gradle script") public class GradleStep extends AbstractStep implements BuildStep { @@ -41,15 +44,14 @@ public GradleStep(Job parent, String path) { } private void ensureAdvancedOptionsOpen() { - Control advancedButton = control("advanced-button"); - if(advancedButton.exists()) { - advancedButton.click(); + List advancedButtons = control("").resolve() + .findElements(by.css(".advanced-button:not([data-expanded='true'])")); - // Sticky footer obscures this, trying another click seems to work better - if (advancedButton.exists()) { + advancedButtons.forEach(advancedButton -> { + if (advancedButton.isDisplayed()) { advancedButton.click(); } - } + }); } public void setVersion(String version) { diff --git a/src/main/java/org/jenkinsci/test/acceptance/po/Job.java b/src/main/java/org/jenkinsci/test/acceptance/po/Job.java index 0d0a91729d..094bb2ecf2 100644 --- a/src/main/java/org/jenkinsci/test/acceptance/po/Job.java +++ b/src/main/java/org/jenkinsci/test/acceptance/po/Job.java @@ -408,9 +408,9 @@ public Workspace getWorkspace() { public void useCustomWorkspace(String ws) { ensureConfigPage(); - // There may be multiple "Advanced..." buttons visible on the job config page, and there's no easy way to identify + // There may be multiple "Advanced" buttons visible on the job config page, and there's no easy way to identify // which one is the Advanced Project Options one, so let's just hit all of them. - for (WebElement advancedButton : all(by.button("Advanced..."))) { + for (WebElement advancedButton : all(by.button("Advanced"))) { if (advancedButton.isDisplayed()) { advancedButton.click(); } diff --git a/src/main/java/org/jenkinsci/test/acceptance/po/ToolInstallation.java b/src/main/java/org/jenkinsci/test/acceptance/po/ToolInstallation.java index 68b1878f2a..afe71b2674 100644 --- a/src/main/java/org/jenkinsci/test/acceptance/po/ToolInstallation.java +++ b/src/main/java/org/jenkinsci/test/acceptance/po/ToolInstallation.java @@ -78,7 +78,7 @@ public static T addTool(Jenkins jenkins, Class t final ConfigurablePageObject page = ensureConfigPage(jenkins); final String name = type.getAnnotation(ToolInstallationPageObject.class).name(); - final Control expandButton = page.control(by.button(name + " installations...")); + final Control expandButton = page.control(by.button(name + " installations")); try { expandButton.click(); } catch (NoSuchElementException e) {