Skip to content

Upgrade selenium 4 ruby examples & rendering issue #1695

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 24 commits into from
Apr 29, 2024

Conversation

aguspe
Copy link
Contributor

@aguspe aguspe commented Apr 26, 2024

Description

This PR updates the upgrade to selenium 4 documentation to avoid the wrong rendering of the ruby examples and also moves the ruby examples for the before section to the options_spec file

This PR needs to be merged after #1679

Motivation and Context

Currently due to changes I introduced in #1668 the rendering of the ruby example in the upgrade selenium page is wrong:

Screenshot 2024-04-26 at 17 57 00

This PR fixes that and migrates the ruby example on the before tab

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.

Copy link

netlify bot commented Apr 26, 2024

👷 Deploy request for selenium-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 8cc5f55

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

PR Description updated to latest commit (5ae210d)

Copy link
Contributor

PR Review

⏱️ Estimated effort to review [1-5]

3, because the PR includes multiple changes in the Ruby WebDriver options tests and documentation updates across different language versions. The added tests cover various WebDriver configurations, which require careful review to ensure they are correctly implemented and align with Selenium's standards.

🧪 Relevant tests

Yes

🔍 Possible issues

Possible Bug: The use of a hardcoded proxy server 'myproxy.com:8080' in the test 'sets the proxy' might not be ideal for all environments. Consider parameterizing this or using environment variables.

Code Redundancy: The URL 'https://www.selenium.dev/selenium/web/' is used repeatedly in multiple tests. It might be more efficient to define this URL once as a constant at the beginning of the test file to make future changes easier and reduce potential errors.

🔒 Security concerns

No


✨ Review tool usage guide:

Overview:
The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

  • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
[pr_reviewer]
some_config1=...
some_config2=...

See the review usage page for a comprehensive guide on using this tool.

Copy link
Contributor

PR Code Suggestions

CategorySuggestions                                                                                                                                                       
Maintainability
Ensure consistency in file paths used in documentation shortcodes.

Ensure that the path in the gh-codeblock shortcode is consistent and does not start with a
slash for local paths, as this might cause issues with path resolution in some static site
generators.

website_and_docs/content/documentation/webdriver/drivers/options.ja.md [140]

-{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L11-L12">}}
+{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L11-L12">}}
 
Update the line numbers in the gh-codeblock paths to match the latest Ruby codebase changes.

Ensure that the path in the gh-codeblock shortcode correctly points to the intended line
numbers in the Ruby examples. The path should be updated to reflect the new line numbers
after changes in the Ruby codebase.

website_and_docs/content/documentation/webdriver/drivers/options.en.md [43]

-{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L11" >}}
+{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L12" >}}
 
Update the gh-codeblock paths to match the updated line numbers in the Ruby examples.

Ensure that the gh-codeblock shortcode accurately reflects the current state of the Ruby
examples by updating the path to the correct line numbers.

website_and_docs/content/documentation/webdriver/drivers/options.en.md [372]

-{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L114-L115" >}}
+{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L115-L116" >}}
 
Enhancement
Add language highlighting to code blocks for better readability.

Update the gh-codeblock shortcode to include a specific language highlight. This will
improve readability and context for the code snippet, especially in a multi-language
documentation environment.

website_and_docs/content/documentation/webdriver/drivers/options.ja.md [43]

-{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L11" >}}
+{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L11" lang="ruby" >}}
 
Usability
Use more descriptive tab headers to enhance user navigation and clarity.

Consider using a more descriptive tab header for the Ruby examples to differentiate
between different Ruby code snippets, especially when multiple snippets are present.

website_and_docs/content/documentation/webdriver/drivers/options.ja.md [42]

-{{< tab header="Ruby" >}}
+{{< tab header="Ruby Options Example" >}}
 
Bug
Ensure line numbers in code paths are correctly updated to reflect the latest source code.

To avoid duplication and maintain consistency, ensure that the line numbers in the
gh-codeblock paths are updated correctly across all documentation files when the source
code examples are updated.

website_and_docs/content/documentation/webdriver/drivers/options.ja.md [43]

-{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L11" >}}
+{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L12" >}}  # Assuming L12 is the correct updated line.
 
Best practice
Use a configuration parameter for reusable paths to simplify updates and maintenance.

For better code management and to avoid hardcoding paths in multiple files, consider using
a configuration file or a constant variable to manage paths that are reused across
documentation.

website_and_docs/content/documentation/webdriver/drivers/options.ja.md [43]

-{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L11" >}}
+{{< gh-codeblock path="{{ .Site.Params.rubyExamplePath }}/drivers/options_spec.rb#L11" >}}
 
Adjust the line numbers in the gh-codeblock paths to align with the updated Ruby examples.

Update the gh-codeblock shortcode to reflect the new line numbers after updates in the
Ruby examples, ensuring that the documentation remains accurate and helpful.

website_and_docs/content/documentation/webdriver/drivers/options.en.md [299]

-{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L38-L39" >}}
+{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L39-L40" >}}
 
Accuracy
Ensure the gh-codeblock paths accurately reflect the current state of the Ruby examples.

Verify and update the gh-codeblock paths to ensure they point to the correct sections of
the Ruby examples, especially when line numbers are specified over a range.

website_and_docs/content/documentation/webdriver/drivers/options.en.md [142]

-{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L11-L12">}}
+{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L12-L13">}}
 
Update the gh-codeblock paths to accurately reflect changes in the Ruby examples.

Correct the gh-codeblock paths to ensure they accurately point to the intended content in
the Ruby examples, especially when the documentation is used as a reference.

website_and_docs/content/documentation/webdriver/drivers/options.en.md [337]

-{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L51-L52" >}}
+{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L52-L53" >}}
 
Possible issue
Correct the number of backticks for closing the Python code block to prevent rendering issues.

Ensure that the closing backticks for code blocks are consistent. In the Python tab, there
are four backticks instead of three, which could lead to rendering issues.

website_and_docs/content/documentation/webdriver/troubleshooting/upgrade_to_selenium_4.ja.md [98]

 ```python
 caps = {}
 caps['browserName'] = 'firefox'
 caps['platform'] = 'Windows 10'
 caps['version'] = '92'
 caps['build'] = my_test_build
 caps['name'] = my_test_name
 driver = webdriver.Remote(cloud_url, desired_capabilities=caps)
-````
+```
 
Correct the number of backticks for closing the JavaScript code block to prevent rendering issues.

Ensure that the closing backticks for code blocks are consistent. In the JavaScript tab,
there are four backticks instead of three, which could lead to rendering issues.

website_and_docs/content/documentation/webdriver/troubleshooting/upgrade_to_selenium_4.zh-cn.md [142]

 ```javascript
 capabilities = {
   browserName: 'firefox',
   browserVersion: '92',
   platformName: 'Windows 10',
   'cloud:options': {
      build: myTestBuild,
      name: myTestName,
   }
 }
-````
+```
 
Remove the extra backtick at the end of the Python code block to prevent rendering issues.

There is an extra backtick at the end of the Python code block, which could cause
rendering issues. It should be removed to ensure proper formatting.

website_and_docs/content/documentation/webdriver/troubleshooting/upgrade_to_selenium_4.en.md [102]

 ```python
 caps = {}
 caps['browserName'] = 'firefox'
 caps['platform'] = 'Windows 10'
 caps['version'] = '92'
 caps['build'] = my_test_build
 caps['name'] = my_test_name
 driver = webdriver.Remote(cloud_url, desired_capabilities=caps)
-````
+```
 
Remove the extra backtick at the end of the JavaScript code block to prevent rendering issues.

There is an extra backtick at the end of the JavaScript code block, which could cause
rendering issues. It should be removed to ensure proper formatting.

website_and_docs/content/documentation/webdriver/troubleshooting/upgrade_to_selenium_4.en.md [132]

 ```javascript
 capabilities = {
   browserName: 'firefox',
   browserVersion: '92',
   platformName: 'Windows 10',
   build: myTestBuild,
   name: myTestName,
 }
-````
+```
 

✨ Improve tool usage guide:

Overview:
The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

  • When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
/improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
[pr_code_suggestions]
some_config1=...
some_config2=...

See the improve usage page for a comprehensive guide on using this tool.

@harsha509
Copy link
Member

HI @aguspe,

Thank you for the PR.

could you please look into conflicts.

Thanks,
Sri

@aguspe
Copy link
Contributor Author

aguspe commented Apr 27, 2024

Hi @harsha509

Thank you for the help,
The conflicts are resolved and I also fixed the rendering of the proxy options in the docs

Let me know if everything else is needed and have a great weeekend

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 76d80d0 into SeleniumHQ:trunk Apr 29, 2024
9 checks passed
@aguspe
Copy link
Contributor Author

aguspe commented Apr 29, 2024

@harsha509 Thank you :) I will continue updating the ruby documentation today, have a nice day!

chamiz pushed a commit to chamiz/seleniumhq.github.io that referenced this pull request Apr 29, 2024
…deploy site]

* Expand options documentation test and examples

* Update timeouts examples

* Update all navigations

* Update options after updating the tests

* Update options after updating the tests

* Fix documentation bug

* Fix documentation issue and migrate ruby code

* Fix proxy documentation issue

---------

Co-authored-by: aguspe <[email protected]>
Co-authored-by: Sri Harsha <[email protected]>
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]: 3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants