-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rb] handled nil condition for Cookie Method in ruby #15099
[rb] handled nil condition for Cookie Method in ruby #15099
Conversation
PR Reviewer Guide 🔍(Review updated until commit 10cc4d3)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 10cc4d3
Previous suggestions✅ Suggestions up to commit 3966bfe
|
Thank you so much for the help! this is already implemented, so I will close the PR, have a great day! |
@aguspe This adds validation of cookie name to be aligned with other bindings, I think the PR is still actual. |
@nvborisenko I was talking with Pallavi, and It feels strange for me to add this type of validation in Ruby with a mandatory parameter. But if the goal is to be aligned between all the bindings and return a consistent error across bindings and browsers then I can re-open this and help Pallavi with the testing We can update the guard clause instead to make it more Ruby-like |
After discussing with @nvborisenko I'm re-opening this PR and adding a review comment |
…work/selenium into pallavi-getCookieRuby
is this PR accepted @aguspe ? Please let me know? thanks |
@@ -242,6 +242,11 @@ module WebDriver | |||
expect(driver.manage.all_cookies.find { |c| c[:name] == 'foo' }).to be_nil | |||
end | |||
|
|||
it 'throws error when cookie name is empty string' do | |||
expect { driver.manage.delete_cookie('') } | |||
.to raise_exception(ArgumentError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pallavigitwork this test is failing due to expected ArgumentError but nothing was raised you need to pass nil or an empty hash to make this test work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok thank you @aguspe . I will try to fix this by this thursday. i will work on the feedback you gave. thank you for your time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made changes. requesting review, @aguspe
…work/selenium into pallavi-getCookieRuby modified code files
execute :delete_cookie, name: name | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space here that is making the formatted field could you run:
./scripts/format.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this runs.
but rubocop throws error
Error: unrecognized cop or department Lint/UselessConstantScoping found in rb/.rubocop.yml
Did you mean Lint/ConstantResolution
?
do i change something in the yml file?
this- Lint/UselessConstantScoping:
Enabled: false
installed gem rubocop again. i get this message - 333 files inspected, 343 offenses detected, 244 offenses autocorrectable
…work/selenium into pallavi-getCookieRuby modified extra line
unable to make this work. closing this one with comment as unresolved. |
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
implemented handling nil/empty for cookie methods - reference pr- #15044
Motivation and Context
it wasn't implemented in ruby
Types of changes
Checklist
implemented handling nil/empty for cookie methods - reference pr- #15044
PR Type
Bug fix, Enhancement
Description
Added validation for
nil
or empty cookie names indelete_cookie
andcookie
methods.Raised
Error::ArgumentError
for invalid cookie names.Improved error handling for cookie-related methods in Ruby WebDriver.
Changes walkthrough 📝
bridge.rb
Validate cookie name in Ruby WebDriver methods
rb/lib/selenium/webdriver/remote/bridge.rb
nil
or empty cookie names indelete_cookie
andcookie
methods.
Error::ArgumentError
with a descriptive message for invalidnames.