From 841bb417d1cb15ad31a29ce270b46c145fd71a48 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Mon, 14 Jul 2025 09:53:33 +0200 Subject: [PATCH] chore: update to 1.54.0 (#653) Closes https://github.com/microsoft/playwright-mcp/issues/535 --- package-lock.json | 30 +++++++++++++++++------------- package.json | 4 ++-- src/tools/utils.ts | 2 +- tests/cdp.spec.ts | 6 +++--- tests/core.spec.ts | 25 ++++++++++++++++++++++--- tests/dialogs.spec.ts | 8 ++++---- tests/files.spec.ts | 8 +------- tests/iframes.spec.ts | 4 ++-- tests/launch.spec.ts | 2 +- tests/pdf.spec.ts | 4 ++-- tests/tabs.spec.ts | 8 ++++---- 11 files changed, 59 insertions(+), 42 deletions(-) diff --git a/package-lock.json b/package-lock.json index 04df3b3..b4657bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "commander": "^13.1.0", "debug": "^4.4.1", "mime": "^4.0.7", - "playwright": "1.53.0", + "playwright": "1.54.0", "ws": "^8.18.1", "zod-to-json-schema": "^3.24.4" }, @@ -23,7 +23,7 @@ "devDependencies": { "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.19.0", - "@playwright/test": "1.53.0", + "@playwright/test": "1.54.0", "@stylistic/eslint-plugin": "^3.0.1", "@types/chrome": "^0.0.315", "@types/debug": "^4.1.12", @@ -292,12 +292,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.53.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.53.0.tgz", - "integrity": "sha512-15hjKreZDcp7t6TL/7jkAo6Df5STZN09jGiv5dbP9A6vMVncXRqE7/B2SncsyOwrkZRBH2i6/TPOL8BVmm3c7w==", + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.54.0.tgz", + "integrity": "sha512-6Mnd5daQmLivaLu5kxUg6FxPtXY4sXsS5SUwKjWNy4ISe4pKraNHoFxcsaTFiNUULbjy0Vlb5HT86QuM0Jy1pQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright": "1.53.0" + "playwright": "1.54.0" }, "bin": { "playwright": "cli.js" @@ -2032,6 +2033,7 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -3298,11 +3300,12 @@ } }, "node_modules/playwright": { - "version": "1.53.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.53.0.tgz", - "integrity": "sha512-ghGNnIEYZC4E+YtclRn4/p6oYbdPiASELBIYkBXfaTVKreQUYbMUYQDwS12a8F0/HtIjr/CkGjtwABeFPGcS4Q==", + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.0.tgz", + "integrity": "sha512-y9yzHmXRwEUOpghM7XGcA38GjWuTOUMaTIcm/5rHcYVjh5MSp9qQMRRMc/+p1cx+csoPnX4wkxAF61v5VKirxg==", + "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0" + "playwright-core": "1.54.0" }, "bin": { "playwright": "cli.js" @@ -3315,9 +3318,10 @@ } }, "node_modules/playwright-core": { - "version": "1.53.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.53.0.tgz", - "integrity": "sha512-mGLg8m0pm4+mmtB7M89Xw/GSqoNC+twivl8ITteqvAndachozYe2ZA7srU6uleV1vEdAHYqjq+SV8SNxRRFYBw==", + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.0.tgz", + "integrity": "sha512-uiWpWaJh3R3etpJ0QrpligEMl62Dk1iSAB6NUXylvmQz+e3eipXHDHvOvydDAssb5Oqo0E818qdn0L9GcJSTyA==", + "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, diff --git a/package.json b/package.json index 212db1c..ae1492a 100644 --- a/package.json +++ b/package.json @@ -43,14 +43,14 @@ "commander": "^13.1.0", "debug": "^4.4.1", "mime": "^4.0.7", - "playwright": "1.53.0", + "playwright": "1.54.0", "ws": "^8.18.1", "zod-to-json-schema": "^3.24.4" }, "devDependencies": { "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.19.0", - "@playwright/test": "1.53.0", + "@playwright/test": "1.54.0", "@stylistic/eslint-plugin": "^3.0.1", "@types/chrome": "^0.0.315", "@types/debug": "^4.1.12", diff --git a/src/tools/utils.ts b/src/tools/utils.ts index 338c189..c365dc7 100644 --- a/src/tools/utils.ts +++ b/src/tools/utils.ts @@ -81,7 +81,7 @@ export async function generateLocator(locator: playwright.Locator): Promise { expect(await client.callTool({ name: 'browser_navigate', arguments: { url: server.HELLO_WORLD }, - })).toContainTextContent(`- generic [ref=e1]: Hello, world!`); + })).toContainTextContent(`- generic [active] [ref=e1]: Hello, world!`); }); test('cdp server reuse tab', async ({ cdpServer, startClient, server }) => { @@ -57,7 +57,7 @@ test('cdp server reuse tab', async ({ cdpServer, startClient, server }) => { - Page Title: Title - Page Snapshot \`\`\`yaml -- generic [ref=e1]: Hello, world! +- generic [active] [ref=e1]: Hello, world! \`\`\` `); }); @@ -78,7 +78,7 @@ test('should throw connection error and allow re-connecting', async ({ cdpServer expect(await client.callTool({ name: 'browser_navigate', arguments: { url: server.PREFIX }, - })).toContainTextContent(`- generic [ref=e1]: Hello, world!`); + })).toContainTextContent(`- generic [active] [ref=e1]: Hello, world!`); }); // NOTE: Can be removed when we drop Node.js 18 support and changed to import.meta.filename. diff --git a/tests/core.spec.ts b/tests/core.spec.ts index 93a81b4..2d138c8 100644 --- a/tests/core.spec.ts +++ b/tests/core.spec.ts @@ -31,13 +31,13 @@ await page.goto('${server.HELLO_WORLD}'); - Page Title: Title - Page Snapshot \`\`\`yaml -- generic [ref=e1]: Hello, world! +- generic [active] [ref=e1]: Hello, world! \`\`\` ` ); }); -test('browser_click', async ({ client, server }) => { +test('browser_click', async ({ client, server, mcpBrowser }) => { server.setContent('/', ` Title @@ -65,7 +65,7 @@ await page.getByRole('button', { name: 'Submit' }).click(); - Page Title: Title - Page Snapshot \`\`\`yaml -- button "Submit" [ref=e2] +- button "Submit" ${mcpBrowser === 'webkit' ? '' : '[active] '}[ref=e2] \`\`\` `); }); @@ -314,3 +314,22 @@ test('old locator error message', async ({ client, server }) => { }, })).toContainTextContent('Ref not found'); }); + +test('visibility: hidden > visible should be shown', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright-mcp/issues/535' } }, async ({ client, server }) => { + server.setContent('/', ` +
+
+ +
+
+ `, 'text/html'); + + await client.callTool({ + name: 'browser_navigate', + arguments: { url: server.PREFIX }, + }); + + expect(await client.callTool({ + name: 'browser_snapshot' + })).toContainTextContent('- button "Button"'); +}); diff --git a/tests/dialogs.spec.ts b/tests/dialogs.spec.ts index b70fe2d..b89613e 100644 --- a/tests/dialogs.spec.ts +++ b/tests/dialogs.spec.ts @@ -58,7 +58,7 @@ await page.getByRole('button', { name: 'Button' }).click(); - Page Title: - Page Snapshot \`\`\`yaml -- button "Button" [ref=e2] +- button "Button" [active] [ref=e2] \`\`\` `); }); @@ -136,7 +136,7 @@ test('confirm dialog (true)', async ({ client, server }) => { expect(result).toContainTextContent('// '); expect(result).toContainTextContent(`- Page Snapshot \`\`\`yaml -- generic [ref=e1]: "true" +- generic [active] [ref=e1]: "true" \`\`\``); }); @@ -171,7 +171,7 @@ test('confirm dialog (false)', async ({ client, server }) => { expect(result).toContainTextContent(`- Page Snapshot \`\`\`yaml -- generic [ref=e1]: "false" +- generic [active] [ref=e1]: "false" \`\`\``); }); @@ -207,6 +207,6 @@ test('prompt dialog', async ({ client, server }) => { expect(result).toContainTextContent(`- Page Snapshot \`\`\`yaml -- generic [ref=e1]: Answer +- generic [active] [ref=e1]: Answer \`\`\``); }); diff --git a/tests/files.spec.ts b/tests/files.spec.ts index 11ff58f..73573ef 100644 --- a/tests/files.spec.ts +++ b/tests/files.spec.ts @@ -28,7 +28,7 @@ test('browser_file_upload', async ({ client, server }, testInfo) => { arguments: { url: server.PREFIX }, })).toContainTextContent(` \`\`\`yaml -- generic [ref=e1]: +- generic [active] [ref=e1]: - button "Choose File" [ref=e2] - button "Button" [ref=e3] \`\`\``); @@ -65,12 +65,6 @@ The tool "browser_file_upload" can only be used when there is related modal stat }); expect(response).not.toContainTextContent('### Modal state'); - expect(response).toContainTextContent(` -\`\`\`yaml -- generic [ref=e1]: - - button "Choose File" [ref=e2] - - button "Button" [ref=e3] -\`\`\``); } { diff --git a/tests/iframes.spec.ts b/tests/iframes.spec.ts index f856270..49a79b3 100644 --- a/tests/iframes.spec.ts +++ b/tests/iframes.spec.ts @@ -24,10 +24,10 @@ test('stitched aria frames', async ({ client }) => { }, })).toContainTextContent(` \`\`\`yaml -- generic [ref=e1]: +- generic [active] [ref=e1]: - heading "Hello" [level=1] [ref=e2] - iframe [ref=e3]: - - generic [ref=f1e1]: + - generic [active] [ref=f1e1]: - button "World" [ref=f1e2] - main [ref=f1e3]: - iframe [ref=f1e4]: diff --git a/tests/launch.spec.ts b/tests/launch.spec.ts index 25a24e5..05c042c 100644 --- a/tests/launch.spec.ts +++ b/tests/launch.spec.ts @@ -34,7 +34,7 @@ test('test reopen browser', async ({ startClient, server, mcpMode }) => { expect(await client.callTool({ name: 'browser_navigate', arguments: { url: server.HELLO_WORLD }, - })).toContainTextContent(`- generic [ref=e1]: Hello, world!`); + })).toContainTextContent(`- generic [active] [ref=e1]: Hello, world!`); await client.close(); diff --git a/tests/pdf.spec.ts b/tests/pdf.spec.ts index 8af4667..6032b87 100644 --- a/tests/pdf.spec.ts +++ b/tests/pdf.spec.ts @@ -40,7 +40,7 @@ test('save as pdf', async ({ startClient, mcpBrowser, server }, testInfo) => { expect(await client.callTool({ name: 'browser_navigate', arguments: { url: server.HELLO_WORLD }, - })).toContainTextContent(`- generic [ref=e1]: Hello, world!`); + })).toContainTextContent(`- generic [active] [ref=e1]: Hello, world!`); const response = await client.callTool({ name: 'browser_pdf_save', @@ -58,7 +58,7 @@ test('save as pdf (filename: output.pdf)', async ({ startClient, mcpBrowser, ser expect(await client.callTool({ name: 'browser_navigate', arguments: { url: server.HELLO_WORLD }, - })).toContainTextContent(`- generic [ref=e1]: Hello, world!`); + })).toContainTextContent(`- generic [active] [ref=e1]: Hello, world!`); expect(await client.callTool({ name: 'browser_pdf_save', diff --git a/tests/tabs.spec.ts b/tests/tabs.spec.ts index 061e58c..448e04a 100644 --- a/tests/tabs.spec.ts +++ b/tests/tabs.spec.ts @@ -61,7 +61,7 @@ test('create new tab', async ({ client }) => { - Page Title: Tab one - Page Snapshot \`\`\`yaml -- generic [ref=e1]: Body one +- generic [active] [ref=e1]: Body one \`\`\``); expect(await createTab(client, 'Tab two', 'Body two')).toHaveTextContent(` @@ -80,7 +80,7 @@ test('create new tab', async ({ client }) => { - Page Title: Tab two - Page Snapshot \`\`\`yaml -- generic [ref=e1]: Body two +- generic [active] [ref=e1]: Body two \`\`\``); }); @@ -108,7 +108,7 @@ test('select tab', async ({ client }) => { - Page Title: Tab one - Page Snapshot \`\`\`yaml -- generic [ref=e1]: Body one +- generic [active] [ref=e1]: Body one \`\`\``); }); @@ -135,7 +135,7 @@ test('close tab', async ({ client }) => { - Page Title: Tab one - Page Snapshot \`\`\`yaml -- generic [ref=e1]: Body one +- generic [active] [ref=e1]: Body one \`\`\``); });