Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c8b37e0
[rb] scaffold BiDi protocol integration specs from schema
titusfortner Jul 29, 2026
1375d0b
[build] run edge-bidi targets in ci-ruby full suite
titusfortner Aug 4, 2026
fbe42ec
[rb] raise BiDi SerializationError on wire deserialization mismatches
titusfortner Aug 4, 2026
e494908
[rb] guard bidi protocol specs for unsupported browser commands and t…
titusfortner Aug 4, 2026
6397cfa
[rb] add edge guards and edge timeout skips for bidi protocol specs
titusfortner Aug 5, 2026
2c3a80c
[build] run bidi protocol specs in strict serialization mode
titusfortner Aug 5, 2026
a6e40d6
[rb] guard Safari bidi protocol specs for strict-mode SerializationError
titusfortner Aug 5, 2026
187b2c4
[rb] type inbound BiDi enum errors as SerializationError and relocate…
titusfortner Aug 6, 2026
4f5d62b
[rb] skip unsupported BiDi modules on Safari with per-module support …
titusfortner Aug 6, 2026
8094039
[rb] drop exception class from volatile Safari BiDi pending guards
titusfortner Aug 6, 2026
666b9ff
[rb] scope BiDi protocol spec guards by browser/OS and mirror the rea…
titusfortner Aug 8, 2026
bee1210
[rb] skip Edge bluetooth device-response in CI and fix subscribe call…
titusfortner Aug 9, 2026
57638eb
[rb] skip chromium bluetooth in CI and correct firefox setViewport/st…
titusfortner Aug 9, 2026
9358d79
[rb] scope chromium bluetooth skip to CI so local runs still exercise it
titusfortner Aug 9, 2026
c76c1af
[rb] pin Safari setViewport pending to the assertion error and skip c…
titusfortner Aug 9, 2026
da67f4e
[rb] dedupe the chromium bluetooth device-response skip into one shar…
titusfortner Aug 9, 2026
58556b2
[rb] dedupe repeated Safari/Chromium guards in script and browsing_co…
titusfortner Aug 9, 2026
628da2f
[rb] move duplicated BiDi guards onto describe/context blocks instead…
titusfortner Aug 9, 2026
bc12b2c
[rb] enable strict BiDi serialization for protocol specs in the harne…
titusfortner Aug 10, 2026
1858dcb
[rb] enable strict BiDi serialization for all bidi specs via the test…
titusfortner Aug 10, 2026
367ed87
[rb] simplify the bidi strict-mode comment in the test environment
titusfortner Aug 11, 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 @@ -91,7 +91,7 @@ jobs:
fail-fast: false
matrix:
os: [windows]
tag_filters: [chrome-beta, firefox-beta, edge-local]
tag_filters: [chrome-beta, firefox-beta, "edge-local,edge-bidi"]
include:
- os: macos
tag_filters: safari-local,safari-preview-bidi
Expand Down
4 changes: 4 additions & 0 deletions rb/lib/selenium/webdriver/bidi/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
module Selenium
module WebDriver
module Error
# Raised locally when a BiDi wire payload does not match this Selenium's generated
# schema. It is not a protocol error code; the (de)serialization layer raises it directly.
class SerializationError < WebDriverError; end

# Register each BiDi-only code as a WebDriverError subclass; shared codes keep their classic class.
BiDi::Protocol::ErrorCode::CLASS_NAMES.each_value do |name|
const_set(name, Class.new(WebDriverError)) unless const_defined?(name, false)
Expand Down
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/bidi/serialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def self.to_symbol(name, value, enum)
return value if value.nil?
return value.map { |element| to_symbol(name, element, enum) } if value.is_a?(::Array)

enum.key(value) || raise(Error::WebDriverError, "#{name} received an unknown value: #{value.inspect}")
enum.key(value) || raise(Error::SerializationError, "#{name} received an unknown value: #{value.inspect}")
end
end
end # BiDi
Expand Down
14 changes: 7 additions & 7 deletions rb/lib/selenium/webdriver/bidi/serialization/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def new(**kwargs)
# (extensible) or warned and dropped (closed) β€” strict on shape, lenient on extras.
def from_json(json_payload)
unless json_payload.is_a?(::Hash)
raise Error::WebDriverError, "#{name} expected an object on the wire, got #{json_payload.inspect}"
raise Error::SerializationError, "#{name} expected an object on the wire, got #{json_payload.inspect}"
end

attributes = fields.to_h do |f|
Expand Down Expand Up @@ -228,7 +228,7 @@ def wire_value(field, json_payload)
# which matters for the required-and-nullable fields the schema flags.
def missing_required(field)
message = "#{name}##{field.name} is required but was missing from the response"
raise Error::WebDriverError, message if Serialization.strict?
raise Error::SerializationError, message if Serialization.strict?

Comment thread
qodo-code-review[bot] marked this conversation as resolved.
WebDriver.logger.warn(message, id: :bidi_missing_required)
UNSET
Expand All @@ -238,7 +238,7 @@ def read(field, raw)
if raw.nil?
return raw if field.nullable

raise Error::WebDriverError, "#{name}##{field.name} received null but is not nullable"
raise Error::SerializationError, "#{name}##{field.name} received null but is not nullable"
end
check_shape(field, raw)
return Serialization.to_symbol("#{name}##{field.name}", raw, enum_hash(field)) if field.enum
Expand Down Expand Up @@ -268,7 +268,7 @@ def check_shape(field, raw)
return if field.list == raw.is_a?(::Array)
return unless field.list || field.enum || field.ref

raise Error::WebDriverError,
raise Error::SerializationError,
"#{name}##{field.name} expected #{field.list ? 'a list' : 'a single value'}, got #{raw.inspect}"
end

Expand All @@ -285,7 +285,7 @@ def check_primitive(field, raw)
expected = PRIMITIVE_TYPES[field.primitive]
return if expected.nil? || expected.any? { |type| raw.is_a?(type) }

raise Error::WebDriverError, "#{name}##{field.name} expected #{field.primitive}, got #{raw.inspect}"
raise Error::SerializationError, "#{name}##{field.name} expected #{field.primitive}, got #{raw.inspect}"
end

def enum_hash(field)
Expand Down Expand Up @@ -314,7 +314,7 @@ def read_list(field, raw, klass)
# malformed entry and is rejected outright.
def read_map_entry(field, element, klass)
unless element.is_a?(::Array) && element.size == 2
raise Error::WebDriverError,
raise Error::SerializationError,
"#{name}##{field.name} expected a [key, value] pair, got #{element.inspect}"
end

Expand All @@ -332,7 +332,7 @@ def scalar_value(field, value)
expected = Array(field.scalar).flat_map { |primitive| PRIMITIVE_TYPES[primitive] || [] }
return value if expected.empty? || expected.any? { |type| value.is_a?(type) }

raise Error::WebDriverError,
raise Error::SerializationError,
"#{name}##{field.name} expected #{Array(field.scalar).join(' or ')}, got #{value.inspect}"
end

Expand Down
4 changes: 2 additions & 2 deletions rb/lib/selenium/webdriver/bidi/serialization/union.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ def from_json(json_payload)
unless json_payload.is_a?(::Hash)
return json_payload unless @object_only

raise Error::WebDriverError, "#{name} expected an object on the wire, got #{json_payload.inspect}"
raise Error::SerializationError, "#{name} expected an object on the wire, got #{json_payload.inspect}"
end

variant = select(json_payload)
unless variant
raise Error::WebDriverError,
raise Error::SerializationError,
"#{name} received a variant not in this Selenium's BiDi schema: #{json_payload.inspect}"
end
Protocol.const_get(variant).from_json(json_payload)
Expand Down
1 change: 1 addition & 0 deletions rb/spec/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rb_library(
"//rb/spec/integration:all_srcs",
"//rb/spec/integration/selenium/webdriver:all_srcs",
"//rb/spec/integration/selenium/webdriver/bidi:all_srcs",
"//rb/spec/integration/selenium/webdriver/bidi/protocol:all_srcs",
"//rb/spec/integration/selenium/webdriver/chrome:all_srcs",
"//rb/spec/integration/selenium/webdriver/edge:all_srcs",
"//rb/spec/integration/selenium/webdriver/firefox:all_srcs",
Expand Down
23 changes: 23 additions & 0 deletions rb/spec/integration/selenium/webdriver/bidi/protocol/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
load("//rb/spec:tests.bzl", "rb_integration_test")

filegroup(
name = "all_srcs",
testonly = True,
srcs = glob(["*.rb"]),
visibility = ["//rb/spec:__pkg__"],
)

[
rb_integration_test(
name = file[:-8],
srcs = [file],
bidi = True,
classic = False,
data = ["//common/extensions"],
tags = ["exclusive-if-local"],
deps = [
"//rb/lib/selenium/webdriver:bidi",
],
)
for file in glob(["*_spec.rb"])
]
Loading
Loading