From e9df2b2a4f47e11ad9e731b79f928c37e918344b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 4 Jan 2025 11:25:24 +0000 Subject: [PATCH 01/10] Bump com.saucelabs:ci-sauce from 1.183 to 2.2 Bumps [com.saucelabs:ci-sauce](https://github.com/saucelabs/ci-sauce) from 1.183 to 2.2. - [Release notes](https://github.com/saucelabs/ci-sauce/releases) - [Changelog](https://github.com/saucelabs/ci-sauce/blob/main/CHANGELOG.md) - [Commits](https://github.com/saucelabs/ci-sauce/compare/1.183...2.2) --- updated-dependencies: - dependency-name: com.saucelabs:ci-sauce dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- vividus-plugin-saucelabs/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vividus-plugin-saucelabs/build.gradle b/vividus-plugin-saucelabs/build.gradle index b6ee41f6fa..33df895275 100644 --- a/vividus-plugin-saucelabs/build.gradle +++ b/vividus-plugin-saucelabs/build.gradle @@ -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') From a9f801996611ada5112a130f193ec698731e6ead Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sat, 4 Jan 2025 13:27:25 +0200 Subject: [PATCH 02/10] Fix constructor parameters --- .../src/main/resources/vividus-plugin/spring.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vividus-plugin-saucelabs/src/main/resources/vividus-plugin/spring.xml b/vividus-plugin-saucelabs/src/main/resources/vividus-plugin/spring.xml index 32348c0612..b2f63bcc58 100644 --- a/vividus-plugin-saucelabs/src/main/resources/vividus-plugin/spring.xml +++ b/vividus-plugin-saucelabs/src/main/resources/vividus-plugin/spring.xml @@ -16,8 +16,7 @@ - - + From 990614debd6328d323b96f78f4c7a7ddd8a9613e Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sat, 4 Jan 2025 13:36:09 +0200 Subject: [PATCH 03/10] Fix class name --- .../src/main/resources/vividus-plugin/spring.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vividus-plugin-saucelabs/src/main/resources/vividus-plugin/spring.xml b/vividus-plugin-saucelabs/src/main/resources/vividus-plugin/spring.xml index b2f63bcc58..df011e2706 100644 --- a/vividus-plugin-saucelabs/src/main/resources/vividus-plugin/spring.xml +++ b/vividus-plugin-saucelabs/src/main/resources/vividus-plugin/spring.xml @@ -15,7 +15,7 @@ - + From 36e12c127ae710679ed0479065275700ae1a2163 Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sat, 4 Jan 2025 14:07:40 +0200 Subject: [PATCH 04/10] Replace `--no-ssl-bump-domains` option with `--tls-passthrough-domains` option --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 21c96fb418..841ff5cc56 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -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 --tls-passthrough-domains .*\.example\.com" else echo No SAUCELABS_USER and/or SAUCELABS_KEY, SauceLabs system tests will be skipped fi @@ -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 --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 @@ -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 --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 From f78cd49fe6bf4c10851191340c4e412cad933297 Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sat, 4 Jan 2025 15:22:17 +0200 Subject: [PATCH 05/10] Fix `--proxy-localhost` option value --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 841ff5cc56..927a3db972 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -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 --tls-passthrough-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 @@ -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 --tls-passthrough-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 @@ -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 --tls-passthrough-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 From 01711c3f77e3dcad1084494471abbdd55212381f Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sun, 5 Jan 2025 12:20:18 +0300 Subject: [PATCH 06/10] Remove `--pid-file` option --- .../selenium/sauce/SauceConnectOptions.java | 8 +-- .../sauce/SauceConnectOptionsTests.java | 51 +++++-------------- 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java b/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java index 7fbc16a25a..f072e8da5a 100644 --- a/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java +++ b/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java @@ -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. @@ -73,7 +73,6 @@ public String build(String tunnelName) throws IOException if (tunnelName != null) { appendOption(options, "tunnel-name", tunnelName); - appendOption(options, "pidfile", createPidFile(tunnelName).toString()); } if (getProxy() != null) @@ -106,11 +105,6 @@ 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) { stringBuilder.append("--").append(name).append(' '); diff --git a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java index 141d9d0156..bebf684fe8 100644 --- a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java +++ b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java @@ -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. @@ -41,9 +41,7 @@ class SauceConnectOptionsTests private static final String PAC_TEST_TUNNEL = "pac-saucelabs-test-tunnel"; private static final String PROXY = "test"; private static final String TUNNEL_NAME = "test-tunnel"; - private static final String PID_FILE_NAME = "sc_client-" + TUNNEL_NAME + "-"; private static final String TUNNEL_NAME_OPTION = "--tunnel-name" + SPACE + TUNNEL_NAME; - private static final String PID_EXTENSION = ".pid"; private static final String TUNNEL_POOL = "--tunnel-pool"; private static final String DEFAULT_REST_URL = "https://saucelabs.com/rest/v1/"; private static final String DEFAULT_CUSTOM_ARGS = "--verbose"; @@ -61,8 +59,6 @@ class SauceConnectOptionsTests + " return \"PROXY test\";%n" + "}%n"; - private static final String PID_FILE = "--pidfile"; - @Test void testBuildWithProxy() throws IOException { @@ -71,10 +67,9 @@ void testBuildWithProxy() throws IOException try (MockedStatic resources = mockStatic(ResourceUtils.class)) { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); - Path pidPath = mockPid(resources); - assertEquals(TUNNEL_NAME_OPTION + SPACE + PID_FILE + SPACE + pidPath + SPACE + PAC_FILE + pacPath + SPACE - + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); + assertEquals(TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, + sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -86,11 +81,10 @@ void testBuildWithProxyForLatestSauceConnect() throws IOException try (MockedStatic resources = mockStatic(ResourceUtils.class)) { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); - Path pidPath = mockPid(resources); - assertEquals(TUNNEL_NAME_OPTION + SPACE + PID_FILE + SPACE + pidPath + SPACE + PAC_FILE + ( - SystemUtils.IS_OS_WINDOWS ? "/" : "") + pacPath + SPACE + TUNNEL_POOL, - sauceConnectOptions.build(TUNNEL_NAME)); + assertEquals( + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + (SystemUtils.IS_OS_WINDOWS ? "/" : "") + pacPath + SPACE + + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -103,10 +97,9 @@ void testBuildWithProxyWindowsPathDelimiters() throws IOException { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); when(pacPath.toString()).thenReturn("c:\\user\\temp.js"); - Path pidPath = mockPid(resources); - assertEquals(TUNNEL_NAME_OPTION + SPACE + PID_FILE + SPACE + pidPath + SPACE + PAC_FILE + "c:/user/temp.js" - + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); + assertEquals(TUNNEL_NAME_OPTION + SPACE + PAC_FILE + "c:/user/temp.js" + SPACE + TUNNEL_POOL, + sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -118,11 +111,9 @@ void testBuildWithProxyWithAuth() throws IOException try (MockedStatic resources = mockStatic(ResourceUtils.class)) { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); - Path pidPath = mockPid(resources); - assertEquals( - customFlags + SPACE + TUNNEL_NAME_OPTION + SPACE + PID_FILE + SPACE + pidPath + SPACE + PAC_FILE - + pacPath + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); + assertEquals(customFlags + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, + sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -137,24 +128,17 @@ void testBuildWithProxyWithSkipHostsPattern() throws IOException + "(host, \"*.miso.saucelabs.com\") || shExpMatch(host, \"*.saucelabs.com\") || shExpMatch(host, " + "\"*.vividus.dev\") || shExpMatch(host, \"example.com\") || shExpMatch(host, \"saucelabs.com\")"; Path pacPath = mockPac(resources, matchCondition); - Path pidPath = mockPid(resources); - assertEquals(TUNNEL_NAME_OPTION + SPACE + PID_FILE + SPACE + pidPath + SPACE + PAC_FILE + pacPath + SPACE - + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); + assertEquals(TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, + sauceConnectOptions.build(TUNNEL_NAME)); } } @Test void testBuildWOProxy() throws IOException { - try (MockedStatic resources = mockStatic(ResourceUtils.class)) - { - Path pidPath = mockPid(resources); - - SauceConnectOptions sauceConnectOptions = createEmptyOptions(); - assertEquals(TUNNEL_NAME_OPTION + SPACE + PID_FILE + SPACE + pidPath + SPACE + TUNNEL_POOL, - sauceConnectOptions.build(TUNNEL_NAME)); - } + SauceConnectOptions sauceConnectOptions = createEmptyOptions(); + assertEquals(TUNNEL_NAME_OPTION + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } @Test @@ -238,13 +222,6 @@ private SauceConnectOptions createOptions(String restUrl, String customArguments return options; } - private Path mockPid(MockedStatic mock) - { - Path pidPath = mock(Path.class); - mock.when(() -> ResourceUtils.createTempFile(PID_FILE_NAME, PID_EXTENSION, null)).thenReturn(pidPath); - return pidPath; - } - private Path mockPac(MockedStatic mock, String matchCondition) { Path pacPath = mock(Path.class); From 44c951c81658f19b6e57161737207f114c8a5b48 Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sun, 5 Jan 2025 14:11:35 +0300 Subject: [PATCH 07/10] Replace `--rest-url` option with `--region` option --- .../selenium/sauce/SauceConnectOptions.java | 18 +++--- .../SauceLabsCapabilitiesConfigurer.java | 8 +-- .../sauce/SauceConnectOptionsTests.java | 62 ++++++++++--------- .../SauceLabsCapabilitiesConfigurerTests.java | 13 ++-- 4 files changed, 53 insertions(+), 48 deletions(-) diff --git a/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java b/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java index f072e8da5a..e580f4b4f5 100644 --- a/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java +++ b/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java @@ -21,6 +21,7 @@ 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; @@ -28,6 +29,8 @@ 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; import org.vividus.selenium.tunnel.TunnelOptions; @@ -47,15 +50,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 skipHostGlobPatterns; - public SauceConnectOptions(boolean useLatestSauceConnect, String restUrl, String customArguments, + public SauceConnectOptions(boolean useLatestSauceConnect, DataCenter dataCenter, String customArguments, Set skipHostGlobPatterns) { this.useLatestSauceConnect = useLatestSauceConnect; - this.restUrl = restUrl; + this.dataCenter = dataCenter; this.customArguments = customArguments; this.skipHostGlobPatterns = new TreeSet<>(skipHostGlobPatterns); this.skipHostGlobPatterns.addAll(List.of( @@ -70,6 +73,7 @@ public String build(String tunnelName) throws IOException { StringBuilder options = Optional.ofNullable(customArguments).map(args -> new StringBuilder(args).append(' ')) .orElseGet(StringBuilder::new); + appendOption(options, "region", dataCenter.name().toLowerCase(Locale.ROOT).replace('_', '-')); if (tunnelName != null) { appendOption(options, "tunnel-name", tunnelName); @@ -84,10 +88,6 @@ public String build(String tunnelName) throws IOException appendOption(options, "pac", pacFileUrl); } - if (restUrl != null) - { - appendOption(options, "rest-url", restUrl); - } appendOption(options, "tunnel-pool"); return options.substring(0, options.length() - 1); } @@ -127,13 +127,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); } } diff --git a/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceLabsCapabilitiesConfigurer.java b/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceLabsCapabilitiesConfigurer.java index 510c5886c5..595fa4a112 100644 --- a/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceLabsCapabilitiesConfigurer.java +++ b/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceLabsCapabilitiesConfigurer.java @@ -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. @@ -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 skipHostGlobPatterns; @@ -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 @@ -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); } diff --git a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java index bebf684fe8..bd199d7ed1 100644 --- a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java +++ b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java @@ -26,6 +26,8 @@ import java.nio.file.Path; import java.util.Set; +import com.saucelabs.saucerest.DataCenter; + import org.apache.commons.lang3.SystemUtils; import org.junit.jupiter.api.Test; import org.mockito.MockedStatic; @@ -43,7 +45,9 @@ class SauceConnectOptionsTests private static final String TUNNEL_NAME = "test-tunnel"; private static final String TUNNEL_NAME_OPTION = "--tunnel-name" + SPACE + TUNNEL_NAME; private static final String TUNNEL_POOL = "--tunnel-pool"; - private static final String DEFAULT_REST_URL = "https://saucelabs.com/rest/v1/"; + private static final DataCenter DATA_CENTER = DataCenter.US_WEST; + private static final String REGION = "us-west"; + private static final String REGION_OPTION = "--region" + SPACE + REGION; private static final String DEFAULT_CUSTOM_ARGS = "--verbose"; private static final Set DEFAULT_SKIP_GLOB_HOST_PATTERNS = Set.of("vividus.dev"); private static final String DEFAULT_MATCH_CHAIN = "shExpMatch(host, \"*.api.testobject.com\") || " @@ -68,7 +72,7 @@ void testBuildWithProxy() throws IOException { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); - assertEquals(TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, + assertEquals(REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -76,15 +80,15 @@ void testBuildWithProxy() throws IOException @Test void testBuildWithProxyForLatestSauceConnect() throws IOException { - SauceConnectOptions sauceConnectOptions = new SauceConnectOptions(true, null, null, Set.of()); + SauceConnectOptions sauceConnectOptions = new SauceConnectOptions(true, DATA_CENTER, null, Set.of()); sauceConnectOptions.setProxy(PROXY); try (MockedStatic resources = mockStatic(ResourceUtils.class)) { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); assertEquals( - TUNNEL_NAME_OPTION + SPACE + PAC_FILE + (SystemUtils.IS_OS_WINDOWS ? "/" : "") + pacPath + SPACE - + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); + REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + (SystemUtils.IS_OS_WINDOWS ? "/" + : "") + pacPath + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -98,8 +102,8 @@ void testBuildWithProxyWindowsPathDelimiters() throws IOException Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); when(pacPath.toString()).thenReturn("c:\\user\\temp.js"); - assertEquals(TUNNEL_NAME_OPTION + SPACE + PAC_FILE + "c:/user/temp.js" + SPACE + TUNNEL_POOL, - sauceConnectOptions.build(TUNNEL_NAME)); + assertEquals(REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + "c:/user/temp.js" + SPACE + + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -107,13 +111,13 @@ void testBuildWithProxyWindowsPathDelimiters() throws IOException void testBuildWithProxyWithAuth() throws IOException { String customFlags = "--auth host:9999:user:pass"; - SauceConnectOptions sauceConnectOptions = createOptions(null, customFlags, Set.of(), PROXY); + SauceConnectOptions sauceConnectOptions = createOptions(customFlags, Set.of(), PROXY); try (MockedStatic resources = mockStatic(ResourceUtils.class)) { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); - assertEquals(customFlags + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, - sauceConnectOptions.build(TUNNEL_NAME)); + assertEquals(customFlags + SPACE + REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -121,7 +125,7 @@ void testBuildWithProxyWithAuth() throws IOException void testBuildWithProxyWithSkipHostsPattern() throws IOException { Set hosts = Set.of("example.com", "*.vividus.dev"); - SauceConnectOptions sauceConnectOptions = createOptions(null, null, hosts, PROXY); + SauceConnectOptions sauceConnectOptions = createOptions(null, hosts, PROXY); try (MockedStatic resources = mockStatic(ResourceUtils.class)) { String matchCondition = "shExpMatch(host, \"*.api.testobject.com\") || shExpMatch" @@ -129,7 +133,7 @@ void testBuildWithProxyWithSkipHostsPattern() throws IOException + "\"*.vividus.dev\") || shExpMatch(host, \"example.com\") || shExpMatch(host, \"saucelabs.com\")"; Path pacPath = mockPac(resources, matchCondition); - assertEquals(TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, + assertEquals(REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -138,21 +142,15 @@ void testBuildWithProxyWithSkipHostsPattern() throws IOException void testBuildWOProxy() throws IOException { SauceConnectOptions sauceConnectOptions = createEmptyOptions(); - assertEquals(TUNNEL_NAME_OPTION + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); + assertEquals(REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + TUNNEL_POOL, + sauceConnectOptions.build(TUNNEL_NAME)); } @Test void testBuildWOProxyNullOption() throws IOException { SauceConnectOptions sauceConnectOptions = createEmptyOptions(); - assertEquals(TUNNEL_POOL, sauceConnectOptions.build(null)); - } - - @Test - void testBuildWithRestUrl() throws IOException - { - SauceConnectOptions sauceConnectOptions = createOptions(DEFAULT_REST_URL, null, Set.of(), null); - assertEquals("--rest-url" + SPACE + DEFAULT_REST_URL + SPACE + TUNNEL_POOL, sauceConnectOptions.build(null)); + assertEquals(REGION_OPTION + SPACE + TUNNEL_POOL, sauceConnectOptions.build(null)); } @Test @@ -194,30 +192,36 @@ void testNotEqualsProxy() @Test void testNotEqualsSkipProxyHostsPattern() { - assertNotEquals(createOptions(DEFAULT_REST_URL, DEFAULT_CUSTOM_ARGS, Set.of(), PROXY), createDefaultOptions()); + assertNotEquals(createOptions(DEFAULT_CUSTOM_ARGS, Set.of(), PROXY), createDefaultOptions()); } @Test - void testNotEqualsRestUrl() + void testNotEqualsDataCenter() { - assertNotEquals(createOptions(null, DEFAULT_CUSTOM_ARGS, DEFAULT_SKIP_GLOB_HOST_PATTERNS, PROXY), + assertNotEquals( + createOptions(DataCenter.EU_CENTRAL, DEFAULT_CUSTOM_ARGS, DEFAULT_SKIP_GLOB_HOST_PATTERNS, PROXY), createDefaultOptions()); } private SauceConnectOptions createDefaultOptions() { - return createOptions(DEFAULT_REST_URL, DEFAULT_CUSTOM_ARGS, DEFAULT_SKIP_GLOB_HOST_PATTERNS, PROXY); + return createOptions(DEFAULT_CUSTOM_ARGS, DEFAULT_SKIP_GLOB_HOST_PATTERNS, PROXY); } private SauceConnectOptions createEmptyOptions() { - return createOptions(null, null, Set.of(), null); + return createOptions(null, Set.of(), null); + } + + private SauceConnectOptions createOptions(String customArguments, Set skipHostGlobPatterns, String proxy) + { + return createOptions(DATA_CENTER, customArguments, skipHostGlobPatterns, proxy); } - private SauceConnectOptions createOptions(String restUrl, String customArguments, Set skipHostGlobPatterns, - String proxy) + private static SauceConnectOptions createOptions(DataCenter dataCenter, String customArguments, + Set skipHostGlobPatterns, String proxy) { - SauceConnectOptions options = new SauceConnectOptions(false, restUrl, customArguments, skipHostGlobPatterns); + SauceConnectOptions options = new SauceConnectOptions(false, dataCenter, customArguments, skipHostGlobPatterns); options.setProxy(proxy); return options; } diff --git a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceLabsCapabilitiesConfigurerTests.java b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceLabsCapabilitiesConfigurerTests.java index 76f1cb3869..4efe8eb2ab 100644 --- a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceLabsCapabilitiesConfigurerTests.java +++ b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceLabsCapabilitiesConfigurerTests.java @@ -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. @@ -60,9 +60,9 @@ class SauceLabsCapabilitiesConfigurerTests private static final String STORY_PATH = STORY_NAME + ".story"; - private static final String REST_URL = "https://api.eu-central-1.saucelabs.com/rest/v1"; private static final String CUSTOM_ARGS = "--verbose"; private static final Set SKIP_HOST_GLOB_PATTERNS = Set.of("example.com"); + private static final DataCenter DATA_CENTER = DataCenter.EU_CENTRAL; @Mock private RunContext runContext; @Mock private SauceConnectManager sauceConnectManager; @@ -71,7 +71,7 @@ class SauceLabsCapabilitiesConfigurerTests @BeforeEach void beforeEach() { - configurer = new SauceLabsCapabilitiesConfigurer(true, runContext, sauceConnectManager, DataCenter.EU_CENTRAL); + configurer = new SauceLabsCapabilitiesConfigurer(true, runContext, sauceConnectManager, DATA_CENTER); } @Test @@ -99,7 +99,7 @@ void shouldStartSauceConnectWhenSauceConnectIsEnabled() configurer.setTunnellingEnabled(true); Map sauceOptions = new HashMap<>(); var desiredCapabilities = mockDesiredCapabilities(null, sauceOptions); - var sauceConnectOptions = new SauceConnectOptions(true, REST_URL, null, Set.of()); + var sauceConnectOptions = new SauceConnectOptions(true, DATA_CENTER, null, Set.of()); when(sauceConnectManager.start(sauceConnectOptions)).thenReturn(TUNNEL_NAME); configurer.configure(desiredCapabilities); @@ -118,7 +118,7 @@ void shouldStartSauceConnectWhenSauceConnectIsDisabledButProxyIsStarted() var httpProxy = "http-proxy:8080"; when(proxy.getHttpProxy()).thenReturn(httpProxy); - var sauceConnectOptions = new SauceConnectOptions(true, REST_URL, CUSTOM_ARGS, SKIP_HOST_GLOB_PATTERNS); + var sauceConnectOptions = new SauceConnectOptions(true, DATA_CENTER, CUSTOM_ARGS, SKIP_HOST_GLOB_PATTERNS); sauceConnectOptions.setProxy(httpProxy); Map sauceOptions = new HashMap<>(); @@ -146,7 +146,8 @@ void shouldCreateOptions(Set setValue, Set expectedValue) { configurer.setSauceConnectArguments(CUSTOM_ARGS); configurer.setSkipHostGlobPatterns(setValue); - assertEquals(new SauceConnectOptions(true, REST_URL, CUSTOM_ARGS, expectedValue), configurer.createOptions()); + assertEquals(new SauceConnectOptions(true, DATA_CENTER, CUSTOM_ARGS, expectedValue), + configurer.createOptions()); } private void mockRunningStory() From 755d7f3e6b0e1c0175a63eeca970ec425a51c507 Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sun, 5 Jan 2025 14:05:25 +0200 Subject: [PATCH 08/10] Try to change `tls-passthrough-domains` option --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 927a3db972..71f8ea45a5 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -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 allow --tls-passthrough-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 @@ -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 allow --tls-passthrough-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 @@ -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 allow --tls-passthrough-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 From 6c10cb73343d1030c20d6e0a8893c70dc63c6d3f Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sun, 5 Jan 2025 15:09:40 +0300 Subject: [PATCH 09/10] `--tunnel-name` option is required now --- .../selenium/sauce/SauceConnectOptions.java | 15 +++++++-------- .../sauce/SauceConnectOptionsTests.java | 19 ++++++------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java b/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java index e580f4b4f5..ad33e2fcd6 100644 --- a/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java +++ b/vividus-plugin-saucelabs/src/main/java/org/vividus/selenium/sauce/SauceConnectOptions.java @@ -27,7 +27,6 @@ import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; -import java.util.stream.Stream; import com.saucelabs.saucerest.DataCenter; @@ -73,11 +72,8 @@ public String build(String tunnelName) throws IOException { StringBuilder options = Optional.ofNullable(customArguments).map(args -> new StringBuilder(args).append(' ')) .orElseGet(StringBuilder::new); + appendOption(options, "tunnel-name", tunnelName); appendOption(options, "region", dataCenter.name().toLowerCase(Locale.ROOT).replace('_', '-')); - if (tunnelName != null) - { - appendOption(options, "tunnel-name", tunnelName); - } if (getProxy() != null) { @@ -88,7 +84,7 @@ public String build(String tunnelName) throws IOException appendOption(options, "pac", pacFileUrl); } - appendOption(options, "tunnel-pool"); + appendOption(options, "tunnel-pool", null); return options.substring(0, options.length() - 1); } @@ -105,10 +101,13 @@ private String getSkipShExpMatcher() .collect(Collectors.joining(" || ")); } - 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 diff --git a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java index bd199d7ed1..e7177a3e60 100644 --- a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java +++ b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java @@ -72,7 +72,7 @@ void testBuildWithProxy() throws IOException { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); - assertEquals(REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, + assertEquals(TUNNEL_NAME_OPTION + SPACE + REGION_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -87,7 +87,7 @@ void testBuildWithProxyForLatestSauceConnect() throws IOException Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); assertEquals( - REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + (SystemUtils.IS_OS_WINDOWS ? "/" + TUNNEL_NAME_OPTION + SPACE + REGION_OPTION + SPACE + PAC_FILE + (SystemUtils.IS_OS_WINDOWS ? "/" : "") + pacPath + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -102,7 +102,7 @@ void testBuildWithProxyWindowsPathDelimiters() throws IOException Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); when(pacPath.toString()).thenReturn("c:\\user\\temp.js"); - assertEquals(REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + "c:/user/temp.js" + SPACE + assertEquals(TUNNEL_NAME_OPTION + SPACE + REGION_OPTION + SPACE + PAC_FILE + "c:/user/temp.js" + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -116,7 +116,7 @@ void testBuildWithProxyWithAuth() throws IOException { Path pacPath = mockPac(resources, DEFAULT_MATCH_CHAIN); - assertEquals(customFlags + SPACE + REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + assertEquals(customFlags + SPACE + TUNNEL_NAME_OPTION + SPACE + REGION_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -133,7 +133,7 @@ void testBuildWithProxyWithSkipHostsPattern() throws IOException + "\"*.vividus.dev\") || shExpMatch(host, \"example.com\") || shExpMatch(host, \"saucelabs.com\")"; Path pacPath = mockPac(resources, matchCondition); - assertEquals(REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, + assertEquals(TUNNEL_NAME_OPTION + SPACE + REGION_OPTION + SPACE + PAC_FILE + pacPath + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } } @@ -142,17 +142,10 @@ void testBuildWithProxyWithSkipHostsPattern() throws IOException void testBuildWOProxy() throws IOException { SauceConnectOptions sauceConnectOptions = createEmptyOptions(); - assertEquals(REGION_OPTION + SPACE + TUNNEL_NAME_OPTION + SPACE + TUNNEL_POOL, + assertEquals(TUNNEL_NAME_OPTION + SPACE + REGION_OPTION + SPACE + TUNNEL_POOL, sauceConnectOptions.build(TUNNEL_NAME)); } - @Test - void testBuildWOProxyNullOption() throws IOException - { - SauceConnectOptions sauceConnectOptions = createEmptyOptions(); - assertEquals(REGION_OPTION + SPACE + TUNNEL_POOL, sauceConnectOptions.build(null)); - } - @Test void testHashCode() { From 161f818b85061b6dade632efe272fee6d8a15c77 Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Sun, 5 Jan 2025 15:33:14 +0300 Subject: [PATCH 10/10] Polish unit tests --- .../vividus/selenium/sauce/SauceConnectOptionsTests.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java index e7177a3e60..e8542d4fe0 100644 --- a/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java +++ b/vividus-plugin-saucelabs/src/test/java/org/vividus/selenium/sauce/SauceConnectOptionsTests.java @@ -39,8 +39,6 @@ class SauceConnectOptionsTests { private static final String SPACE = " "; private static final String PAC_FILE = "--pac file://"; - private static final String DOT_JS = ".js"; - private static final String PAC_TEST_TUNNEL = "pac-saucelabs-test-tunnel"; private static final String PROXY = "test"; private static final String TUNNEL_NAME = "test-tunnel"; private static final String TUNNEL_NAME_OPTION = "--tunnel-name" + SPACE + TUNNEL_NAME; @@ -48,7 +46,7 @@ class SauceConnectOptionsTests private static final DataCenter DATA_CENTER = DataCenter.US_WEST; private static final String REGION = "us-west"; private static final String REGION_OPTION = "--region" + SPACE + REGION; - private static final String DEFAULT_CUSTOM_ARGS = "--verbose"; + private static final String DEFAULT_CUSTOM_ARGS = "--log-level debug"; private static final Set DEFAULT_SKIP_GLOB_HOST_PATTERNS = Set.of("vividus.dev"); private static final String DEFAULT_MATCH_CHAIN = "shExpMatch(host, \"*.api.testobject.com\") || " + "shExpMatch(host, \"*.miso.saucelabs.com\") || shExpMatch(host, \"*.saucelabs.com\") || " @@ -222,8 +220,8 @@ private static SauceConnectOptions createOptions(DataCenter dataCenter, String c private Path mockPac(MockedStatic mock, String matchCondition) { Path pacPath = mock(Path.class); - mock.when(() -> ResourceUtils.createTempFile(PAC_TEST_TUNNEL, DOT_JS, String.format(PAC_DATA, matchCondition))) - .thenReturn(pacPath); + mock.when(() -> ResourceUtils.createTempFile("pac-saucelabs-test-tunnel", ".js", + String.format(PAC_DATA, matchCondition))).thenReturn(pacPath); return pacPath; } }