Skip to content

Commit b81bfed

Browse files
committed
Add tests and modify options
1 parent 69847e9 commit b81bfed

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

rb/lib/selenium/webdriver/common/driver.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ def create_bridge(caps:, url:, http_client: nil)
323323
if caps['webSocketUrl']
324324
ws_options =
325325
{
326-
response_timeout: caps['wsResponseTimeout'],
327-
response_interval: caps['wsResponseInterval']
326+
response_timeout: caps[:'ws:response_timeout'],
327+
response_interval: caps[:'ws:response_interval']
328328
}.compact
329329

330330
klass = Remote::BiDiBridge

rb/lib/selenium/webdriver/common/options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Options
2626

2727
GRID_OPTIONS = %i[enable_downloads].freeze
2828

29-
WEBSOCKET_OPTIONS = %i[ws_response_timeout ws_response_interval].freeze
29+
WEBSOCKET_OPTIONS = %i[ws:response_timeout ws:response_interval].freeze
3030

3131
class << self
3232
attr_reader :driver_path

rb/spec/integration/selenium/webdriver/bidi/browsing_context_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,22 @@ class BiDi
132132
browsing_context.activate
133133
expect(driver.execute_script('return document.hasFocus();')).to be_truthy
134134
end
135+
136+
it 'times out if a bidi command takes too long to receive a response' do
137+
reset_driver!(web_socket_url: true, 'ws:response_timeout': 1) do |driver|
138+
expect {
139+
driver.navigate.to url_for('sleep?time=2')
140+
}.to raise_error(Selenium::WebDriver::Error::TimeoutError)
141+
end
142+
end
143+
144+
it 'does not time out if a bidi command is fast enough' do
145+
reset_driver!(web_socket_url: true, 'ws:response_timeout': 5) do |driver|
146+
expect {
147+
driver.navigate.to url_for('sleep?time=1')
148+
}.not_to raise_error
149+
end
150+
end
135151
end
136152
end # BiDi
137153
end # WebDriver

0 commit comments

Comments
 (0)