Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import static org.jenkinsci.test.acceptance.Matchers.hasContent;

import java.time.Duration;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.NoSuchFrameException;
Expand Down Expand Up @@ -87,15 +88,61 @@ public void searchPlugin(String searchSring) {

public void selectPlugin(String pluginKey) {
control(by.name(pluginKey)).click();
elasticSleep(200);
waitFor().withTimeout(Duration.ofSeconds(1)).until(() -> isSelected(pluginKey));
}

public void startInstall() {
clickButton("Install");
}

/**
* @deprecated use {@link #selectNone()} instead.
*/
@Deprecated
public void deselectAll() {
selectNone();
}

public void selectAll() {
clickLink("All");
waitFor()
.withTimeout(Duration.ofSeconds(1))
.until(() -> !getSelected().isEmpty() && getUnselected().isEmpty());
}

public void selectNone() {
clickLink("None");
elasticSleep(200);
waitFor()
.withTimeout(Duration.ofSeconds(1))
.until(() -> getSelected().isEmpty() && !getUnselected().isEmpty());
}

public void selectSuggested() {
clickLink("Suggested");
waitFor()
.withTimeout(Duration.ofSeconds(1))
.until(() -> !getSelected().isEmpty() && !getUnselected().isEmpty());
}

private boolean isSelected(String pluginKey) {
return driver
.findElements(by.xpath(
"//div[contains(@class, 'plugins-for-category')]/div[contains(@class, 'plugin') and contains(@class, 'selected') and contains(@class, '%s')]",
pluginKey))
.stream()
.findFirst()
.isPresent();
}
Comment on lines +127 to +135
Copy link
Member

@jtnord jtnord Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeromepochat this fails for some plugins. e.g. workflow-aggregator

can be reproduced with

diff --git a/src/test/java/core/InstallWizardTest.java b/src/test/java/core/InstallWizardTest.java
index 2a8507cb..6d3da103 100644
--- a/src/test/java/core/InstallWizardTest.java
+++ b/src/test/java/core/InstallWizardTest.java
@@ -93,8 +93,8 @@ public class InstallWizardTest extends AbstractJUnitTest {
         wizardCustomize.selectSuggested();
         wizardCustomize.selectAll();
         wizardCustomize.selectNone();
-        wizardCustomize.searchPlugin("JUnit");
-        wizardCustomize.selectPlugin("junit");
+        wizardCustomize.searchPlugin("Pipeline");
+        wizardCustomize.selectPlugin("workflow-aggregator");
         wizardCustomize.startInstall();

         wizardCustomize.shouldFinishInstallSuccessfully();


private List<WebElement> getSelected() {
return driver.findElements(
by.xpath(
"//div[contains(@class, 'plugins-for-category')]/div[contains(@class, 'plugin') and contains(@class, 'selected')]"));
}

private List<WebElement> getUnselected() {
return driver.findElements(
by.xpath(
"//div[contains(@class, 'plugins-for-category')]/div[contains(@class, 'plugin') and not(contains(@class, 'selected'))]"));
}
}
4 changes: 3 additions & 1 deletion src/test/java/core/InstallWizardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public void wizardInstallCustomPluginsTest() throws IOException {
// Customize Jenkins step
WizardCustomizeJenkins wizardCustomize = new WizardCustomizeJenkins(jenkins);
wizardCustomize.doSelectPluginsToInstall();
wizardCustomize.deselectAll();
wizardCustomize.selectSuggested();
wizardCustomize.selectAll();
wizardCustomize.selectNone();
wizardCustomize.searchPlugin("JUnit");
wizardCustomize.selectPlugin("junit");
wizardCustomize.startInstall();
Comment on lines 96 to 98
Copy link
Member

@jtnord jtnord Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW this is a weak test, as junit is a suggested plugin - so the customisation may be completely broken. (there is also no check that the plugin is installed later on!)

Expand Down