Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
836894c
[rb] generate the BiDi protocol layer from the shared binding-neutral…
titusfortner Jun 29, 2026
45c6cd3
[rb] simplify BiDi value construction and move Union combination vali…
titusfortner Jun 30, 2026
c155ac0
[rb] reject a non-nullable field set to nil at construction
titusfortner Jun 30, 2026
64e9f1a
[rb] parse nested RemoteValues inside object/map results
titusfortner Jun 30, 2026
2fdaa9c
[rb] rename Serialization::Data to Serialization::Record to avoid ::D…
titusfortner Jun 30, 2026
d5372e8
[rb] add Protocol::Domain base so generated classes share the transpo…
titusfortner Jun 30, 2026
88ef296
[rb] split BiDi generated-layer specs into serialization and protocol
titusfortner Jul 1, 2026
4f665d3
[rb] resolve the BiDi transport from a driver or bridge, with integra…
titusfortner Jul 1, 2026
d02dbbc
[rb] allow BiDi domains to be constructed with either Transport or Dr…
titusfortner Jul 1, 2026
e1b8746
[rb] accept BiDi enum values as symbols, round-tripping symbol-in/sym…
titusfortner Jul 1, 2026
570cdb4
[rb] make BiDi inbound enum and variant parsing strict, raising on un…
titusfortner Jul 1, 2026
2adb4f7
[rb] correct stale serialization comments after strict inbound parsing
titusfortner Jul 1, 2026
1afbccd
[rb] validate inbound nullability and list shape, expose BiDi socket …
titusfortner Jul 1, 2026
dfe3025
[rb] add a test that checked-in BiDi protocol code matches the genera…
titusfortner Jul 2, 2026
89680d0
[rb] reject a scalar for a list-typed BiDi field, and fix review nits…
titusfortner Jul 3, 2026
ef75736
[rb] resolve the verify test schema via rootpath so it is runfiles-sa…
titusfortner Jul 3, 2026
a062f1c
[rb] validate scalar BiDi enums without coercing enumerables, and req…
titusfortner Jul 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
bazel test
--keep_going
--test_size_filters small
//rb/spec/...
//rb/...

smoke:
name: ${{ matrix.os }}-smoke
Expand Down
7 changes: 7 additions & 0 deletions rb/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Metrics/ClassLength:
Exclude:
- 'lib/selenium/webdriver/remote/bridge.rb'
- 'lib/selenium/webdriver/remote/capabilities.rb'
- 'lib/selenium/webdriver/bidi/support/bidi_generate.rb'
- 'lib/selenium/webdriver/bidi/protocol/**/*'
- 'spec/integration/selenium/webdriver/spec_support/test_environment.rb'

Metrics/CyclomaticComplexity:
Expand All @@ -64,6 +66,7 @@ Metrics/ModuleLength:
Max: 110
Exclude:
- 'lib/selenium/webdriver/common/platform.rb'
- 'lib/selenium/webdriver/bidi/support/bidi_generate.rb'
- 'spec/**/*'

Metrics/PerceivedComplexity:
Expand All @@ -77,6 +80,10 @@ Metrics/ParameterLists:
Naming/BlockForwarding:
EnforcedStyle: explicit

Naming/AccessorMethodName:
Exclude:
- 'lib/selenium/webdriver/bidi/protocol/**/*'

Naming/FileName:
Exclude:
- 'lib/selenium-webdriver.rb'
Expand Down
12 changes: 10 additions & 2 deletions rb/Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ target :lib do

# Total amount of errors ignore 64 in 29 files
ignore(
# Ignore all files in the bidi directory until we decide the implementation
'lib/selenium/webdriver/bidi/**/*.rb',
# Ignore all hand-written files in the bidi directory while we update the implementation
'lib/selenium/webdriver/bidi/network/**/*.rb',
'lib/selenium/webdriver/bidi/browser.rb',
'lib/selenium/webdriver/bidi/browsing_context.rb',
'lib/selenium/webdriver/bidi/log_handler.rb',
'lib/selenium/webdriver/bidi/network.rb',
'lib/selenium/webdriver/bidi/session.rb',
'lib/selenium/webdriver/bidi/struct.rb',
# The generator + its up-to-date checker are build tooling, not typed runtime code
'lib/selenium/webdriver/bidi/support/**/*.rb',
# Ignore all spec files
'spec/**/*.rb',
# Ignore line 166 due to UDP RBS issue
Expand Down
36 changes: 36 additions & 0 deletions rb/lib/selenium/webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
load(
"@rules_ruby//ruby:defs.bzl",
"rb_binary",
"rb_library",
"rb_test",
)

package(default_visibility = ["//rb:__subpackages__"])
Expand All @@ -24,6 +26,40 @@ rb_library(
deps = [":common"],
)

rb_binary(
name = "bidi-generate",
srcs = ["bidi/support/bidi_generate.rb"],
args = [
"$(location //javascript/selenium-webdriver:create-bidi-src_schema)",
"rb/lib/selenium/webdriver/bidi/protocol",
],
data = [
"bidi/support/templates/module.rb.erb",
"bidi/support/templates/module.rbs.erb",
"//javascript/selenium-webdriver:create-bidi-src_schema",
],
main = "bidi/support/bidi_generate.rb",
)

# Fails if a checked-in protocol .rb was hand-edited or left stale after a generator/schema
# change. Re-renders each module in memory and compares (see check_generated.rb). Fix with
# `bazel run //rb/lib/selenium/webdriver:bidi-generate`.
rb_test(
name = "verify-bidi-generated",
size = "small",
srcs = ["bidi/support/check_generated.rb"],
args = ["$(rootpath //javascript/selenium-webdriver:create-bidi-src_schema)"],
data = [
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
"bidi/support/bidi_generate.rb",
"bidi/support/templates/module.rb.erb",
"//javascript/selenium-webdriver:create-bidi-src_schema",
] + glob(
["bidi/protocol/*.rb"],
exclude = ["bidi/protocol/domain.rb"],
),
main = "bidi/support/check_generated.rb",
)

rb_library(
name = "devtools",
srcs = glob([
Expand Down
3 changes: 3 additions & 0 deletions rb/lib/selenium/webdriver/bidi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def initialize(url:)
@ws = WebSocketConnection.new(url: url)
end

# @api private
attr_reader :ws

def close
@ws.close
end
Expand Down
39 changes: 39 additions & 0 deletions rb/lib/selenium/webdriver/bidi/protocol.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# serialization must load first (it defines the Serialization runtime the generated
# classes build on), then the Domain base the generated classes subclass. Add a require
# below when a new BiDi domain is generated.
require 'selenium/webdriver/bidi/serialization'
require 'selenium/webdriver/bidi/transport'
require 'selenium/webdriver/bidi/protocol/domain'
require 'selenium/webdriver/bidi/protocol/bluetooth'
require 'selenium/webdriver/bidi/protocol/browser'
require 'selenium/webdriver/bidi/protocol/browsing_context'
require 'selenium/webdriver/bidi/protocol/emulation'
require 'selenium/webdriver/bidi/protocol/input'
require 'selenium/webdriver/bidi/protocol/log'
require 'selenium/webdriver/bidi/protocol/network'
require 'selenium/webdriver/bidi/protocol/permissions'
require 'selenium/webdriver/bidi/protocol/script'
require 'selenium/webdriver/bidi/protocol/session'
require 'selenium/webdriver/bidi/protocol/speculation'
require 'selenium/webdriver/bidi/protocol/storage'
require 'selenium/webdriver/bidi/protocol/user_agent_client_hints'
require 'selenium/webdriver/bidi/protocol/web_extension'
Loading
Loading