Skip to content

Added PrintOptions to Documentation #1987

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 6 commits into from
Oct 10, 2024

Conversation

shbenzer
Copy link
Contributor

@shbenzer shbenzer commented Oct 9, 2024

User description

Added section on PrintOptions to documentation

Description

added English, Portuguese, Chinese, and Japanese translations of Interactions/PrintOptions webpage
added executable examples for methods

Motivation and Context

Make selenium documentation more comprehensive

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

Documentation, Tests


Description

  • Added comprehensive documentation for the PrintOptions class in multiple languages: English, Japanese, Portuguese, and Chinese.
  • Included executable examples for methods such as orientation, range, size, margins, scale, background, and shrink-to-fit.
  • Implemented test cases in Java to validate the functionality of the PrintOptions class.

Changes walkthrough 📝

Relevant files
Tests
PrintOptionsTest.java
Add test cases for PrintOptions functionality                       

examples/java/src/test/java/dev/selenium/interactions/PrintOptionsTest.java

  • Added test cases for PrintOptions class.
  • Tested methods for orientation, range, size, margins, scale,
    background, and shrink-to-fit.
  • Utilized Selenium WebDriver for testing print options.
  • +77/-0   
    Documentation
    print_page.en.md
    Add English documentation for PrintOptions class                 

    website_and_docs/content/documentation/webdriver/interactions/print_page.en.md

  • Added documentation for PrintOptions class in English.
  • Included examples for orientation, range, size, margins, scale,
    background, and shrink-to-fit.
  • Provided code snippets in multiple programming languages.
  • +190/-0 
    print_page.ja.md
    Add Japanese documentation for PrintOptions class               

    website_and_docs/content/documentation/webdriver/interactions/print_page.ja.md

  • Added Japanese documentation for PrintOptions class.
  • Included examples and code snippets for various print options.
  • +190/-0 
    print_page.pt-br.md
    Add Portuguese documentation for PrintOptions class           

    website_and_docs/content/documentation/webdriver/interactions/print_page.pt-br.md

  • Added Portuguese documentation for PrintOptions class.
  • Included examples and code snippets for various print options.
  • +190/-0 
    print_page.zh-cn.md
    Add Chinese documentation for PrintOptions class                 

    website_and_docs/content/documentation/webdriver/interactions/print_page.zh-cn.md

  • Added Chinese documentation for PrintOptions class.
  • Included examples and code snippets for various print options.
  • +190/-0 

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

    Copy link

    netlify bot commented Oct 9, 2024

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit 1d2df70

    @qodo-merge-pro qodo-merge-pro bot added documentation Improvements or additions to documentation tests Review effort [1-5]: 3 labels Oct 9, 2024
    Copy link
    Contributor

    qodo-merge-pro bot commented Oct 9, 2024

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Incomplete Assertions
    The test methods are setting values but not asserting the expected outcomes, which may lead to ineffective testing.

    Inconsistent Method Names
    The documentation for ShrinkToFit mentions using getBackground() and setBackground() methods, which should be getShrinkToFit() and setShrinkToFit().

    Missing Translations
    The documentation is in English for all language versions (ja, pt-br, zh-cn), which may confuse non-English speaking users.

    Copy link
    Contributor

    qodo-merge-pro bot commented Oct 9, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Correct method names in the ShrinkToFit section documentation

    In the ShrinkToFit section, the method names are incorrect. They should be
    getShrinkToFit() and setShrinkToFit() instead of getBackground() and
    setBackground().

    website_and_docs/content/documentation/webdriver/interactions/print_page.en.md [168]

    -Using `getBackground()` and `setBackground()` methods, you can get/set whether the page will shrink-to-fit content on the page --- boolean `true` or `false`.
    +Using `getShrinkToFit()` and `setShrinkToFit()` methods, you can get/set whether the page will shrink-to-fit content on the page --- boolean `true` or `false`.
    • Apply this suggestion
    Suggestion importance[1-10]: 10

    Why: Correcting the method names in the documentation is essential to avoid confusion and ensure accurate information is provided to users. This suggestion addresses a clear error in the documentation.

    10
    Enhancement
    Add assertions to validate the expected values after setting print options

    Consider using assertions to validate the expected values after setting print
    options. This will ensure that the options are correctly applied and help catch any
    potential issues.

    examples/java/src/test/java/dev/selenium/interactions/PrintOptionsTest.java [15-17]

     PrintOptions printOptions = new PrintOptions();
     printOptions.setOrientation(PrintOptions.Orientation.LANDSCAPE);
     PrintOptions.Orientation current_orientation = printOptions.getOrientation();
    +assertEquals(PrintOptions.Orientation.LANDSCAPE, current_orientation, "Orientation should be set to LANDSCAPE");
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: Adding assertions to validate the expected values after setting print options is crucial for ensuring the correctness of the test cases. This suggestion directly enhances the reliability and effectiveness of the tests by catching potential issues.

    9
    Translate the content to the target language for proper localization

    Consider translating the content to Japanese, as this file is intended for Japanese
    documentation (indicated by the '.ja.md' extension). Currently, the content is in
    English.

    website_and_docs/content/documentation/webdriver/interactions/print_page.ja.md [10-12]

    -Sometimes you need to print the website you are using - whether that be your 
    -grandmother printing mapquest directions, or a judge needing to print court
    -records. Luckily, Selenium provides an easy way to automate that!
    +時には、使用しているウェブサイトを印刷する必要があります。例えば、おばあちゃんがマップクエストの道順を印刷する場合や、裁判官が裁判記録を印刷する必要がある場合などです。幸いなことに、Seleniumはこれを自動化する簡単な方法を提供しています!
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Translating the content to Japanese is important for proper localization and accessibility for Japanese-speaking users. This suggestion enhances the usability of the documentation for its intended audience.

    7
    Best practice
    Use constants or enums for scale values to improve code readability and maintainability

    Consider using a constant or an enum for the scale value to improve code readability
    and maintainability. This will make it easier to understand the meaning of the scale
    value and update it if needed.

    examples/java/src/test/java/dev/selenium/interactions/PrintOptionsTest.java [55-57]

    +private static final double HALF_SCALE = 0.50;
    +
     PrintOptions printOptions = new PrintOptions();
    -printOptions.setScale(.50);
    +printOptions.setScale(HALF_SCALE);
     double current_scale = printOptions.getScale();
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Using a constant for the scale value improves code readability and maintainability by making the code more understandable and easier to update. While beneficial, this change is not critical to the functionality.

    6

    💡 Need additional feedback ? start a PR chat

    @shbenzer
    Copy link
    Contributor Author

    shbenzer commented Oct 9, 2024

    @harsha1502 this should cover #1941 and be a fun hacktober contribution

    @shbenzer shbenzer requested a review from harsha509 October 10, 2024 18:09
    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 @shbenzer !

    @harsha509 harsha509 merged commit 272186a into SeleniumHQ:trunk Oct 10, 2024
    9 checks passed
    selenium-ci added a commit that referenced this pull request Oct 10, 2024
    * Added PrintOptions to Documentation
    
    * Made intro more technical
    
    * Update print_page.ja.md
    
    * Update print_page.pt-br.md
    
    * Update print_page.zh-cn.md
    
    ---------
    
    Co-authored-by: Sri Harsha <12621691+harsha509@users.noreply.github.com> 272186a
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants