Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aguspe committed Sep 20, 2024
1 parent c8d734d commit 9562499
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rb/lib/selenium/webdriver/bidi/auth_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def initialize(bidi)
@bidi = bidi
end

def add_auth_handler(**args)
@bidi.send_cmd('network.addAuthHandler', **args)
def add_auth_handler(username, password)
@bidi.send_cmd('network.addAuthHandler', username, password)
end

def remove_auth_handler(id)
Expand Down
17 changes: 17 additions & 0 deletions rb/spec/integration/selenium/webdriver/bidi/network_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module WebDriver
it 'adds auth handler' do
reset_driver!(web_socket_url: true) do |driver|
driver.network.add_auth_handler(username: 'user', password: 'pass')
expect(driver.auth_handlers.count).to eq 1
end
end

Expand All @@ -43,6 +44,22 @@ module WebDriver
expect { driver.network.add_auth_handler(invalid: 'args') }.to raise_error(ArgumentError, msg)
end
end

it 'removes auth handler' do
reset_driver!(web_socket_url: true) do |driver|
id = driver.network.add_auth_handler(username: 'user', password: 'pass')
driver.network.remove_auth_handler(id)
expect(driver.auth_handlers.count).to eq 0
end
end

it 'clears auth handlers' do
reset_driver!(web_socket_url: true) do |driver|
driver.network.add_auth_handler(username: 'user', password: 'pass')
driver.network.clear_auth_handlers
expect(driver.auth_handlers.count).to eq 0
end
end
end
end
end

0 comments on commit 9562499

Please sign in to comment.