Skip to content

[rb] Add network conditions special features examples #1717

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
May 14, 2024

Conversation

aguspe
Copy link
Contributor

@aguspe aguspe commented May 12, 2024

User description

Description

This PR adds an example for simulating network conditions on chrome

Motivation and Context

It's important for all users to be aware of the capabilities that Selenium has to offer such as simulating network conditions, as of today there is no example for it

Screenshot 2024-05-12 at 16 31 50

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 Ruby test case in chrome_spec.rb to demonstrate how to simulate network conditions using Selenium WebDriver.
  • Updated documentation across multiple languages (English, Japanese, Portuguese-BR, Chinese) to include a link to the new Ruby code example.

Changes walkthrough 📝

Relevant files
Enhancement
chrome_spec.rb
Add network condition simulation test for Chrome                 

examples/ruby/spec/browsers/chrome_spec.rb

  • Added a test case for setting and getting network conditions in Chrome
    using Selenium WebDriver.
  • +10/-0   
    Documentation
    chrome.en.md
    Update Ruby example link for network conditions                   

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

  • Updated the Ruby code example link to point to the new test case for
    network conditions.
  • +1/-1     
    chrome.ja.md
    Update Ruby example link for network conditions                   

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

  • Updated the Ruby code example link to point to the new test case for
    network conditions.
  • +1/-1     
    chrome.pt-br.md
    Update Ruby example link for network conditions                   

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

  • Updated the Ruby code example link to point to the new test case for
    network conditions.
  • +1/-1     
    chrome.zh-cn.md
    Update Ruby example link for network conditions                   

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

  • Updated the Ruby code example link to point to the new test case for
    network conditions.
  • +1/-1     

    💡 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 May 12, 2024

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit e441b01

    @qodo-merge-pro qodo-merge-pro bot added documentation Improvements or additions to documentation enhancement New feature or request labels May 12, 2024
    Copy link
    Contributor

    PR Description updated to latest commit (3dd84dd)

    Copy link
    Contributor

    PR Review 🔍

    ⏱️ Estimated effort to review [1-5]

    2, because the PR includes a single functional change in the Ruby test case and updates to documentation in multiple languages. The code change is straightforward and the documentation update is a simple link addition, making it relatively easy to review.

    🧪 Relevant tests

    Yes

    ⚡ Possible issues

    Possible Bug: The test case sets and checks network conditions but does not include assertions for upload_throughput separately from download_throughput. This might be an oversight if the behavior should explicitly differentiate between upload and download speeds.

    🔒 Security concerns

    No

    Copy link
    Contributor

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Ensure consistency in hash keys used for network conditions to avoid test failures

    The hash keys in the expectation for network_conditions are inconsistent with the keys
    used when setting the network_conditions. This might lead to unexpected behavior or test
    failures. Ensure that the keys match exactly between setting and getting the network
    conditions.

    examples/ruby/spec/browsers/chrome_spec.rb [130-134]

     expect(@driver.network_conditions).to eq(
    -  'offline' => false,
    -  'latency' => 100,
    -  'download_throughput' => 200,
    -  'upload_throughput' => 200)
    +  offline: false,
    +  latency: 100,
    +  throughput: 200)
     
    Suggestion importance[1-10]: 9

    Why: The suggestion correctly identifies a critical issue where the hash keys used to set and get network conditions do not match, potentially causing test failures or incorrect behavior. This is a significant bug fix that improves the reliability of the test.

    9

    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 a8f9785 into SeleniumHQ:trunk May 14, 2024
    8 of 9 checks passed
    selenium-ci added a commit that referenced this pull request May 14, 2024
    …site]
    
    Add network conditions special features examples
    
    Co-authored-by: aguspe <[email protected]>
    Co-authored-by: Sri Harsha <[email protected]> a8f9785
    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