Add isVisible and isDisplayed commands to Element API #4094
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for the isVisible and isDisplayed commands to the Nightwatch.js Element API. These commands allow users to check whether a web element is visible on the page, providing valuable functionality for verifying element visibility in automated tests.
Changes Made:
Added isVisible.js command file to lib/api/web-element/commands directory.
Implemented isVisible command functionality, leveraging the existing Selenium WebDriver method mappings.
Added isDisplayed.js command file as an alias to isVisible command.
Included error handling to gracefully handle any exceptions during the visibility check.
Updated class names to follow industry best practices and improve code readability.
Testing:
Tested the new commands locally by integrating them into test scripts and verifying their functionality.
Ensured that the commands work as expected in various scenarios, including when elements are visible and when they are not.
Verified that error handling behaves as intended, providing reliable feedback to users.
Purpose:
The purpose of this pull request is to enhance the capabilities of the Nightwatch.js Element API by introducing commands for checking element visibility. These commands contribute to the overall usability and effectiveness of Nightwatch.js for automated testing.
Additional Notes:
Please review the code and provide feedback on any improvements or modifications that may be necessary.
I'm open to discussion and willing to make changes as needed to ensure the quality and compatibility of these commands with the Nightwatch.js codebase.