Skip to content

Commit 58cfb2e

Browse files
authored
Merge branch 'trunk' into rb_add_argument_for_websocket_port
2 parents 360c7b6 + 265df15 commit 58cfb2e

File tree

14 files changed

+609
-24
lines changed

14 files changed

+609
-24
lines changed

.github/workflows/pre-release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,19 @@ jobs:
9797
**Warning: Manually update the changelogs before merging**
9898
9999
This PR:
100-
* Updates Rust version for Selenium Manager release
101100
* Updates Pinned browser version to coincide with new CDP release
102101
* Adds support for new CDP version and removes old CDP version
103102
* Selenium Manager references the new Selenium Manager release
104103
* Updates Maven Dependencies
105104
* Adds new authors to authors file
106105
* Updates all versions for all bindings
107106
* Generates *rough* change logs for each bindings (please tidy them up before merging this)
107+
* Not all commits need to be in the change log — users do not need to see anything about building or testing Selenium
108+
* Remove references to updating versions including nightly
109+
* The code now outputs the complete body of the commit message; make sure the changelog message is complete and correct
108110
109-
- Auto-generated by [create-pull-request][1]
111+
- This PR was auto-generated by workflow run: [release-preparation][1]
110112
111-
[1]: https://github.com/peter-evans/create-pull-request
113+
[1]: https://github.com/SeleniumHQ/selenium/actions/runs/${{ github.run_id }}
112114
labels: C-build
113115
draft: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ for Maven to use locally by deploying to your local maven repository (`~/.m2/rep
201201

202202
#### Updating Dependencies
203203

204-
Dependencies are defined in the file [maven_deps.bzl](https://github.com/SeleniumHQ/selenium/blob/trunk/java/maven_deps.bzl).
204+
Dependencies are defined in the file [MODULE.bazel](https://github.com/SeleniumHQ/selenium/blob/trunk/MODULE.bazel).
205205
To automatically update and pin new dependencies, run:
206206

207207
```shell

Rakefile

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def verify_java_release_targets
129129
current_targets = []
130130

131131
Bazel.execute('query', [], query) do |output|
132-
current_targets = output.lines.map(&:strip).reject(&:empty?)
132+
current_targets = output.lines.map(&:strip).reject(&:empty?).select { |line| line.start_with?('//') }
133133
end
134134

135135
missing_targets = current_targets - JAVA_RELEASE_TARGETS
@@ -1110,34 +1110,38 @@ namespace :all do
11101110
commit!('Update selenium manager version', ['common/selenium_manager.bzl'])
11111111

11121112
Rake::Task['java:update'].invoke
1113-
commit!('Update Maven Dependencies', ['java/maven_deps.bzl', 'java/maven_install.json'])
1113+
commit!('Update Maven Dependencies', ['MODULE.bazel', 'java/maven_install.json'])
11141114

11151115
Rake::Task['authors'].invoke
11161116
commit!('Update authors file', ['AUTHORS'])
11171117

11181118
# Note that this does not include Rust version changes that are handled in separate rake:version task
11191119
# TODO: These files are all defined in other tasks; remove duplication
11201120
Rake::Task['all:version'].invoke(version)
1121-
commit!("FIX CHANGELOGS BEFORE MERGING!\n\nUpdate versions and change logs to release Selenium #{java_version}",
1122-
['dotnet/CHANGELOG',
1123-
'dotnet/selenium-dotnet-version.bzl',
1124-
'java/CHANGELOG',
1121+
commit!("Update Version in all bindings to #{java_version}",
1122+
['dotnet/selenium-dotnet-version.bzl',
11251123
'java/version.bzl',
1126-
'javascript/node/selenium-webdriver/CHANGES.md',
1124+
'javascript/node/selenium-webdriver/BUILD.bazel',
11271125
'javascript/node/selenium-webdriver/package.json',
11281126
'py/docs/source/conf.py',
1127+
'py/pyproject.toml',
11291128
'py/selenium/__init__.py',
11301129
'py/selenium/webdriver/__init__.py',
11311130
'py/BUILD.bazel',
1132-
'py/CHANGES',
11331131
'rb/lib/selenium/webdriver/version.rb',
1134-
'rb/CHANGES',
11351132
'rb/Gemfile.lock',
1136-
'rust/CHANGELOG.md',
11371133
'rust/BUILD.bazel',
11381134
'rust/Cargo.Bazel.lock',
11391135
'rust/Cargo.toml',
11401136
'rust/Cargo.lock'])
1137+
1138+
commit!("FIX CHANGELOGS BEFORE MERGING! #{java_version}",
1139+
['dotnet/CHANGELOG',
1140+
'java/CHANGELOG',
1141+
'javascript/node/selenium-webdriver/CHANGES.md',
1142+
'py/CHANGES',
1143+
'rb/CHANGES',
1144+
'rust/CHANGELOG.md'])
11411145
end
11421146

11431147
desc 'Update all versions'
@@ -1214,16 +1218,25 @@ end
12141218

12151219
def update_changelog(version, language, path, changelog, header)
12161220
tag = previous_tag(version, language)
1217-
log = if language == 'javascript'
1218-
`git --no-pager log #{tag}...HEAD --pretty=format:"- %s" --reverse #{path}`
1219-
else
1220-
`git --no-pager log #{tag}...HEAD --pretty=format:"* %s" --reverse #{path}`
1221-
end
1222-
commits = log.split('>>>').map { |entry|
1223-
lines = entry.split("\n")
1224-
lines.reject! { |line| line.match?(/^(----|Co-authored|Signed-off)/) || line.empty? }
1225-
lines.join("\n")
1226-
}.join("\n>>>")
1221+
bullet = language == 'javascript' ? '- ' : '* '
1222+
commit_delimiter = '===DELIM==='
1223+
tags_to_remove = /\[(dotnet|rb|py|java|js|rust)\]:?\s?/
1224+
1225+
command = "git --no-pager log #{tag}...HEAD --pretty=format:\"%s%n%b#{commit_delimiter}\" --reverse #{path}"
1226+
puts "Executing git command: #{command}"
1227+
1228+
log = `#{command}`
1229+
1230+
commits = log.split(commit_delimiter).map { |commit|
1231+
lines = commit.gsub(tags_to_remove, '').strip.lines.map(&:chomp)
1232+
subject = "#{bullet}#{lines[0]}"
1233+
1234+
body = lines[1..]
1235+
.reject { |line| line.match?(/^(----|Co-authored|Signed-off)/) || line.empty? }
1236+
.map { |line| " > #{line}" }
1237+
.join("\n")
1238+
body.empty? ? subject : "#{subject}\n#{body}"
1239+
}.join("\n")
12271240

12281241
File.open(changelog, 'r+') do |file|
12291242
new_content = "#{header}\n#{commits}\n\n#{file.read}"

java/src/org/openqa/selenium/bidi/module/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ java_library(
2222
"//java/src/org/openqa/selenium/bidi/browsingcontext",
2323
"//java/src/org/openqa/selenium/bidi/log",
2424
"//java/src/org/openqa/selenium/bidi/network",
25+
"//java/src/org/openqa/selenium/bidi/permissions",
2526
"//java/src/org/openqa/selenium/bidi/script",
2627
"//java/src/org/openqa/selenium/bidi/storage",
2728
"//java/src/org/openqa/selenium/json",
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package org.openqa.selenium.bidi.module;
19+
20+
import java.util.HashMap;
21+
import java.util.Map;
22+
import org.openqa.selenium.WebDriver;
23+
import org.openqa.selenium.bidi.BiDi;
24+
import org.openqa.selenium.bidi.Command;
25+
import org.openqa.selenium.bidi.HasBiDi;
26+
import org.openqa.selenium.bidi.permissions.PermissionState;
27+
import org.openqa.selenium.internal.Require;
28+
29+
public class Permission {
30+
31+
private final BiDi bidi;
32+
33+
public Permission(WebDriver driver) {
34+
Require.nonNull("WebDriver", driver);
35+
36+
if (!(driver instanceof HasBiDi)) {
37+
throw new IllegalArgumentException("WebDriver instance must support BiDi protocol");
38+
}
39+
40+
this.bidi = ((HasBiDi) driver).getBiDi();
41+
}
42+
43+
public void setPermission(
44+
Map<String, String> permissionDescriptor, PermissionState state, String origin) {
45+
this.setPermission(permissionDescriptor, state, origin, null);
46+
}
47+
48+
public void setPermission(
49+
Map<String, String> permissionDescriptor,
50+
PermissionState state,
51+
String origin,
52+
String userContext) {
53+
Require.nonNull("Permission descriptor", permissionDescriptor);
54+
Require.nonNull("Permission state", state);
55+
Require.nonNull("Origin", origin);
56+
57+
Map<String, Object> params =
58+
new HashMap<>(
59+
Map.of(
60+
"descriptor", permissionDescriptor,
61+
"state", state.toString(),
62+
"origin", origin));
63+
64+
if (userContext != null) {
65+
params.put("userContext", userContext);
66+
}
67+
68+
this.bidi.send(new Command<>("permissions.setPermission", params));
69+
}
70+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
load("//java:defs.bzl", "java_library")
2+
3+
java_library(
4+
name = "permissions",
5+
srcs = glob(
6+
[
7+
"*.java",
8+
],
9+
),
10+
visibility = [
11+
"//java/src/org/openqa/selenium/bidi:__subpackages__",
12+
"//java/src/org/openqa/selenium/firefox:__subpackages__",
13+
"//java/src/org/openqa/selenium/remote:__pkg__",
14+
"//java/test/org/openqa/selenium/bidi:__subpackages__",
15+
"//java/test/org/openqa/selenium/grid:__subpackages__",
16+
],
17+
)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package org.openqa.selenium.bidi.permissions;
19+
20+
public enum PermissionState {
21+
GRANTED("granted"),
22+
DENIED("denied"),
23+
PROMPT("prompt");
24+
25+
private final String state;
26+
27+
PermissionState(String state) {
28+
this.state = state;
29+
}
30+
31+
@Override
32+
public String toString() {
33+
return state;
34+
}
35+
36+
public static PermissionState findByName(String name) {
37+
PermissionState result = null;
38+
for (PermissionState state : values()) {
39+
if (state.toString().equalsIgnoreCase(name)) {
40+
result = state;
41+
break;
42+
}
43+
}
44+
return result;
45+
}
46+
}

java/src/org/openqa/selenium/remote/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ java_export(
3131
"//java/src/org/openqa/selenium/bidi/log",
3232
"//java/src/org/openqa/selenium/bidi/module",
3333
"//java/src/org/openqa/selenium/bidi/network",
34+
"//java/src/org/openqa/selenium/bidi/permissions",
3435
"//java/src/org/openqa/selenium/bidi/script",
3536
"//java/src/org/openqa/selenium/bidi/storage",
3637
"//java/src/org/openqa/selenium/devtools",

java/test/org/openqa/selenium/bidi/input/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ java_selenium_test_suite(
2222
"//java/src/org/openqa/selenium/bidi/log",
2323
"//java/src/org/openqa/selenium/bidi/module",
2424
"//java/src/org/openqa/selenium/bidi/network",
25+
"//java/src/org/openqa/selenium/bidi/permissions",
2526
"//java/src/org/openqa/selenium/bidi/script",
2627
"//java/src/org/openqa/selenium/chrome",
2728
"//java/src/org/openqa/selenium/firefox",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
load("//java:defs.bzl", "JUNIT5_DEPS", "java_selenium_test_suite")
3+
4+
java_selenium_test_suite(
5+
name = "large-tests",
6+
size = "large",
7+
srcs = glob(["*Test.java"]),
8+
browsers = [
9+
"firefox",
10+
],
11+
data = [
12+
"//third_party/chrome_ext:backspace.crx",
13+
],
14+
tags = [
15+
"selenium-remote",
16+
],
17+
deps = [
18+
"//java/src/org/openqa/selenium/bidi",
19+
"//java/src/org/openqa/selenium/bidi/browsingcontext",
20+
"//java/src/org/openqa/selenium/bidi/log",
21+
"//java/src/org/openqa/selenium/bidi/module",
22+
"//java/src/org/openqa/selenium/bidi/network",
23+
"//java/src/org/openqa/selenium/bidi/script",
24+
"//java/src/org/openqa/selenium/chrome",
25+
"//java/src/org/openqa/selenium/firefox",
26+
"//java/src/org/openqa/selenium/json",
27+
"//java/src/org/openqa/selenium/remote",
28+
"//java/src/org/openqa/selenium/support",
29+
"//java/test/org/openqa/selenium:helpers",
30+
"//java/test/org/openqa/selenium/build",
31+
"//java/test/org/openqa/selenium/environment",
32+
"//java/test/org/openqa/selenium/testing:annotations",
33+
"//java/test/org/openqa/selenium/testing:test-base",
34+
"//java/test/org/openqa/selenium/testing/drivers",
35+
artifact("org.junit.jupiter:junit-jupiter-api"),
36+
artifact("org.assertj:assertj-core"),
37+
artifact("org.mockito:mockito-core"),
38+
] + JUNIT5_DEPS,
39+
)

0 commit comments

Comments
 (0)