Skip to content

[java] add safari technlogy preview code snippet #2059

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

Merged
merged 3 commits into from
Nov 14, 2024

Conversation

Delta456
Copy link
Member

@Delta456 Delta456 commented Nov 12, 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

Adds safari technlogy preview code snippet

Motivation and Context

The example was missing so I added that

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, documentation


Description

  • Added a new test method in Java for Safari Technology Preview, enabling the use of Technology Preview in SafariOptions.
  • Updated the Safari documentation across multiple languages to include the new Java code snippet using gh-codeblock.

Changes walkthrough 📝

Relevant files
Enhancement
SafariTest.java
Add Safari Technology Preview test method                               

examples/java/src/test/java/dev/selenium/browsers/SafariTest.java

  • Added a test method for Safari Technology Preview.
  • Configured SafariOptions to use Technology Preview.
  • +7/-0     
    Documentation
    safari.en.md
    Update Java code snippet for Safari documentation               

    website_and_docs/content/documentation/webdriver/browsers/safari.en.md

    • Updated Java code snippet to use gh-codeblock.
    +1/-1     
    safari.ja.md
    Update Java code snippet for Safari documentation               

    website_and_docs/content/documentation/webdriver/browsers/safari.ja.md

    • Updated Java code snippet to use gh-codeblock.
    +1/-1     
    safari.pt-br.md
    Update Java code snippet for Safari documentation               

    website_and_docs/content/documentation/webdriver/browsers/safari.pt-br.md

    • Updated Java code snippet to use gh-codeblock.
    +1/-1     
    safari.zh-cn.md
    Update Java code snippet for Safari documentation               

    website_and_docs/content/documentation/webdriver/browsers/safari.zh-cn.md

    • Updated Java code snippet to use gh-codeblock.
    +1/-1     

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

    Copy link

    netlify bot commented Nov 12, 2024

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit dfec7e1

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Test Validation
    The new test method doesn't include any assertions or verifications to ensure the Safari Technology Preview was successfully initialized

    Copy link
    Contributor

    qodo-merge-pro bot commented Nov 12, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Add a precondition check to skip the test when required software is not available

    Add a check to verify if Safari Technology Preview is installed before attempting to
    use it, as the test will fail if it's not available on the system.

    examples/java/src/test/java/dev/selenium/browsers/SafariTest.java [37-42]

     @Test
     public void safariTechnologyPreview() {
    +    if (!SafariDriver.isSupportingTechnologyPreview()) {
    +        throw new SkipException("Safari Technology Preview is not installed");
    +    }
         SafariOptions options = new SafariOptions();
         options.setUseTechnologyPreview(true);
         driver = new SafariDriver(options);
     }
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: The suggestion adds crucial error handling to prevent test failures when Safari Technology Preview is not installed, which is a common scenario. This makes the test more robust and provides clear feedback about missing prerequisites.

    9

    💡 Need additional feedback ? start a PR chat

    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 @Delta456 !

    @harsha509 harsha509 merged commit 25f35c0 into SeleniumHQ:trunk Nov 14, 2024
    9 checks passed
    @Delta456 Delta456 deleted the safari_java branch November 14, 2024 16:34
    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