Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump com.saucelabs:ci-sauce from 1.183 to 2.2 #5640

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
6 changes: 3 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ jobs:
-Pvividus.batch-1.resource-include-patterns=ProxyStepsTests.story \
-Pvividus.selenium.grid.username=${SAUCELABS_USER} \
-Pvividus.selenium.grid.password=${SAUCELABS_KEY} \
-Pvividus.saucelabs.sauce-connect.command-line-arguments="--proxy-localhost --no-ssl-bump-domains example.com"
-Pvividus.saucelabs.sauce-connect.command-line-arguments="--proxy-localhost allow --tls-passthrough-domains example\.com"
else
echo No SAUCELABS_USER and/or SAUCELABS_KEY, SauceLabs system tests will be skipped
fi
Expand Down Expand Up @@ -482,7 +482,7 @@ jobs:
-Pvividus.allure.executor.build-url=https://github.com/vividus-framework/vividus/actions/runs/${GITHUB_RUN_ID} \
-Pvividus.allure.executor.report-url=https://github.com/vividus-framework/vividus/actions/runs/${GITHUB_RUN_ID} \
-Pvividus.allure.executor.report-name="SauceLabs iOS Proxy tests report" \
-Pvividus.saucelabs.sauce-connect.command-line-arguments="--proxy-localhost --no-ssl-bump-domains example.com" \
-Pvividus.saucelabs.sauce-connect.command-line-arguments="--proxy-localhost allow --tls-passthrough-domains example\.com" \
-Pvividus.variables.app-url=storage:filename=vividus-test-app-ios-$TEST_APP_VERSION.zip
else
echo No SAUCELABS_USER and/or SAUCELABS_KEY variables, System tests will be skipped
Expand Down Expand Up @@ -557,7 +557,7 @@ jobs:
-Pvividus.allure.executor.build-url=https://github.com/vividus-framework/vividus/actions/runs/${GITHUB_RUN_ID} \
-Pvividus.allure.executor.report-url=https://github.com/vividus-framework/vividus/actions/runs/${GITHUB_RUN_ID} \
-Pvividus.allure.executor.report-name="SauceLabs Android Proxy tests report" \
-Pvividus.saucelabs.sauce-connect.command-line-arguments="--proxy-localhost --no-ssl-bump-domains example.com" \
-Pvividus.saucelabs.sauce-connect.command-line-arguments="--proxy-localhost allow --tls-passthrough-domains example\.com" \
-Pvividus.variables.app-url=storage:filename=vividus-test-app-android-$TEST_APP_VERSION.zip
else
echo No SAUCELABS_USER and/or SAUCELABS_KEY variables, System tests will be skipped
Expand Down
2 changes: 1 addition & 1 deletion vividus-plugin-saucelabs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies {
implementation project(':vividus-extension-selenium')

implementation(group: 'com.google.guava', name: 'guava', version: '33.4.0-jre')
implementation(group: 'com.saucelabs', name: 'ci-sauce', version: '1.183')
implementation(group: 'com.saucelabs', name: 'ci-sauce', version: '2.2')

testImplementation platform(group: 'org.junit', name: 'junit-bom', version: '5.11.4')
testImplementation(group: 'org.junit.jupiter', name: 'junit-jupiter')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2023 the original author or authors.
* Copyright 2019-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,12 +21,14 @@
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.saucelabs.saucerest.DataCenter;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.SystemUtils;
Expand All @@ -47,15 +49,15 @@ public class SauceConnectOptions extends TunnelOptions
private static final String FULL_FILE_PROTOCOL = FILE_PROTOCOL + (SystemUtils.IS_OS_WINDOWS ? "/" : "");

private final boolean useLatestSauceConnect;
private final String restUrl;
private final DataCenter dataCenter;
private final String customArguments;
private final Set<String> skipHostGlobPatterns;

public SauceConnectOptions(boolean useLatestSauceConnect, String restUrl, String customArguments,
public SauceConnectOptions(boolean useLatestSauceConnect, DataCenter dataCenter, String customArguments,
Set<String> skipHostGlobPatterns)
{
this.useLatestSauceConnect = useLatestSauceConnect;
this.restUrl = restUrl;
this.dataCenter = dataCenter;
this.customArguments = customArguments;
this.skipHostGlobPatterns = new TreeSet<>(skipHostGlobPatterns);
this.skipHostGlobPatterns.addAll(List.of(
Expand All @@ -70,11 +72,8 @@ public String build(String tunnelName) throws IOException
{
StringBuilder options = Optional.ofNullable(customArguments).map(args -> new StringBuilder(args).append(' '))
.orElseGet(StringBuilder::new);
if (tunnelName != null)
{
appendOption(options, "tunnel-name", tunnelName);
appendOption(options, "pidfile", createPidFile(tunnelName).toString());
}
appendOption(options, "tunnel-name", tunnelName);
appendOption(options, "region", dataCenter.name().toLowerCase(Locale.ROOT).replace('_', '-'));

if (getProxy() != null)
{
Expand All @@ -85,11 +84,7 @@ public String build(String tunnelName) throws IOException

appendOption(options, "pac", pacFileUrl);
}
if (restUrl != null)
{
appendOption(options, "rest-url", restUrl);
}
appendOption(options, "tunnel-pool");
appendOption(options, "tunnel-pool", null);
return options.substring(0, options.length() - 1);
}

Expand All @@ -106,15 +101,13 @@ private String getSkipShExpMatcher()
.collect(Collectors.joining(" || "));
}

private Path createPidFile(String tunnelName) throws IOException
{
return createTempFile("sc_client-" + tunnelName + "-", ".pid", null);
}

private static void appendOption(StringBuilder stringBuilder, String name, String... values)
private static void appendOption(StringBuilder stringBuilder, String name, String value)
{
stringBuilder.append("--").append(name).append(' ');
Stream.of(values).forEach(value -> stringBuilder.append(value).append(' '));
if (value != null)
{
stringBuilder.append(value).append(' ');
}
}

@Override
Expand All @@ -133,13 +126,13 @@ public boolean equals(Object o)
return false;
}
SauceConnectOptions that = (SauceConnectOptions) o;
return useLatestSauceConnect == that.useLatestSauceConnect && Objects.equals(restUrl, that.restUrl)
return useLatestSauceConnect == that.useLatestSauceConnect && Objects.equals(dataCenter, that.dataCenter)
&& Objects.equals(skipHostGlobPatterns, that.skipHostGlobPatterns);
}

@Override
public int hashCode()
{
return Objects.hash(super.hashCode(), useLatestSauceConnect, restUrl, skipHostGlobPatterns);
return Objects.hash(super.hashCode(), useLatestSauceConnect, dataCenter, skipHostGlobPatterns);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2023 the original author or authors.
* Copyright 2019-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@ public class SauceLabsCapabilitiesConfigurer extends AbstractTunnellingCapabilit
private static final String SAUCE_OPTIONS = "sauce:options";

private final boolean useLatestSauceConnect;
private final String restUrl;
private final DataCenter dataCenter;
private String sauceConnectArguments;
private Set<String> skipHostGlobPatterns;

Expand All @@ -38,7 +38,7 @@ public SauceLabsCapabilitiesConfigurer(boolean useLatestSauceConnect, RunContext
{
super(runContext, sauceConnectManager);
this.useLatestSauceConnect = useLatestSauceConnect;
this.restUrl = dataCenter.apiServer() + "rest/v1";
this.dataCenter = dataCenter;
}

@Override
Expand All @@ -53,7 +53,7 @@ public void configure(DesiredCapabilities desiredCapabilities)
@Override
protected SauceConnectOptions createOptions()
{
return new SauceConnectOptions(useLatestSauceConnect, restUrl, sauceConnectArguments,
return new SauceConnectOptions(useLatestSauceConnect, dataCenter, sauceConnectArguments,
skipHostGlobPatterns == null ? Set.of() : skipHostGlobPatterns);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
<constructor-arg index="0" value="${selenium.grid.username}" />
<constructor-arg index="1" value="${selenium.grid.password}" />
<constructor-arg>
<bean class="com.saucelabs.ci.sauceconnect.SauceConnectFourManager">
<constructor-arg index="0" value="false"/>
<constructor-arg index="1" value="VIVIDUS"/>
<bean class="com.saucelabs.ci.sauceconnect.SauceConnectManager">
<constructor-arg index="0" value="VIVIDUS"/>
Fixed Show fixed Hide fixed
<property name="useLatestSauceConnect" value="${saucelabs.sauce-connect.use-latest-version}"/>
</bean>
</constructor-arg>
Expand Down
Loading
Loading