fix: implement glob pattern matching for wait --url and route matching#1077
Open
tmchow wants to merge 3 commits intovercel-labs:mainfrom
Open
fix: implement glob pattern matching for wait --url and route matching#1077tmchow wants to merge 3 commits intovercel-labs:mainfrom
tmchow wants to merge 3 commits intovercel-labs:mainfrom
Conversation
Replace literal string matching with Playwright-compatible glob semantics in three code paths: - wait_for_url: use RegExp instead of String.includes() - route matching: use glob_matches() instead of simplified split logic - responsebody URL matching: use glob_matches() instead of contains() Add glob_to_regex() helper that converts * (non-slash), ** (any), and ? (single char) patterns. Regex metacharacters are escaped. Fixes vercel-labs#1061
Contributor
|
@tmchow is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Playwright's URL glob semantics only support * and **. The ? character is the query string separator in URLs and should be matched literally.
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.
Summary
Replaces literal string matching with Playwright-compatible glob semantics in
wait --url, route matching, andresponsebodyURL matching.Changes
Three code paths in
cli/src/native/actions.rsused string operations (includes(),contains(),starts_with/ends_withsplit) instead of glob matching. After the Rust rewrite (f341c0a), patterns like**/dashboardwere treated as literal strings.This PR adds a
glob_to_regex()helper that converts glob patterns to regex:*matches any characters except/**matches any characters including/?matches a single characterFixed locations:
wait_for_url(line ~2913):location.href.includes()->new RegExp(glob_to_regex(...)).test(location.href)split('*')logic ->glob_matches()handle_responsebody(line ~5585):resp_url.contains()->glob_matches()No new crate dependencies beyond
regex(added tocli/Cargo.toml). 6 unit tests cover exact match, escaping,*,**, and?patterns.This contribution was developed with AI assistance (Claude Code).
Fixes #1061