Skip to content

feat: toHaveURLPattern - #38925

Merged
Simon Knott (Skn0tt) merged 5 commits into
microsoft:mainfrom
Skn0tt:urlpattern
Jan 30, 2026
Merged

Simon Knott (Skn0tt) merged 5 commits into
microsoft:mainfrom
Skn0tt:urlpattern

Conversation

@Skn0tt

Copy link
Copy Markdown
Contributor

Closes #38666

Comment thread docs/src/api/class-browsercontext.md Resolved
Comment thread docs/src/api/class-page.md Resolved
Comment thread docs/src/api/class-page.md Resolved
Comment thread docs/src/api/class-page.md Resolved
Comment thread docs/src/api/params.md Resolved
Comment thread utils/generate_types/overrides.d.ts Resolved
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

const url = parseURL(urlString);
if (!url)
return false;
if (isURLPattern(match))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also update protocol to support url patterns on the server side? See RouteHandler.prepareInterceptionPatterns for the reference.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

private _initScripts: InitScript[] = [];
private _requestInterceptor: RouteHandler;
private _interceptionUrlMatchers: (string | RegExp)[] = [];
private _interceptionUrlMatchers: (string | RegExp | URLPattern | undefined)[] = [];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps just URLMatch[]?

private _clockPaused = false;
private _requestInterceptor: RouteHandler;
private _interceptionUrlMatchers: (string | RegExp)[] = [];
private _interceptionUrlMatchers: (string | RegExp | URLPattern | undefined)[] = [];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps just URLMatch[]?

// eslint-disable-next-line no-restricted-globals
export const isURLPattern = (v: unknown): v is URLPattern => typeof globalThis.URLPattern === 'function' && v instanceof globalThis.URLPattern;

export function serializeURLPattern(v: URLPattern) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's instead export serializeURLMatch() and handle all cases right here.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 failed
❌ [playwright-test] › reporter-line.spec.ts:193 › merged › should show error context with relative path @macos-latest-node20
❌ [playwright-test] › reporter.spec.ts:251 › created › should not have internal error when steps are finished after timeout @macos-latest-node20
❌ [playwright-test] › reporter-html.spec.ts:304 › merged › should not include image diff with non-images @macos-latest-node20
❌ [playwright-test] › reporter-html.spec.ts:333 › merged › should include screenshot on failure @macos-latest-node20
❌ [playwright-test] › ui-mode-test-network-tab.spec.ts:301 › should copy network request @macos-latest-node20

5 flaky ⚠️ [chromium-library] › library/browsertype-connect.spec.ts:844 › run-server › socks proxy › should proxy requests from fetch api `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/popup.spec.ts:258 › should not throw when click closes popup `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/inspector/cli-codegen-pick-locator.spec.ts:35 › should update locator highlight `@chromium-ubuntu-22.04-node22`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:384 › should reveal errors in the sourcetab `@macos-latest-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:812 › should update state on subsequent run `@windows-latest-node20`

34237 passed, 668 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

5 failed
❌ [chrome] › mcp/cli.spec.ts:484 › session › session-delete @mcp-ubuntu-latest
❌ [firefox] › mcp/cli.spec.ts:352 › devtools › network @mcp-ubuntu-latest
❌ [chrome] › mcp/autowait.spec.ts:19 › racy navigation destroys context @mcp-windows-latest
❌ [chrome] › mcp/cli.spec.ts:386 › devtools › video-start-stop @mcp-macos-15
❌ [chromium] › mcp/cli.spec.ts:386 › devtools › video-start-stop @mcp-macos-15

3597 passed, 129 skipped


Merge workflow run.

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.

[Feature]: Allow URLPattern for page.waitForURL

2 participants