Skip to content

fix(locator-generator): keep regexes with u, s, y, d and v flags - #42819

Merged
Yury Semikhatsky (yury-s) merged 1 commit into
microsoft:mainfrom
Abnoz01:fix-42814
Sep 22, 2026
Merged

Yury Semikhatsky (yury-s) merged 1 commit into
microsoft:mainfrom
Abnoz01:fix-42814

Conversation

@Abnoz01

Copy link
Copy Markdown
Contributor

Summary

  • detectExact in the locator generator only matched regex flags i, g and m, while the selector parser accepts dgimsuvy. A regex with any other flag fell through and was quoted as a string, so getByText(/foo/u) rendered as getByText('/foo/u') in call logs, trace viewer, codegen and locator.toString().
  • Accept the full flag set and add round-trip tests for the JavaScript rendering.

Fixes #42814

The generator only recognised i, g and m regex flags, so a locator such
as getByText(/foo/u) was rendered as the string literal getByText('/foo/u')
in call logs, traces, codegen and locator.toString().

Fixes microsoft#42814
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky ⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:690 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node24`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`

52020 passed, 1250 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [firefox] › mcp/cli-session.spec.ts:54 › idle timeout shuts the session down @mcp-windows-latest-firefox

8691 passed, 1474 skipped


Merge workflow run.

@yury-s
Yury Semikhatsky (yury-s) merged commit 56c0b49 into microsoft:main Sep 22, 2026
44 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: locator.toString() and call logs render regexes with u/s/y/d/v flags as string literals

2 participants