Skip to content

Commit 3649db5

Browse files
authored
chore(mcp): bump default extension protocol to v2 (#40678)
1 parent bb6c009 commit 3649db5

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

packages/playwright-core/src/tools/mcp/cdpRelay.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
* - /extension/guid - Extension connection
2323
*
2424
* Protocol version is controlled by PLAYWRIGHT_EXTENSION_PROTOCOL env variable:
25-
* - v1 (default): single-tab, extension manages debugger attachment
26-
* - v2: multi-tab, relay manages debugger via chrome.* APIs
25+
* - v1: single-tab, extension manages debugger attachment
26+
* - v2 (default): multi-tab, relay manages debugger via chrome.* APIs
2727
*/
2828

2929
import { spawn } from 'child_process';

packages/playwright-core/src/tools/mcp/protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const LATEST_VERSION = 2;
2121

2222
// The protocol version used by default when PLAYWRIGHT_EXTENSION_PROTOCOL is
2323
// not set. May lag behind LATEST_VERSION while a new version is rolling out.
24-
export const DEFAULT_VERSION = 1;
24+
export const DEFAULT_VERSION = 2;
2525

2626
// Structural mirrors of @types/chrome shapes used over the wire. The extension
2727
// imports the real chrome.* types and they are structurally compatible.

tests/extension/extension-fixtures.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export const test = base.extend<TestFixtures, WorkerFixtures & ExtensionTestOpti
5757
protocolVersion: [2, { option: true, scope: 'worker' }],
5858

5959
_protocolEnv: [async ({ protocolVersion }, use) => {
60-
// Default is 1.
61-
if (protocolVersion === 2)
62-
process.env.PLAYWRIGHT_EXTENSION_PROTOCOL = '2';
60+
// Default is 2.
61+
if (protocolVersion === 1)
62+
process.env.PLAYWRIGHT_EXTENSION_PROTOCOL = '1';
6363
else
6464
delete process.env.PLAYWRIGHT_EXTENSION_PROTOCOL;
6565
await use();

tests/extension/extension.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ test(`connect.html protocolVersion search param matches fixture option`, async (
5858
expect(url.searchParams.get('protocolVersion')).toBe(String(protocolVersion));
5959
});
6060

61-
test(`protocolVersion defaults to 1`, async ({ startExtensionClient, server, protocolVersion }) => {
62-
// test.fail(true, 'Server default is currently 2; this test guards the expected default of 1');
61+
test(`protocolVersion defaults to 2`, async ({ startExtensionClient, server, protocolVersion }) => {
6362
const saved = process.env.PLAYWRIGHT_EXTENSION_PROTOCOL;
6463
delete process.env.PLAYWRIGHT_EXTENSION_PROTOCOL;
6564

@@ -76,7 +75,7 @@ test(`protocolVersion defaults to 1`, async ({ startExtensionClient, server, pro
7675

7776
const selectorPage = await confirmationPagePromise;
7877
const url = new URL(selectorPage.url());
79-
expect(url.searchParams.get('protocolVersion')).toBe('1');
78+
expect(url.searchParams.get('protocolVersion')).toBe('2');
8079

8180
process.env.PLAYWRIGHT_EXTENSION_PROTOCOL = saved;
8281
});

0 commit comments

Comments
 (0)