Skip to content
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

Split pr validate browsing context #12920

Merged

Conversation

manuelsblanco
Copy link
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

manuelsblanco and others added 14 commits September 3, 2023 19:21
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.
@codecov-commenter
Copy link

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (f02e917) 56.51% compared to head (0170e5f) 56.51%.
Report is 10 commits behind head on trunk.

❗ Current head 0170e5f differs from pull request most recent head dfff04d. Consider uploading reports for the commit dfff04d to get more accurate results

❗ 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.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pujagani pujagani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manuelsblanco Thank you!

@pujagani pujagani merged commit bbcfc9a into SeleniumHQ:trunk Oct 11, 2023
3 of 4 checks passed
@manuelsblanco manuelsblanco deleted the splitPR-validate-browsing-context-id branch October 11, 2023 17:07
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants