Split pr validate browsing context#12920
Merged
pujagani merged 15 commits intoSeleniumHQ:trunkfrom Oct 11, 2023
Merged
Conversation
Enhanced the BrowsingContext Constructor to Include Additional Validation for 'id' Parameter **Hello Selenium community! Your contribution matters and well-described pull requests make reviews and merges efficient. Thank you for your effort!** Before submitting your pull request, please review our [contributing guidelines](https://github.com/SeleniumHQ/selenium/blob/trunk/CONTRIBUTING.md). Keeping pull requests concise and focused helps reviewers. <!--- Provide a general summary of your changes in the Title above --> ### Description In this pull request, I've enhanced the `BrowsingContext` constructor to include additional validation for the 'id' parameter. The objective is to ensure that the 'id' parameter is not only non-null but also non-empty, providing an extra layer of validation. Additionally, I've introduced a validation step to confirm that the WebDriver instance supports the BiDi protocol before retrieving the BiDi instance. ### Motivation and Context This enhancement was motivated by the need to strengthen the validation process for the 'id' parameter in the `BrowsingContext` constructor. By introducing a check for empty string values, we ensure that the 'id' parameter is not only non-null but also contains meaningful content. Additionally, verifying the support for the BiDi protocol in the WebDriver instance helps prevent compatibility issues. ### Types of Changes - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ### Checklist <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x] I have read the [contributing guidelines](https://github.com/SeleniumHQ/selenium/blob/trunk/CONTRIBUTING.md). - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [] I have added tests to cover my changes. - [x] All new and existing tests passed.
In this commit, the LogEntryUtils interface is introduced to centralize the JSON deserialization logic for log entries. This helps eliminate code duplication in the GenericLogEntry and JavascriptLogEntry classes. The LogEntryUtils interface provides a common method for parsing JSON input into log entry objects. Additionally, a new test class, LogEntryUtilsTest, has been created to test the functionality of the LogEntryUtils interface. The JsonInputFactory class is utilized to create JsonInput instances consistently across tests.
Using Require.precondition()
…mment) Using Require.precondition()
Codecov ReportAll modified lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## trunk #12920 +/- ##
=======================================
Coverage 56.51% 56.51%
=======================================
Files 86 86
Lines 5255 5255
Branches 187 187
=======================================
Hits 2970 2970
Misses 2098 2098
Partials 187 187 ☔ View full report in Codecov by Sentry. |
pujagani
approved these changes
Oct 11, 2023
Contributor
pujagani
left a comment
There was a problem hiding this comment.
@manuelsblanco Thank you!
aguspe
pushed a commit
to aguspe/selenium
that referenced
this pull request
Oct 22, 2023
Co-authored-by: Diego Molina <diemol@users.noreply.github.com> Co-authored-by: Titus Fortner <titusfortner@users.noreply.github.com> Co-authored-by: Puja Jagani <puja.jagani93@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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
Added Require.precondition checks for string parameters to ensure they are not empty before proceeding with operations.
Motivation and Context
These changes are made to enhance the code's robustness and reliability by ensuring that the required string parameters are valid and not empty before performing various operations. This helps prevent unexpected errors and provides clear error messages when invalid input is detected.
Types of changes
Checklist