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
chore: roll lowire to v0.0.18 (#38765)
Pavel Feldman4572f2664188
diff --git a/package-lock.json b/package-lock.jsonindex 4a200b0199..4ee02fc2e2 100644--- a/package-lock.json+++ b/package-lock.json@@ -18,7 +18,7 @@"@eslint/compat": "^1.3.2","@eslint/eslintrc": "^3.3.1","@eslint/js": "^9.34.0",- "@lowire/loop": "^0.0.15",+ "@lowire/loop": "^0.0.18","@modelcontextprotocol/sdk": "^1.17.5","@octokit/graphql-schema": "^15.26.0","@stylistic/eslint-plugin": "^5.2.3",@@ -1065,9 +1065,9 @@}},"node_modules/@lowire/loop": {- "version": "0.0.15",- "resolved": "https://registry.npmjs.org/@lowire/loop/-/loop-0.0.15.tgz",- "integrity": "sha512-XycNy4hSRgfb54NHPf/TIRTC+UGpvZMg6z3T3IRgTprj/nUoW5/XKCR3a3dCO4RC88n8ARiTjgEtFfoJfH9S8w==",+ "version": "0.0.18",+ "resolved": "https://registry.npmjs.org/@lowire/loop/-/loop-0.0.18.tgz",+ "integrity": "sha512-ZusERFapOfczMai18jPV516lLOpC2Vu0yqOHIJ4W0gewfQ9T8VRgKQeX65NPrKAhVuxPtCJ2tvnW9I1bU3aBuA==","dev": true,"license": "Apache-2.0","engines": {diff --git a/package.json b/package.jsonindex 9f91b86b36..a5fbc8cf41 100644--- a/package.json+++ b/package.json@@ -55,7 +55,7 @@"@eslint/compat": "^1.3.2","@eslint/eslintrc": "^3.3.1","@eslint/js": "^9.34.0",- "@lowire/loop": "^0.0.15",+ "@lowire/loop": "^0.0.18","@modelcontextprotocol/sdk": "^1.17.5","@octokit/graphql-schema": "^15.26.0","@stylistic/eslint-plugin": "^5.2.3",diff --git a/packages/playwright-core/ThirdPartyNotices.txt b/packages/playwright-core/ThirdPartyNotices.txtindex 132673492a..97c06433bb 100644--- a/packages/playwright-core/ThirdPartyNotices.txt+++ b/packages/playwright-core/ThirdPartyNotices.txt@@ -4,7 +4,7 @@ THIRD-PARTY SOFTWARE NOTICES AND INFORMATIONThis project incorporates components from the projects listed below. The original copyright notices and the licenses under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.-- @lowire/[email protected] (https://github.com/pavelfeldman/lowire)+- @lowire/[email protected] (https://github.com/pavelfeldman/lowire)- @modelcontextprotocol/[email protected] (https://github.com/modelcontextprotocol/typescript-sdk)- [email protected] (https://github.com/jshttp/accepts)- [email protected] (https://github.com/TooTallNate/proxy-agents)@@ -135,7 +135,7 @@ This project incorporates components from the projects listed below. The origina- [email protected] (https://github.com/StefanTerdell/zod-to-json-schema)- [email protected] (https://github.com/colinhacks/zod)-%% @lowire/[email protected] NOTICES AND INFORMATION BEGIN HERE+%% @lowire/[email protected] NOTICES AND INFORMATION BEGIN HERE=========================================Apache LicenseVersion 2.0, January 2004@@ -339,7 +339,7 @@ Apache LicenseSee the License for the specific language governing permissions andlimitations under the License.=========================================-END OF @lowire/[email protected] AND INFORMATION+END OF @lowire/[email protected] AND INFORMATION%% @modelcontextprotocol/[email protected] NOTICES AND INFORMATION BEGIN HERE=========================================diff --git a/packages/playwright-core/bundles/mcp/package-lock.json b/packages/playwright-core/bundles/mcp/package-lock.jsonindex 10c5a8d6b6..5adb3518e1 100644--- a/packages/playwright-core/bundles/mcp/package-lock.json+++ b/packages/playwright-core/bundles/mcp/package-lock.json@@ -8,16 +8,16 @@"name": "mcp-bundle","version": "0.0.1","dependencies": {- "@lowire/loop": "^0.0.15",+ "@lowire/loop": "^0.0.18","@modelcontextprotocol/sdk": "^1.24.0","zod": "^3.25.76","zod-to-json-schema": "^3.24.6"}},"node_modules/@lowire/loop": {- "version": "0.0.15",- "resolved": "https://registry.npmjs.org/@lowire/loop/-/loop-0.0.15.tgz",- "integrity": "sha512-XycNy4hSRgfb54NHPf/TIRTC+UGpvZMg6z3T3IRgTprj/nUoW5/XKCR3a3dCO4RC88n8ARiTjgEtFfoJfH9S8w==",+ "version": "0.0.18",+ "resolved": "https://registry.npmjs.org/@lowire/loop/-/loop-0.0.18.tgz",+ "integrity": "sha512-ZusERFapOfczMai18jPV516lLOpC2Vu0yqOHIJ4W0gewfQ9T8VRgKQeX65NPrKAhVuxPtCJ2tvnW9I1bU3aBuA==","license": "Apache-2.0","engines": {"node": ">=20"diff --git a/packages/playwright-core/bundles/mcp/package.json b/packages/playwright-core/bundles/mcp/package.jsonindex b386ca3240..ab0c970c5d 100644--- a/packages/playwright-core/bundles/mcp/package.json+++ b/packages/playwright-core/bundles/mcp/package.json@@ -3,7 +3,7 @@"version": "0.0.1","private": true,"dependencies": {- "@lowire/loop": "^0.0.15",+ "@lowire/loop": "^0.0.18","@modelcontextprotocol/sdk": "^1.24.0","zod": "^3.25.76","zod-to-json-schema": "^3.24.6"diff --git a/packages/playwright-core/src/server/agent/actionRunner.ts b/packages/playwright-core/src/server/agent/actionRunner.tsindex af2994edac..1244fae2d7 100644--- a/packages/playwright-core/src/server/agent/actionRunner.ts+++ b/packages/playwright-core/src/server/agent/actionRunner.ts@@ -18,6 +18,7 @@ import { serializeExpectedTextValues } from '../utils/expectUtils';import { monotonicTime } from '../../utils/isomorphic/time';import { createGuid } from '../utils/crypto';import { parseAriaSnapshotUnsafe } from '../../utils/isomorphic/ariaSnapshot';+import { renderTitleForCall } from '../../utils/isomorphic/protocolFormatter';import { ProgressController } from '../progress';import { yaml } from '../../utilsBundle';import { serializeError } from '../errors';@@ -172,7 +173,7 @@ export function performActionTimeout(action: actions.Action): number {}}-export function traceParamsForAction(action: actions.Action): { method: string, title: string, params: any } {+export function traceParamsForAction(action: actions.Action): { title?: string, type: string, method: string, params: any } {const timeout = generateActionTimeout(action);switch (action.method) {case 'navigate': {@@ -180,7 +181,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,url: action.url,timeout,};- return { method: 'goto', title: 'Navigate', params };+ return { type: 'Frame', method: 'goto', params };}case 'click': {const params: channels.FrameClickParams = {@@ -191,7 +192,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,clickCount: action.clickCount,timeout,};- return { method: 'click', title: 'Click', params };+ return { type: 'Frame', method: 'click', params };}case 'drag': {const params: channels.FrameDragAndDropParams = {@@ -199,7 +200,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,target: action.targetSelector,timeout,};- return { method: 'dragAndDrop', title: 'Drag and Drop', params };+ return { type: 'Frame', method: 'dragAndDrop', params };}case 'hover': {const params: channels.FrameHoverParams = {@@ -207,13 +208,13 @@ export function traceParamsForAction(action: actions.Action): { method: string,modifiers: action.modifiers,timeout,};- return { method: 'hover', title: 'Hover', params };+ return { type: 'Frame', method: 'hover', params };}case 'pressKey': {const params: channels.PageKeyboardPressParams = {key: action.key,};- return { method: 'press', title: 'Press', params };+ return { type: 'Page', method: 'keyboardPress', params };}case 'pressSequentially': {const params: channels.FrameTypeParams = {@@ -221,7 +222,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,text: action.text,timeout,};- return { method: 'type', title: 'Type', params };+ return { type: 'Frame', method: 'type', params };}case 'fill': {const params: channels.FrameFillParams = {@@ -230,7 +231,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,value: action.text,timeout,};- return { method: 'fill', title: 'Fill', params };+ return { type: 'Frame', method: 'fill', params };}case 'setChecked': {if (action.checked) {@@ -239,14 +240,14 @@ export function traceParamsForAction(action: actions.Action): { method: string,strict: true,timeout,};- return { method: 'check', title: 'Check', params };+ return { type: 'Frame', method: 'check', params };} else {const params: channels.FrameUncheckParams = {selector: action.selector,strict: true,timeout,};- return { method: 'uncheck', title: 'Uncheck', params };+ return { type: 'Frame', method: 'uncheck', params };}}case 'selectOption': {@@ -256,7 +257,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,options: action.labels.map(label => ({ label })),timeout,};- return { method: 'selectOption', title: 'Select Option', params };+ return { type: 'Frame', method: 'selectOption', params };}case 'expectValue': {if (action.type === 'textbox' || action.type === 'combobox' || action.type === 'slider') {@@ -268,7 +269,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,isNot: !!action.isNot,timeout: kDefaultTimeout,};- return { method: 'expect', title: 'Expect Value', params };+ return { type: 'Frame', method: 'expect', title: 'Expect Value', params };} else if (action.type === 'checkbox' || action.type === 'radio') {// TODO: provide serialized expected valueconst params: channels.FrameExpectParams = {@@ -277,7 +278,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,isNot: !!action.isNot,timeout: kDefaultTimeout,};- return { method: 'expect', title: 'Expect Checked', params };+ return { type: 'Frame', method: 'expect', title: 'Expect Checked', params };} else {throw new Error(`Unsupported element type: ${action.type}`);}@@ -289,7 +290,7 @@ export function traceParamsForAction(action: actions.Action): { method: string,isNot: !!action.isNot,timeout: kDefaultTimeout,};- return { method: 'expect', title: 'Expect Visible', params };+ return { type: 'Frame', method: 'expect', title: 'Expect Visible', params };}case 'expectAria': {// TODO: provide serialized expected value@@ -300,13 +301,14 @@ export function traceParamsForAction(action: actions.Action): { method: string,isNot: !!action.isNot,timeout: kDefaultTimeout,};- return { method: 'expect', title: 'Expect Aria Snapshot', params };+ return { type: 'Frame', method: 'expect', title: 'Expect Aria Snapshot', params };}}}function callMetadataForAction(frame: Frame, action: actions.Action): CallMetadata {- const { method, title, params } = traceParamsForAction(action);+ const traceParams = traceParamsForAction(action);+ const title = renderTitleForCall(traceParams);const callMetadata: CallMetadata = {id: `call@${createGuid()}`,@@ -316,8 +318,8 @@ function callMetadataForAction(frame: Frame, action: actions.Action): CallMetadastartTime: monotonicTime(),endTime: 0,type: 'Frame',- method,- params,+ method: traceParams.method,+ params: traceParams.params,title,log: [],};diff --git a/packages/playwright-core/src/server/agent/pageAgent.ts b/packages/playwright-core/src/server/agent/pageAgent.tsindex 4b8425c74f..be64e92b00 100644--- a/packages/playwright-core/src/server/agent/pageAgent.ts+++ b/packages/playwright-core/src/server/agent/pageAgent.ts@@ -67,6 +67,7 @@ export async function pageAgentExpect(progress: Progress, context: Context, expe${expectation}`;+ callParams.maxTurns = callParams.maxTurns ?? 3;await runLoop(progress, context, expectTools, task, undefined, callParams);await updateCache(context, cacheKey);}@@ -94,6 +95,7 @@ async function runLoop(progress: Progress, context: Context, toolDefinitions: Toconst { full } = await page.snapshotForAI(progress);const { tools, callTool, reportedResult } = toolsForLoop(progress, context, toolDefinitions, { resultSchema });+ const secrets = Object.fromEntries((context.agentParams.secrets || [])?.map(s => ([s.name, s.value])));const loop = new Loop({api: context.agentParams.api as any,@@ -106,6 +108,7 @@ async function runLoop(progress: Progress, context: Context, toolDefinitions: Todebug,callTool,tools,+ secrets,...context.events,});