Skip to content

Commit 55027c3

Browse files
committed
Merge remote-tracking branch 'upstream/trunk' into dotnet-logging-issue
2 parents 636b523 + ea73d44 commit 55027c3

File tree

26 files changed

+372
-162
lines changed

26 files changed

+372
-162
lines changed

.bazelrc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import .bazelrc.remote
2-
try-import .bazelrc.local
3-
try-import .bazelrc.windows.local
1+
try-import %workspace%/.bazelrc.local
2+
try-import %workspace%/.bazelrc.windows.local
43

54
# Enable bzlmod but without lockfile for a moment.
65
# Lockfile is a problem to check in at the moment
@@ -103,3 +102,6 @@ test:ruby_debug --test_output=streamed --test_env=RUBY_DEBUG_FORK_MODE=parent --
103102
build:release --config=remote
104103
build:release --stamp
105104
build:release --remote_download_outputs=toplevel
105+
106+
# RBE
107+
import %workspace%/.bazelrc.remote

.github/workflows/bazel.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ on:
4646
required: false
4747
type: string
4848
default: ''
49+
node-version:
50+
description: Custom Node version to install
51+
required: false
52+
type: string
53+
default: ''
4954
ruby-version:
5055
description: Custom Ruby version to use
5156
required: false
@@ -72,6 +77,7 @@ jobs:
7277
SEL_M2_PASS: ${{ secrets.SEL_M2_PASS }}
7378
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
7479
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
80+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7581
SE_AVOID_STATS: true
7682
steps:
7783
- name: Checkout source tree
@@ -103,6 +109,11 @@ jobs:
103109
with:
104110
java-version: ${{ inputs.java-version }}
105111
distribution: 'temurin'
112+
- name: Setup Node
113+
if: inputs.node-version != ''
114+
uses: actions/setup-node@v4
115+
with:
116+
node-version: ${{ inputs.node-version }}
106117
- name: Setup Bazel with caching
107118
if: inputs.caching
108119
uses: bazel-contrib/[email protected]

.github/workflows/ci-javascript.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,19 @@ jobs:
1212
name: Build
1313
cache-key: javascript-build
1414
run: bazel build //javascript/node/selenium-webdriver:selenium-webdriver
15+
16+
small-tests:
17+
name: Small Tests
18+
needs: build
19+
uses: ./.github/workflows/bazel.yml
20+
with:
21+
name: Small Tests
22+
cache-key: javascript-small-tests
23+
run: bazel test //javascript/node/selenium-webdriver:small-tests
24+
1525
browser-tests:
1626
name: Browser Tests
17-
needs: build
27+
needs: small-tests
1828
uses: ./.github/workflows/bazel.yml
1929
strategy:
2030
fail-fast: false
@@ -25,7 +35,8 @@ jobs:
2535
with:
2636
name: Browser Tests (${{ matrix.browser }})
2737
browser: ${{ matrix.browser }}
28-
cache-key: node
29-
run: |
30-
export SELENIUM_BROWSER=${{ matrix.browser }}
31-
bazel test --flaky_test_attempts 3 //javascript/node/selenium-webdriver:${{matrix.browser}}-browser-tests
38+
cache-key: javascript-${{matrix.browser}}-browser-tests
39+
run: >
40+
bazel test
41+
--flaky_test_attempts 3
42+
//javascript/node/selenium-webdriver:${{ matrix.browser }}-browser-tests

.github/workflows/nightly.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
- python
2121
- grid
2222
- dotnet
23+
- javascript
2324

2425
jobs:
2526
ruby:
@@ -89,3 +90,21 @@ jobs:
8990
echo build --stamp >>.bazelrc.local
9091
./go java-release-zip
9192
nightly-release-files: build/dist/*.*
93+
94+
javascript:
95+
if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'javascript' || github.event_name == 'schedule')
96+
name: DotNet
97+
uses: ./.github/workflows/bazel.yml
98+
with:
99+
name: Nightly JavaScript Release
100+
cache-key: javascript-nightly
101+
node-version: '18.x'
102+
run: |
103+
sed -i 's|https://registry.npmjs.org/|https://npm.pkg.github.com|g' javascript/node/selenium-webdriver/package.json
104+
sed -i 's|"name": "selenium-webdriver"|"name": "@seleniumhq/selenium-webdriver"|g' javascript/node/selenium-webdriver/package.json
105+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
106+
echo "@seleniumhq:registry=https://npm.pkg.github.com" >> .npmrc
107+
echo "always-auth=true" >> .npmrc
108+
./go "node:version[nightly]"
109+
./go node:release
110+
secrets: inherit

MODULE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ ruby.bundle_fetch(
255255
"diff-lcs-1.5.1": "273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe",
256256
"drb-2.2.1": "e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340",
257257
"ffi-1.16.3": "6d3242ff10c87271b0675c58d68d3f10148fabc2ad6da52a18123f06078871fb",
258+
"ffi-1.16.3-java": "6f107fcd7c96f9c96f7e57db749b99502cc2f65665f7b2241d087a8f8c01d42c",
258259
"ffi-1.16.3-x64-mingw32": "6ec709011e3955e97033fa77907a8ab89a9150137d4c45c82c77399b909c9259",
259260
"fileutils-1.7.2": "36a0fb324218263e52b486ad7408e9a295378fe8edc9fd343709e523c0980631",
260261
"git-1.19.1": "b0a422d9f6517353c48a330d6114de4db9e0c82dbe7202964a1d9f1fbc827d70",
@@ -263,6 +264,7 @@ ruby.bundle_fetch(
263264
"io-console-0.7.2": "f0dccff252f877a4f60d04a4dc6b442b185ebffb4b320ab69212a92b48a7a221",
264265
"io-console-0.7.2-java": "73aa382f8832b116613ceaf57b8ff5bf73dfedcaf39f0aa5420e10f63a4543ed",
265266
"irb-1.12.0": "07634937fbb7d28d07e46da50d0aa43b4d2f7258174d08de4e32dfb57c10539d",
267+
"jar-dependencies-0.4.1": "b2df2f1ecbff15334ce20ea7fdd5b8d8161faab67761ff72c7647d728e40d387",
266268
"json-2.7.1": "187ea312fb58420ff0c40f40af1862651d4295c8675267c6a1c353f1a0ac3265",
267269
"json-2.7.1-java": "bfd628c0f8357058c2cf848febfa6f140f70f94ec492693a31a0a1933038a61b",
268270
"language_server-protocol-3.17.0.3": "3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f",

Rakefile

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ namespace :node do
496496
end
497497

498498
task :'dry-run' do
499-
Bazel.execute('run', ['--stamp'], '//javascript/node/selenium-webdriver:selenium-webdriver.pack')
499+
Bazel.execute('run', ['--stamp'], '//javascript/node/selenium-webdriver:selenium-webdriver.publish -- --dry-run=true')
500500
end
501501

502502
desc 'Release Node npm package'
@@ -520,16 +520,43 @@ namespace :node do
520520

521521
desc 'Update Node version'
522522
task :version, [:version] do |_task, arguments|
523+
bump_nightly = arguments[:version] === 'nightly'
523524
old_version = node_version
524-
new_version = updated_version(old_version, arguments[:version])
525+
new_version = nil
526+
527+
# There are three cases we want to deal with:
528+
# 1. Switching from a release build to a nightly one
529+
# 2. Updating a nightly build for the next nightly build
530+
# 3. Switching from nightlies to a release build.
531+
532+
if bump_nightly && old_version.include?('-nightly')
533+
# This is the case where we are updating a nightly build to the next nightly build.
534+
# This change is usually done by the CI system and never committed.
535+
# The "-nightlyYmdHM" is removed to add a new timestamp.
536+
new_version = old_version.gsub(/\-nightly\d+$/, '') + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
537+
elsif bump_nightly
538+
# This is the case after a production release and the version number is configured
539+
# to start doing nightly builds.
540+
new_version = old_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
541+
else
542+
if old_version.include?('-nightly')
543+
# From a nightly build to a release build.
544+
new_version = old_version.gsub(/\-nightly\d+$/, '')
545+
else
546+
# From a release build to a nightly build. We use npm version for this.
547+
new_version = updated_version(old_version.gsub(/\-nightly\d+$/, ''), arguments[:version])
548+
new_version = new_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
549+
end
550+
end
525551

526552
['javascript/node/selenium-webdriver/package.json',
527-
'package-lock.json'].each do |file|
553+
'package-lock.json',
554+
'javascript/node/selenium-webdriver/BUILD.bazel'].each do |file|
528555
text = File.read(file).gsub(old_version, new_version)
529556
File.open(file, "w") { |f| f.puts text }
530557
end
531558

532-
Rake::Task['node:changelog'].invoke
559+
Rake::Task['node:changelog'].invoke unless new_version.include?('-nightly') || bump_nightly
533560
end
534561
end
535562

java/src/org/openqa/selenium/bidi/module/Network.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void onResponseCompleted(Consumer<ResponseDetails> consumer) {
165165
if (browsingContextIds.isEmpty()) {
166166
this.bidi.addListener(responseCompleted, consumer);
167167
} else {
168-
this.bidi.addListener(browsingContextIds, responseStarted, consumer);
168+
this.bidi.addListener(browsingContextIds, responseCompleted, consumer);
169169
}
170170
}
171171

java/src/org/openqa/selenium/grid/node/relay/RelayFlags.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ public class RelayFlags implements HasRoles {
8484
@ConfigValue(section = RELAY_SECTION, name = "status-endpoint", example = "\"/status\"")
8585
private String serviceStatusEndpoint;
8686

87+
@Parameter(
88+
names = {"--service-protocol-version"},
89+
description =
90+
"Enforce a specific protocol version in HttpClient when communicating with the endpoint"
91+
+ " service status")
92+
@ConfigValue(section = RELAY_SECTION, name = "protocol-version", example = "\"HTTP/1.1\"")
93+
private String serviceProtocolVersion;
94+
8795
@Override
8896
public Set<Role> getRoles() {
8997
return Collections.singleton(NODE_ROLE);

java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.common.collect.Multimap;
2626
import java.net.URI;
2727
import java.net.URISyntaxException;
28+
import java.net.http.HttpClient.Version;
2829
import java.time.Duration;
2930
import java.util.Collection;
3031
import java.util.List;
@@ -103,6 +104,27 @@ public URI getServiceStatusUri() {
103104
}
104105
}
105106

107+
public String getServiceProtocolVersion() {
108+
String rawProtocolVersion = config.get(RELAY_SECTION, "protocol-version").orElse("");
109+
String protocolVersion = rawProtocolVersion;
110+
if (protocolVersion.isEmpty()) {
111+
return protocolVersion;
112+
} else {
113+
protocolVersion = normalizeProtocolVersion(protocolVersion);
114+
}
115+
try {
116+
return Version.valueOf(protocolVersion).toString();
117+
} catch (IllegalArgumentException e) {
118+
LOG.info("Unsupported protocol version: " + protocolVersion);
119+
throw new ConfigException("Unsupported protocol version provided: " + rawProtocolVersion, e);
120+
}
121+
}
122+
123+
private String normalizeProtocolVersion(String protocolVersion) {
124+
// Support input in the form of "http/1.1" or "HTTP/1.1"
125+
return protocolVersion.toUpperCase().replaceAll("/", "_").replaceAll("\\.", "_");
126+
}
127+
106128
// Method being used in SessionSlot
107129
@SuppressWarnings("unused")
108130
private boolean isServiceUp(HttpClient client) {
@@ -160,6 +182,7 @@ public Map<Capabilities, Collection<SessionFactory>> getSessionFactories(
160182
sessionTimeout,
161183
getServiceUri(),
162184
getServiceStatusUri(),
185+
getServiceProtocolVersion(),
163186
immutable));
164187
}
165188
LOG.info(String.format("Mapping %s, %d times", immutable, maxSessions));

java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public class RelaySessionFactory implements SessionFactory {
7676
private final Duration sessionTimeout;
7777
private final URL serviceUrl;
7878
private final URL serviceStatusUrl;
79+
private final String serviceProtocolVersion;
7980
private final Capabilities stereotype;
8081

8182
public RelaySessionFactory(
@@ -84,12 +85,15 @@ public RelaySessionFactory(
8485
Duration sessionTimeout,
8586
URI serviceUri,
8687
URI serviceStatusUri,
88+
String serviceProtocolVersion,
8789
Capabilities stereotype) {
8890
this.tracer = Require.nonNull("Tracer", tracer);
8991
this.clientFactory = Require.nonNull("HTTP client", clientFactory);
9092
this.sessionTimeout = Require.nonNull("Session timeout", sessionTimeout);
9193
this.serviceUrl = createUrlFromUri(Require.nonNull("Service URL", serviceUri));
9294
this.serviceStatusUrl = createUrlFromUri(serviceStatusUri);
95+
this.serviceProtocolVersion =
96+
Require.nonNull("Service protocol version", serviceProtocolVersion);
9397
this.stereotype = ImmutableCapabilities.copyOf(Require.nonNull("Stereotype", stereotype));
9498
}
9599

@@ -209,7 +213,12 @@ public boolean isServiceUp() {
209213
// If no status endpoint was configured, we assume the server is up.
210214
return true;
211215
}
212-
try (HttpClient client = clientFactory.createClient(serviceStatusUrl)) {
216+
217+
ClientConfig clientConfig = ClientConfig.defaultConfig().baseUrl(serviceStatusUrl);
218+
if (!serviceProtocolVersion.isEmpty()) {
219+
clientConfig = clientConfig.version(serviceProtocolVersion);
220+
}
221+
try (HttpClient client = clientFactory.createClient(clientConfig)) {
213222
HttpResponse response =
214223
client.execute(new HttpRequest(HttpMethod.GET, serviceStatusUrl.toString()));
215224
LOG.log(Debug.getDebugLogLevel(), () -> Contents.string(response));

0 commit comments

Comments
 (0)