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

[java] Remove a wrong code example and update code lines #2104

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

pujagani
Copy link
Contributor

@pujagani pujagani commented Dec 16, 2024

User description

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

PR Type

Enhancement


Description

  • Removed redundant jsErrors test method from LogTest.java to improve code maintainability
  • Updated code block line references in all language versions of the documentation (en, ja, pt-br, zh-cn)
  • Added version badge for Java examples in Chinese documentation

Changes walkthrough 📝

Relevant files
Enhancement
LogTest.java
Remove redundant test method from LogTest                               

examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java

  • Removed redundant jsErrors test method
  • Simplified test structure by removing duplicate code
  • +0/-15   
    Documentation
    log.en.md
    Update code block references in English documentation       

    website_and_docs/content/documentation/webdriver/bidi/w3c/log.en.md

    • Updated code block line references to match new file structure
    +3/-3     
    log.ja.md
    Update code block references in Japanese documentation     

    website_and_docs/content/documentation/webdriver/bidi/w3c/log.ja.md

    • Updated code block line references to match new file structure
    +3/-3     
    log.pt-br.md
    Update code block references in Portuguese documentation 

    website_and_docs/content/documentation/webdriver/bidi/w3c/log.pt-br.md

    • Updated code block line references to match new file structure
    +3/-3     
    log.zh-cn.md
    Update code block references in Chinese documentation       

    website_and_docs/content/documentation/webdriver/bidi/w3c/log.zh-cn.md

  • Updated code block line references to match new file structure
  • Added version badge for Java examples
  • +5/-5     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    netlify bot commented Dec 16, 2024

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit 2831b30
    🔍 Latest deploy log https://app.netlify.com/sites/selenium-dev/deploys/675ffce9fa017200089e6c44
    😎 Deploy Preview https://deploy-preview-2104--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    @pujagani pujagani changed the title [java] Remove a wrong code example and update code lines [java] Remove a incorrect code example and update code lines Dec 16, 2024
    @qodo-merge-pro qodo-merge-pro bot changed the title [java] Remove a incorrect code example and update code lines [java] Remove a wrong code example and update code lines Dec 16, 2024
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Test Coverage
    The removal of the jsErrors test method may reduce test coverage for console log functionality. Verify that the remaining tests adequately cover this functionality.

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    Ensure proper cleanup of WebDriver resources in test setup to prevent memory leaks

    Add a cleanup step in the test setup by closing any existing WebDriver instance
    before creating a new one to prevent resource leaks.

    examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java [24-28]

     public void setup() {
    +    if (driver != null) {
    +        driver.quit();
    +    }
         FirefoxOptions options = new FirefoxOptions();
         options.setCapability("webSocketUrl", true);
         driver = new FirefoxDriver(options);
     }
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion addresses a potential resource leak issue by ensuring proper cleanup of WebDriver instances. This is a critical improvement for test stability and resource management, especially in long-running test suites.

    8

    Copy link
    Member

    @harsha509 harsha509 left a comment

    Choose a reason for hiding this comment

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

    Thank you @pujagani !

    @harsha509 harsha509 merged commit 6b3cccc into SeleniumHQ:trunk Dec 16, 2024
    10 of 12 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants