[rb] Add tests for the cookie named, and updates type #14843
Merged
+9
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
Description
This PR adds a test to validate that the cookie-named method can throw an error as the specification for get_cookie which is used in the cookie_named method states https://www.w3.org/TR/webdriver1/#get-named-cookie.
It also updates the RBS files and the doc comment to match the expected behavior.
Motivation and Context
All of our users need to understand the expected behavior of the methods, and that the return types, matched that expected behavior.
Thank you so much @luke-hill for raising this up.
Types of changes
Checklist
PR Type
Tests, Enhancement
Description
cookie_named
method throwsNoSuchCookieError
when a non-existent cookie is requested.cookie_named
method to reflect the error handling behavior.Error::NoSuchCookieError
as a possible return type forcookie_named
.Changes walkthrough 📝
manager.rb
Update doc comment for `cookie_named` method
rb/lib/selenium/webdriver/common/manager.rb
cookie_named
method.cookie_named
throwsNoSuchCookieError
if the cookie isnot found.
manager_spec.rb
Add test for `cookie_named` error handling
rb/spec/integration/selenium/webdriver/manager_spec.rb
cookie_named
method.NoSuchCookieError
when cookie is not found.manager.rbs
Update type signature for `cookie_named` method
rb/sig/lib/selenium/webdriver/common/manager.rbs
cookie_named
method.Error::NoSuchCookieError
in return type.