Repository navigation
Add tests for special character locators - #4
Merged
Merged
Conversation
Introduces a new test suite for handling locators with special characters. Updates README with improved documentation and SEO, refines package metadata, and enhances Playwright config and smart locator logic for better test automation support.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces comprehensive support for handling special characters in locators and enhances the overall test automation framework. The changes focus on making the SmartLocator class more resilient when dealing with text containing quotes, apostrophes, backslashes, and other special characters that could break CSS selectors and XPath expressions.
Key Changes
- Added comprehensive text escaping functionality for CSS selectors and XPath expressions to handle special characters safely
- Introduced a new test suite specifically for validating special character handling in various locator scenarios
- Enhanced existing locator strategies throughout the codebase to use proper text escaping
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/special-characters.spec.ts | New test suite validating special character handling in text-based locators |
| src/smart-locator.ts | Enhanced locator methods with proper text escaping for CSS and XPath selectors |
| playwright.config.ts | Enabled web server configuration for improved test setup |
| package.json | Added Jest-related dependencies for expanded testing capabilities |
| README.md | Updated documentation with improved SEO and comprehensive feature descriptions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
The webServer configuration has been commented out in playwright.config.ts, likely to disable automatic server startup during tests or to allow for manual server management.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Updated SmartLocator to use Playwright's default exact text matching instead of fuzzy matching for getByText calls. This change improves selector accuracy and avoids unintended matches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Introduces a new test suite for handling locators with special characters. Updates README with improved documentation and SEO, refines package metadata, and enhances Playwright config and smart locator logic for better test automation support.