Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(cli): preserve leading zeros in positional string arguments (#39215)
Yury Semikhatsky63a05f85dbe5
diff --git a/packages/playwright/src/mcp/terminal/program.ts b/packages/playwright/src/mcp/terminal/program.tsindex dabfb22d41..84e2a1c956 100644--- a/packages/playwright/src/mcp/terminal/program.ts+++ b/packages/playwright/src/mcp/terminal/program.ts@@ -494,7 +494,7 @@ export async function program(packageLocation: string) {const argv = process.argv.slice(2);const boolean = [...help.booleanOptions, ...booleanOptions];- const args: MinimistArgs = require('minimist')(argv, { boolean });+ const args: MinimistArgs = require('minimist')(argv, { boolean, string: ['_'] });for (const [key, value] of Object.entries(args)) {if (key !== '_' && typeof value !== 'boolean')args[key] = String(value);diff --git a/tests/mcp/cli-parsing.spec.ts b/tests/mcp/cli-parsing.spec.tsindex f8d1c448ac..162e568621 100644--- a/tests/mcp/cli-parsing.spec.ts+++ b/tests/mcp/cli-parsing.spec.ts@@ -59,3 +59,12 @@ test('wrong argument type', async ({ cli, server }) => {const press = await cli('press', '5');expect(press.exitCode).toBe(0);});++test('should preserve leading zeros in string arguments', async ({ cli, server }) => {+ server.setContent('/', `<input type=text>`, 'text/html');+ await cli('open', server.PREFIX);+ await cli('click', 'e2');+ await cli('type', '0812345679');+ const { snapshot } = await cli('snapshot');+ expect(snapshot).toContain(`0812345679`);+});