Skip to content

[rb] Update finders examples and move them #1800

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
Jul 9, 2024

Conversation

aguspe
Copy link
Contributor

@aguspe aguspe commented Jul 6, 2024

User description

Description

The focus of this PR is to move the ruby finder examples to make it easier to maintain in the future

Motivation and Context

It's important that the documentation is easier to maintain so we can provide users with up to date documentation

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


Description

  • Added multiple example tests for element finders in examples/ruby/spec/elements/finders_spec.rb.
  • Updated English, Japanese, Portuguese (Brazil), and Chinese (Simplified) documentation to reference the new Ruby example file using gh-codeblock.
  • Improved maintainability of Ruby examples by consolidating them into a single file.

Changes walkthrough 📝

Relevant files
Enhancement
finders_spec.rb
Add example tests for various element finders in Ruby       

examples/ruby/spec/elements/finders_spec.rb

  • Added multiple example tests for element finders.
  • Included examples for finding elements by class, id, css, and tag
    name.
  • Demonstrated finding active elements and elements within elements.
  • +35/-0   
    Documentation
    finders.en.md
    Update Ruby examples in finders documentation (EN)             

    website_and_docs/content/documentation/webdriver/elements/finders.en.md

  • Replaced inline Ruby code examples with references to the new Ruby
    example file.
  • Updated documentation to use gh-codeblock for Ruby examples.
  • +19/-62 
    finders.ja.md
    Update Ruby examples in finders documentation (JA)             

    website_and_docs/content/documentation/webdriver/elements/finders.ja.md

  • Replaced inline Ruby code examples with references to the new Ruby
    example file.
  • Updated documentation to use gh-codeblock for Ruby examples.
  • +20/-63 
    finders.pt-br.md
    Update Ruby examples in finders documentation (PT-BR)       

    website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md

  • Replaced inline Ruby code examples with references to the new Ruby
    example file.
  • Updated documentation to use gh-codeblock for Ruby examples.
  • +20/-63 
    finders.zh-cn.md
    Update Ruby examples in finders documentation (ZH-CN)       

    website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md

  • Replaced inline Ruby code examples with references to the new Ruby
    example file.
  • Updated documentation to use gh-codeblock for Ruby examples.
  • +20/-63 

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link

    netlify bot commented Jul 6, 2024

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit 88ac61f

    @qodo-merge-pro qodo-merge-pro bot added documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 2 labels Jul 6, 2024
    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 6, 2024

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Possible Bug:
    The examples provided in finders_spec.rb are marked with skip: 'these are just examples, not actual tests'. This is generally fine for demonstration purposes, but it should be clearly documented or noted in the PR that these are non-executable examples to avoid confusion.

    Code Duplication:
    The examples in finders_spec.rb seem to repeat similar patterns. Consider refactoring to reduce duplication and enhance clarity, perhaps by using helper methods or shared contexts.

    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 6, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Maintainability
    ✅ Adjust indentation for the Ruby tab header to ensure consistency
    Suggestion Impact:The suggestion led to the adjustment of the indentation for the Ruby tab header across multiple instances in the file, ensuring consistency.

    code diff:

    -{{< tab header="Ruby" text=true>}}
    +{{< tab header="Ruby" text=true >}}
     {{< gh-codeblock path="/examples/ruby/spec/elements/finders_spec.rb#L10" >}}
     {{< /tab >}}
       {{< tab header="JavaScript" >}}
    @@ -83,7 +83,7 @@
     IWebElement fruits = driver.FindElement(By.Id("fruits"));
     IWebElement fruit = fruits.FindElement(By.ClassName("tomatoes"));
       {{< /tab >}}
    -{{< tab header="Ruby" text=true>}}
    +{{< tab header="Ruby" text=true >}}
     {{< gh-codeblock path="/examples/ruby/spec/elements/finders_spec.rb#L14-L15" >}}
     {{< /tab >}}
       {{< tab header="JavaScript" >}}
    @@ -124,7 +124,7 @@
       {{< tab header="CSharp" >}}
     var fruit = driver.FindElement(By.CssSelector("#fruits .tomatoes"));
       {{< /tab >}}
    -{{< tab header="Ruby" text=true>}}
    +{{< tab header="Ruby" text=true >}}
     {{< gh-codeblock path="/examples/ruby/spec/elements/finders_spec.rb#L19" >}}
     {{< /tab >}}
       {{< tab header="JavaScript" >}}
    @@ -152,7 +152,7 @@
       {{< tab header="CSharp" >}}
     IReadOnlyList<IWebElement> plants = driver.FindElements(By.TagName("li"));
       {{< /tab >}}
    -{{< tab header="Ruby" text=true>}}
    +{{< tab header="Ruby" text=true >}}
     {{< gh-codeblock path="/examples/ruby/spec/elements/finders_spec.rb#L23" >}}
     {{< /tab >}}
       {{< tab header="JavaScript" >}}
    @@ -217,7 +217,7 @@
      }
     }
       {{< /tab >}}
    -   {{< tab header="Ruby" text=true>}}
    +   {{< tab header="Ruby" text=true >}}
        {{< gh-codeblock path="/examples/ruby/spec/elements/finders_spec.rb#L27-L28" >}}
        {{< /tab >}}
       {{< tab header="JavaScript" >}}
    @@ -334,7 +334,7 @@
      }
     }
       {{< /tab >}}
    -   {{< tab header="Ruby" text=true>}}
    +   {{< tab header="Ruby" text=true >}}
        {{< gh-codeblock path="/examples/ruby/spec/elements/finders_spec.rb#L32-L34" >}}
        {{< /tab >}}
       {{< tab header="JavaScript" >}}
    @@ -441,7 +441,7 @@
          }
         }
       {{< /tab >}}
    -  {{< tab header="Ruby" text=true>}}
    +  {{< tab header="Ruby" text=true >}}
       {{< gh-codeblock path="/examples/ruby/spec/elements/finders_spec.rb#L38-L39" >}}

    Ensure consistency in the indentation of the Ruby tab header across all examples. The
    indentation level should match the surrounding code for better readability and
    maintainability.

    website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md [53-55]

    -{{&lt; tab header="Ruby" text=true&gt;}}
    +{{&lt; tab header="Ruby" text=true &gt;}}
     {{&lt; gh-codeblock path="/examples/ruby/spec/elements/finders_spec.rb#L10" &gt;}}
     {{&lt; /tab &gt;}}
     
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: The suggestion correctly identifies a minor inconsistency in the formatting of the Ruby tab header, which affects readability and maintainability. However, the impact on the overall functionality is minimal.

    6

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

    @harsha509 harsha509 merged commit 3041687 into SeleniumHQ:trunk Jul 9, 2024
    9 checks passed
    selenium-ci added a commit that referenced this pull request Jul 9, 2024
    * Update finders examples and move them
    
    * Fix spacing issue
    
    ---------
    
    Co-authored-by: aguspe <[email protected]>
    Co-authored-by: Sri Harsha <[email protected]> 3041687
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 2
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants