From 292e75d464fc9493b9dfb8de3544d603c5960035 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Fri, 2 May 2025 16:10:48 -0700 Subject: [PATCH] chore: roll Playwright to remove empty generic nodes (#330) --- package-lock.json | 28 ++++++++++++++-------------- package.json | 4 ++-- playwright.config.ts | 2 +- src/tools/utils.ts | 5 +---- tests/cdp.spec.ts | 6 +++--- tests/core.spec.ts | 2 +- tests/dialogs.spec.ts | 6 +++--- tests/files.spec.ts | 10 ++++------ tests/iframes.spec.ts | 14 ++++++-------- tests/launch.spec.ts | 2 +- tests/pdf.spec.ts | 2 +- tests/tabs.spec.ts | 8 ++++---- 12 files changed, 41 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9d5c019..59033c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,17 +11,17 @@ "dependencies": { "@modelcontextprotocol/sdk": "^1.10.1", "commander": "^13.1.0", - "playwright": "1.53.0-alpha-2025-04-25", + "playwright": "1.53.0-alpha-1746218818000", "yaml": "^2.7.1", "zod-to-json-schema": "^3.24.4" }, "bin": { - "mcp-server-playwright": "cli.mjs" + "mcp-server-playwright": "cli.js" }, "devDependencies": { "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.19.0", - "@playwright/test": "1.53.0-alpha-2025-04-25", + "@playwright/test": "1.53.0-alpha-1746218818000", "@stylistic/eslint-plugin": "^3.0.1", "@types/node": "^22.13.10", "@typescript-eslint/eslint-plugin": "^8.26.1", @@ -287,13 +287,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.53.0-alpha-2025-04-25", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.53.0-alpha-2025-04-25.tgz", - "integrity": "sha512-3y4C2ZjAc2oUpwavC2yG2JzH53TOKgcMZvWb5GmpxnOa6fhuSVXK0kIsiIaImKmdffIVM1agsqNHp8yldeBTHQ==", + "version": "1.53.0-alpha-1746218818000", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.53.0-alpha-1746218818000.tgz", + "integrity": "sha512-J05FD0oOCVbjbp4IjQi5tOPKywchi5EENS9jRjgkA5N9jd/+BaZ3jT8HlLMIgALdk/eLsprQa7vh9h45Q1FOPA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.53.0-alpha-2025-04-25" + "playwright": "1.53.0-alpha-1746218818000" }, "bin": { "playwright": "cli.js" @@ -3299,12 +3299,12 @@ } }, "node_modules/playwright": { - "version": "1.53.0-alpha-2025-04-25", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.53.0-alpha-2025-04-25.tgz", - "integrity": "sha512-b5VT4lWgyhhy99zHeCoUBt/FQckPxeQVA5ksvxBv0HeqcEvzZzhuyqrrcZewJyflE+5U+bmvqI+yoU0ks8mE3Q==", + "version": "1.53.0-alpha-1746218818000", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.53.0-alpha-1746218818000.tgz", + "integrity": "sha512-mVIjtdqIawIqWVyvCaLmV6XTALCT4oWWrbMjoHyyWRln3jQjnm3RUO9LkaINz+Yh88O3FkuY6RfjGXPXeFeJ4Q==", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.53.0-alpha-2025-04-25" + "playwright-core": "1.53.0-alpha-1746218818000" }, "bin": { "playwright": "cli.js" @@ -3317,9 +3317,9 @@ } }, "node_modules/playwright-core": { - "version": "1.53.0-alpha-2025-04-25", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.53.0-alpha-2025-04-25.tgz", - "integrity": "sha512-gjV01l6A4q/zg+/pwEX50k9lhYWaE9NcDVypSDD331jB3EYrdk0LeDQxqz5XFDOzq/tC/8QTouDs9a/s/p95hA==", + "version": "1.53.0-alpha-1746218818000", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.53.0-alpha-1746218818000.tgz", + "integrity": "sha512-iaIZmhO/psGssWpxIprJkFrn2h4xFjgL0jZsKGtReAMZ/XhlqMUJxtSitwWM4BV+wxJIptsZD0s5Ml2KU62Z3w==", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" diff --git a/package.json b/package.json index 76368ce..ae09414 100644 --- a/package.json +++ b/package.json @@ -37,14 +37,14 @@ "dependencies": { "@modelcontextprotocol/sdk": "^1.10.1", "commander": "^13.1.0", - "playwright": "1.53.0-alpha-2025-04-25", + "playwright": "1.53.0-alpha-1746218818000", "yaml": "^2.7.1", "zod-to-json-schema": "^3.24.4" }, "devDependencies": { "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.19.0", - "@playwright/test": "1.53.0-alpha-2025-04-25", + "@playwright/test": "1.53.0-alpha-1746218818000", "@stylistic/eslint-plugin": "^3.0.1", "@types/node": "^22.13.10", "@typescript-eslint/eslint-plugin": "^8.26.1", diff --git a/playwright.config.ts b/playwright.config.ts index 2a99955..c98b74c 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -24,7 +24,7 @@ export default defineConfig({ forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, - reporter: process.env.CI ? 'list' : [['list'], ['html']], + reporter: 'list', projects: [ { name: 'chrome' }, { name: 'msedge', use: { mcpBrowser: 'msedge' } }, diff --git a/src/tools/utils.ts b/src/tools/utils.ts index 16a35b9..6fd16d4 100644 --- a/src/tools/utils.ts +++ b/src/tools/utils.ts @@ -70,11 +70,8 @@ export async function waitForCompletion(context: Context, page: playwright.Pa } } -function sanitize(s: string) { - return s.replace(/[\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, '-'); -} - export function sanitizeForFilePath(s: string) { + const sanitize = (s: string) => s.replace(/[\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, '-'); const separator = s.lastIndexOf('.'); if (separator === -1) return sanitize(s); diff --git a/tests/cdp.spec.ts b/tests/cdp.spec.ts index 98e4944..0a047cb 100644 --- a/tests/cdp.spec.ts +++ b/tests/cdp.spec.ts @@ -23,7 +23,7 @@ test('cdp server', async ({ cdpEndpoint, startClient }) => { arguments: { url: 'data:text/html,TitleHello, world!', }, - })).toContainTextContent(`- text: Hello, world!`); + })).toContainTextContent(`- generic [ref=s1e2]: Hello, world!`); }); test('cdp server reuse tab', async ({ cdpEndpoint, startClient }) => { @@ -50,7 +50,7 @@ test('cdp server reuse tab', async ({ cdpEndpoint, startClient }) => { - Page Title: - Page Snapshot \`\`\`yaml -- text: hello world +- generic [ref=s1e2]: hello world \`\`\` `); }); @@ -70,5 +70,5 @@ test('should throw connection error and allow re-connecting', async ({ cdpEndpoi arguments: { url: 'data:text/html,TitleHello, world!', }, - })).toContainTextContent(`- text: Hello, world!`); + })).toContainTextContent(`- generic [ref=s1e2]: Hello, world!`); }); diff --git a/tests/core.spec.ts b/tests/core.spec.ts index bce5788..9e43933 100644 --- a/tests/core.spec.ts +++ b/tests/core.spec.ts @@ -33,7 +33,7 @@ await page.goto('data:text/html,TitleHello, world! { expect(result).toContainTextContent('// '); expect(result).toContainTextContent(`- Page Snapshot \`\`\`yaml -- text: "true" +- generic [ref=s2e2]: "true" \`\`\``); }); @@ -156,7 +156,7 @@ test('confirm dialog (false)', async ({ client }) => { expect(result).toContainTextContent(`- Page Snapshot \`\`\`yaml -- text: "false" +- generic [ref=s2e2]: "false" \`\`\``); }); @@ -187,6 +187,6 @@ test('prompt dialog', async ({ client }) => { expect(result).toContainTextContent(`- Page Snapshot \`\`\`yaml -- text: Answer +- generic [ref=s2e2]: Answer \`\`\``); }); diff --git a/tests/files.spec.ts b/tests/files.spec.ts index 8951f6f..1f168f6 100644 --- a/tests/files.spec.ts +++ b/tests/files.spec.ts @@ -26,9 +26,8 @@ test('browser_file_upload', async ({ client }) => { }, })).toContainTextContent(` \`\`\`yaml -- generic [ref=s1e2]: - - button "Choose File" [ref=s1e3] - - button "Button" [ref=s1e4] +- button "Choose File" [ref=s1e3] +- button "Button" [ref=s1e4] \`\`\``); { @@ -65,9 +64,8 @@ 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=s3e2]: - - button "Choose File" [ref=s3e3] - - button "Button" [ref=s3e4] +- button "Choose File" [ref=s3e3] +- button "Button" [ref=s3e4] \`\`\``); } diff --git a/tests/iframes.spec.ts b/tests/iframes.spec.ts index 47245be..00ef1af 100644 --- a/tests/iframes.spec.ts +++ b/tests/iframes.spec.ts @@ -24,14 +24,12 @@ test('stitched aria frames', async ({ client }) => { }, })).toContainTextContent(` \`\`\`yaml -- generic [ref=s1e2]: - - heading "Hello" [level=1] [ref=s1e3] - - iframe [ref=s1e4]: - - generic [ref=f1s1e2]: - - button "World" [ref=f1s1e3] - - main [ref=f1s1e4]: - - iframe [ref=f1s1e5]: - - paragraph [ref=f2s1e3]: Nested +- heading "Hello" [level=1] [ref=s1e3] +- iframe [ref=s1e4]: + - button "World" [ref=f1s1e3] + - main [ref=f1s1e4]: + - iframe [ref=f1s1e5]: + - paragraph [ref=f2s1e3]: Nested \`\`\``); expect(await client.callTool({ diff --git a/tests/launch.spec.ts b/tests/launch.spec.ts index bfca616..1f88346 100644 --- a/tests/launch.spec.ts +++ b/tests/launch.spec.ts @@ -34,7 +34,7 @@ test('test reopen browser', async ({ client }) => { arguments: { url: 'data:text/html,TitleHello, world!', }, - })).toContainTextContent(`- text: Hello, world!`); + })).toContainTextContent(`- generic [ref=s1e2]: Hello, world!`); }); test('executable path', async ({ startClient }) => { diff --git a/tests/pdf.spec.ts b/tests/pdf.spec.ts index 549ae7e..dd9cd8d 100644 --- a/tests/pdf.spec.ts +++ b/tests/pdf.spec.ts @@ -37,7 +37,7 @@ test('save as pdf', async ({ client, mcpBrowser }) => { arguments: { url: 'data:text/html,TitleHello, world!', }, - })).toContainTextContent(`- text: Hello, world!`); + })).toContainTextContent(`- generic [ref=s1e2]: Hello, world!`); const response = await client.callTool({ name: 'browser_pdf_save', diff --git a/tests/tabs.spec.ts b/tests/tabs.spec.ts index 9582ab3..e03326e 100644 --- a/tests/tabs.spec.ts +++ b/tests/tabs.spec.ts @@ -63,7 +63,7 @@ test('create new tab', async ({ client }) => { - Page Title: Tab one - Page Snapshot \`\`\`yaml -- text: Body one +- generic [ref=s1e2]: Body one \`\`\``); expect(await createTab(client, 'Tab two', 'Body two')).toHaveTextContent(` @@ -82,7 +82,7 @@ test('create new tab', async ({ client }) => { - Page Title: Tab two - Page Snapshot \`\`\`yaml -- text: Body two +- generic [ref=s1e2]: Body two \`\`\``); }); @@ -110,7 +110,7 @@ test('select tab', async ({ client }) => { - Page Title: Tab one - Page Snapshot \`\`\`yaml -- text: Body one +- generic [ref=s2e2]: Body one \`\`\``); }); @@ -137,7 +137,7 @@ test('close tab', async ({ client }) => { - Page Title: Tab one - Page Snapshot \`\`\`yaml -- text: Body one +- generic [ref=s2e2]: Body one \`\`\``); });