-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Moved javascript code examples for element locators into test files #2312
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
base: trunk
Are you sure you want to change the base?
Moved javascript code examples for element locators into test files #2312
Conversation
👷 Deploy request for selenium-dev pending review.Visit the deploys page to approve it
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
I could not add the try catch block in the test functions because gh-codeblock does not allow discontinuous lines. Because of this, I could not fit the declaration and definition of the webdriver object before the URL fetch and the relevant element fetch. |
User description
Description
This PR moves all JavaScript code examples for the following element locators into test files and updates the corresponding documentation to reference those examples using gh-codeblock:
This ensures all locator examples are tested automatically and reduces duplication.
Unfortunately I could not get hugo working with my PAT so I could not preview the changes on the website directly
P.S: This is my first pull request, I really like Selenium so any tips you have would be greatly appreciated!
Motivation and Context
This PR helps integrate the documentation examples for the locators into CI
Types of changes
Checklist
PR Type
Tests, Documentation
Description
Added comprehensive JavaScript tests for all element locator strategies.
Updated documentation to reference tested code examples via
gh-codeblock
.Fixed minor typo in checkbox test comment.
Changes walkthrough 📝
locators.spec.js
Add JavaScript tests for all element locator strategies
examples/javascript/test/elements/locators.spec.js
linkText, and partialLinkText.
locators.en.md
Reference tested JavaScript locator examples in documentation
website_and_docs/content/documentation/webdriver/elements/locators.en.md
gh-codeblock
referencing newtest file.
information.spec.js
Fix typo and formatting in element information test
examples/javascript/test/elements/information.spec.js