Skip to content

Commit

Permalink
Forward compatibility for new advanced buttons (#955)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Jacomb <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
Co-authored-by: Jan Faracik <[email protected]>
  • Loading branch information
4 people authored Dec 5, 2022
1 parent 75a4c32 commit bbcd049
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -41,15 +44,14 @@ public GradleStep(Job parent, String path) {
}

private void ensureAdvancedOptionsOpen() {
Control advancedButton = control("advanced-button");
if(advancedButton.exists()) {
advancedButton.click();
List<WebElement> 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) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jenkinsci/test/acceptance/po/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static <T extends ToolInstallation> T addTool(Jenkins jenkins, Class<T> 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) {
Expand Down

0 comments on commit bbcd049

Please sign in to comment.