Skip to content

Commit

Permalink
Do not run acceptance tests on jenkins.io
Browse files Browse the repository at this point in the history
  • Loading branch information
alextu committed Nov 21, 2023
1 parent ebb666c commit be09079
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
7 changes: 5 additions & 2 deletions acceptance-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ jenkinsVersions
.withNormalizer(ClasspathNormalizer::class)

onlyIf {
// Do not run on Jenkins since acceptance tests don't work there for some reason, one of them:
// https://github.com/jenkinsci/acceptance-test-harness/issues/1170
//
// Do not run on Windows as written here: https://github.com/jenkinsci/acceptance-test-harness/blob/master/docs/EXTERNAL.md
!OperatingSystem.current().isWindows
!ciJenkinsBuild || !OperatingSystem.current().isWindows
}

javaLauncher.set(javaToolchains.launcherFor {
Expand All @@ -98,7 +101,7 @@ jenkinsVersions
mapOf(
"JENKINS_WAR" to downloadJenkinsTask.get().outputs.files.singleFile,
"LOCAL_JARS" to gradlePlugin.singleFile,
"BROWSER" to if (true) "chrome-container" else "chrome"
"BROWSER" to "chrome"
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
class WebDriverProvider implements Provider<WebDriver> {

private static final Logger LOGGER = Logger.getLogger(FallbackConfig.class.getName());
private static final String CI_BROWSER = "chrome-container";
private final TestCleaner testCleaner;
private final FallbackConfig fallbackConfig;
private final TestName testName;
Expand All @@ -44,21 +43,21 @@ public WebDriverProvider(

private String getBrowser() {
String browser = System.getenv("BROWSER");
if (browser == null) browser = CI_BROWSER;
if (browser == null) browser = "chrome-container";
browser = browser.toLowerCase(Locale.ENGLISH);
return browser;
}

@Override
public WebDriver get() {
if (CI_BROWSER.equals(getBrowser())) {
try {
return fallbackConfig.createWebDriver(testCleaner, testName, time);
} catch (IOException e) {
throw new RuntimeException(e);
}
if ("chrome".equals(getBrowser())) {
return createChromeWebDriver();
}
try {
return fallbackConfig.createWebDriver(testCleaner, testName, time);
} catch (IOException e) {
throw new RuntimeException(e);
}
return createChromeWebDriver();
}

private WebDriver createChromeWebDriver() {
Expand Down

0 comments on commit be09079

Please sign in to comment.