From 2e36f24228e58bc6d5f1988f320b5b2bb77d89fb Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 9 Jun 2026 11:10:08 -0700 Subject: [PATCH 1/4] fix(cli): support attaching to a Playwright browser server endpoint (#41203) --- .../src/tools/cli-client/program.ts | 2 +- .../src/tools/mcp/browserFactory.ts | 4 +++ tests/mcp/cli-endpoint.spec.ts | 31 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/mcp/cli-endpoint.spec.ts diff --git a/packages/playwright-core/src/tools/cli-client/program.ts b/packages/playwright-core/src/tools/cli-client/program.ts index 1d9dc5d657c2d..0b87a30bae33a 100644 --- a/packages/playwright-core/src/tools/cli-client/program.ts +++ b/packages/playwright-core/src/tools/cli-client/program.ts @@ -168,7 +168,7 @@ export async function program(options?: { embedderVersion?: string}) { } const cdpChannel = typeof args.cdp === 'string' && isKnownChannel(args.cdp) ? args.cdp : undefined; - const targetName = attachTarget ?? cdpChannel ?? extensionChannel ?? args.cdp as string; + const targetName = attachTarget ?? cdpChannel ?? extensionChannel ?? args.endpoint as string ?? args.cdp as string; if (!targetName) output.errorAttachNoTarget(); const attachSessionName = explicitSessionName(args.session as string) ?? attachTarget ?? cdpChannel ?? extensionChannel ?? sessionName; diff --git a/packages/playwright-core/src/tools/mcp/browserFactory.ts b/packages/playwright-core/src/tools/mcp/browserFactory.ts index e6b808459c5ac..70cf0878e55d7 100644 --- a/packages/playwright-core/src/tools/mcp/browserFactory.ts +++ b/packages/playwright-core/src/tools/mcp/browserFactory.ts @@ -147,6 +147,10 @@ async function createRemoteBrowser(config: FullConfig): Promise // Use connectToBrowser instead of playwright[browserName].connect because we don't have browserName. const browser = await connectToBrowser(playwrightObject, remoteOptions); browser._connectToBrowserType(playwrightObject[browser._browserName], {}, undefined); + // A browser started via `launchServer` exposes no contexts until one is + // created, so create one when attaching to such a server. + if (!browser.contexts().length) + await browser.newContext(config.browser.contextOptions); return { browser, browserInfo: browserInfo(browser, config), canBind: false, ownership: 'attached' }; } diff --git a/tests/mcp/cli-endpoint.spec.ts b/tests/mcp/cli-endpoint.spec.ts new file mode 100644 index 0000000000000..0fa4519e32076 --- /dev/null +++ b/tests/mcp/cli-endpoint.spec.ts @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { test, expect } from './cli-fixtures'; + +test('attach --endpoint keeps the default session', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/41154' } }, async ({ wsEndpoint, cli, server }) => { + const { exitCode, error } = await cli('attach', `--endpoint=${wsEndpoint}`); + expect(error).not.toContain('no target specified'); + expect(exitCode).toBe(0); + + const { output: listOutput } = await cli('list'); + expect(listOutput).toContain('- default:'); + expect(listOutput).toContain('(attached)'); + + await cli('goto', server.HELLO_WORLD); + const { inlineSnapshot } = await cli('snapshot'); + expect(inlineSnapshot).toContain('Hello, world!'); +}); From e3083b5b11fa1dbb6499469ea1f978d6219fe886 Mon Sep 17 00:00:00 2001 From: "microsoft-playwright-automation[bot]" <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 11:10:32 -0700 Subject: [PATCH 2/4] test: roll stable-test-runner to 1.61.0-alpha-1781023400000 (#41218) --- .../stable-test-runner/package-lock.json | 24 +++++++++---------- .../stable-test-runner/package.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/playwright-test/stable-test-runner/package-lock.json b/tests/playwright-test/stable-test-runner/package-lock.json index 7ebb02a95b13f..33b4ad64d3c4d 100644 --- a/tests/playwright-test/stable-test-runner/package-lock.json +++ b/tests/playwright-test/stable-test-runner/package-lock.json @@ -5,16 +5,16 @@ "packages": { "": { "dependencies": { - "@playwright/test": "^1.61.0-alpha-2026-06-01" + "@playwright/test": "^1.61.0-alpha-1781023400000" } }, "node_modules/@playwright/test": { - "version": "1.61.0-alpha-2026-06-01", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.61.0-alpha-2026-06-01.tgz", - "integrity": "sha512-eE/Hz7GLQeymq0axISbYtgpeBIltzcAbWFY8algIzSwPsyvTFt8mCh/mKJJl8zUjOFz2EtL8OVedDL8stKNS/Q==", + "version": "1.61.0-alpha-1781023400000", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.61.0-alpha-1781023400000.tgz", + "integrity": "sha512-EYeA59CsSOtiQgKTBAyl321SwaWzLYD4wU9GDAt8kFpYCco3sClPZBPdKXdUwlrNqOFAbseUYtiFudxFs/h02w==", "license": "Apache-2.0", "dependencies": { - "playwright": "1.61.0-alpha-2026-06-01" + "playwright": "1.61.0-alpha-1781023400000" }, "bin": { "playwright": "cli.js" @@ -38,12 +38,12 @@ } }, "node_modules/playwright": { - "version": "1.61.0-alpha-2026-06-01", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.61.0-alpha-2026-06-01.tgz", - "integrity": "sha512-tBlatMRW9V7IZl50faQpIkHs7qz7U5oxw2raeDRlc1uMd91hVpsE6XIp2fY1Z6hVIYkQeCeO3I5NP9J5vKbSvQ==", + "version": "1.61.0-alpha-1781023400000", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.61.0-alpha-1781023400000.tgz", + "integrity": "sha512-8TRUG3IvwaAhuVm6k3C5vB7CwC5Fxq76DCCxOgPr6r1dpTedDwxlmdOBUkSZ0zxfxP14jcuPxi86/Trq4eA03w==", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.61.0-alpha-2026-06-01" + "playwright-core": "1.61.0-alpha-1781023400000" }, "bin": { "playwright": "cli.js" @@ -56,9 +56,9 @@ } }, "node_modules/playwright-core": { - "version": "1.61.0-alpha-2026-06-01", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.0-alpha-2026-06-01.tgz", - "integrity": "sha512-QP5JCCuFJ+Yoh3dbXqSHVqV76VblK1T+dFIDs9RI9iRCEU/hlOpvt9cKJJXivVo7i+9XJgYfs2ERzvCaNZ0Y/g==", + "version": "1.61.0-alpha-1781023400000", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.0-alpha-1781023400000.tgz", + "integrity": "sha512-UdtUd9qnCO0zvb8p3OvOZpelY6mA40mTb3NmWGuMtrD+hqqWuorWCPlSGwj7jw/LEB9AxvYLHTL1CJi2flvksg==", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" diff --git a/tests/playwright-test/stable-test-runner/package.json b/tests/playwright-test/stable-test-runner/package.json index 307d2f5489376..cab864290397d 100644 --- a/tests/playwright-test/stable-test-runner/package.json +++ b/tests/playwright-test/stable-test-runner/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "@playwright/test": "^1.61.0-alpha-2026-06-01" + "@playwright/test": "^1.61.0-alpha-1781023400000" } } From 0bc6b172f10298286acf0f2ebbd27002dc4f263b Mon Sep 17 00:00:00 2001 From: yen0304 Date: Wed, 10 Jun 2026 04:17:51 +0800 Subject: [PATCH 3/4] fix(html-reporter): prevent 'undefined' in annotation search index (#41207) Annotations without descriptions produced `"type=undefined"` in the search index because `a.description?.toLocaleLowerCase()` returns `undefined` which concatenates as the literal string `"undefined"`. Use `(a.description ?? '').toLowerCase()` to fall back to empty string. Also normalizes `toLocaleLowerCase()` to `toLowerCase()` for consistency with the rest of the file. --- packages/html-reporter/src/filter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/html-reporter/src/filter.ts b/packages/html-reporter/src/filter.ts index 36da5554643d3..470f6b8b58827 100644 --- a/packages/html-reporter/src/filter.ts +++ b/packages/html-reporter/src/filter.ts @@ -204,7 +204,7 @@ function cacheSearchValues(test: TestCaseSummary & { [searchValuesSymbol]?: Sear line: String(test.location.line), column: String(test.location.column), labels: test.tags.map(tag => tag.toLowerCase()), - annotations: test.annotations.map(a => a.type.toLowerCase() + '=' + a.description?.toLocaleLowerCase()) + annotations: test.annotations.map(a => a.type.toLowerCase() + '=' + (a.description ?? '').toLowerCase()) }; test[searchValuesSymbol] = searchValues; return searchValues; From ac7cdd4bdf15f90fe7229243be6b35a53e0296d1 Mon Sep 17 00:00:00 2001 From: "microsoft-playwright-automation[bot]" <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:58:21 -0600 Subject: [PATCH 4/4] feat(webkit): roll to r2309 (#41221) --- packages/playwright-core/browsers.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index d12a5e8669e55..1e5a956654504 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -45,7 +45,7 @@ }, { "name": "webkit", - "revision": "2306", + "revision": "2309", "installByDefault": true, "revisionOverrides": { "mac14": "2251",