fix(locator): render getByRole() with a regex name and a string description - #42780
Open
om singhal (Om-singhaI) wants to merge 1 commit into
Open
om singhal (Om-singhaI) wants to merge 1 commit into
om singhal (Om-singhaI) wants to merge 1 commit into
Conversation
…iption The exactness check added for microsoft#41032 treated every regex as exact. So a regex name next to a string description that isn't exact (or the other way around) was reported as a conflict, and the locator was printed as the raw internal:role selector. Only string values carry exactness now.
Contributor
Test results for "tests 1"9 flaky52003 passed, 1247 skipped Merge workflow run. |
Contributor
Test results for "MCP"8629 passed, 1446 skipped Merge workflow run. |
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.
Fixes #42779
getByRole()with a regexnameand a stringdescription(or the reverse) prints as the rawinternal:role=...selector intoString(), expect errors and call logs.The exactness check from #41035 compares
caseSensitivefornameanddescription.parseAttributeSelector()marks every regex as case sensitive, while a string withoutexactis"..."i. So the pair looks like a conflict,innerAsLocators()throws andasLocator()falls back to the selector.Exactness only means something for strings. Now only string values set
options.exactand take part in the conflict check. Real string conflicts from #41032 still come back raw. Before #41035, a string name with a regex description printed a wrongexact: truetaken from the regex. Now it prints without it.Testing:
tests/library/locator-generator.spec.tscovers both mixed cases in all four languages plus the parse round trip. It fails on main and passes with the fix.tests/library/locator-generator.spec.tspasses locally on Chromium: 28 tests, including the page basedreverse engineer getByRoleone and the [Bug]: When codegen generates a getByRole() with both the name and description options specified, an invalid exact option may be specified. #41032 one.npm run flint:eslint,tsc,lint-tests,test-typesandcheck-depspass. Thedocstep launches all three browsers to read their versions, so I skipped it.