Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/roll_browser_into_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
BROWSER: ${{ github.event.client_payload.browser }}
REVISION: ${{ github.event.client_payload.revision }}
BROWSER_VERSION: ${{ github.event.client_payload.browserVersion }}

permissions:
contents: write
Expand All @@ -29,7 +30,7 @@ jobs:
run: npx playwright install-deps
- name: Roll to new revision
run: |
./utils/roll_browser.js $BROWSER $REVISION
./utils/roll_browser.js $BROWSER $REVISION $BROWSER_VERSION
npm run build
- name: Prepare branch
id: prepare-branch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@
"The URL changes to #/active": {
"actions": [
{
"method": "expectVisible",
"selector": "internal:role=link[name=\"Active\"i]",
"code": "await expect(page.getByRole('link', { name: 'Active' })).toBeVisible();"
"method": "expectURL",
"regex": "/.*#/active$/",
"code": "await expect(page).toHaveURL(/.*#\\/active$/);"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@
"The URL changes to #/completed": {
"actions": [
{
"method": "expectVisible",
"selector": "internal:role=link[name=\"Completed\"i]",
"code": "await expect(page.getByRole('link', { name: 'Completed' })).toBeVisible();"
"method": "expectURL",
"regex": "/.*#/completed$/",
"code": "await expect(page).toHaveURL(/.*#\\/completed$/);"
}
]
},
"Two todos are marked as complete": {
"actions": [
{
"method": "expectVisible",
"selector": "internal:text=\"1\"i",
"code": "await expect(page.getByText('1')).toBeVisible();"
"selector": "internal:role=button[name=\"Clear completed\"i]",
"code": "await expect(page.getByRole('button', { name: 'Clear completed' })).toBeVisible();"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
"The URL changes to #/": {
"actions": [
{
"method": "expectVisible",
"selector": "internal:role=link[name=\"All\"i]",
"code": "await expect(page.getByRole('link', { name: 'All' })).toBeVisible();"
"method": "expectURL",
"regex": "/.*#/$/",
"code": "await expect(page).toHaveURL(/.*#\\/$/);"
}
]
},
Expand Down
18 changes: 13 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
"ws": "^8.17.1",
"xml2js": "^0.5.0",
"yaml": "2.6.0",
"zod": "^3.25.76",
"zod-to-json-schema": "^3.25.1"
"zod": "^4.3.5"
}
}
7 changes: 6 additions & 1 deletion packages/injected/src/injectedScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ import type { ElementText, TextMatcher } from './selectorUtils';
import type { Builtins } from './utilityScript';


export type FrameExpectParams = Omit<channels.FrameExpectParams, 'expectedValue' | 'timeout'> & { expectedValue?: any };
export type FrameExpectParams = Omit<channels.FrameExpectParams, 'expectedValue' | 'timeout'> & {
expectedValue?: any;
timeoutForLogs?: number;
explicitTimeout?: number;
noPreChecks?: boolean;
};

export type ElementState = 'visible' | 'hidden' | 'enabled' | 'disabled' | 'editable' | 'checked' | 'unchecked' | 'indeterminate' | 'stable';
export type ElementStateWithoutStable = Exclude<ElementState, 'stable'>;
Expand Down
8 changes: 5 additions & 3 deletions packages/playwright-client/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ type ElementHandleWaitForSelectorOptionsNotHidden = ElementHandleWaitForSelector
};

// @ts-ignore this will be any if zod is not installed
type ZodTypeAny = import('zod').ZodTypeAny;
import { ZodTypeAny, z } from 'zod';
// @ts-ignore this will be any if zod is not installed
type ZodInfer<T extends ZodTypeAny> = import('zod').infer<T>;
import * as z3 from 'zod/v3';
type ZodSchema = ZodTypeAny | z3.ZodTypeAny;
type InferZodSchema<T extends ZodSchema> = T extends z3.ZodTypeAny ? z3.infer<T> : T extends ZodTypeAny ? z.infer<T> : never;

/**
* Page provides methods to interact with a single tab in a [Browser](https://playwright.dev/docs/api/class-browser),
Expand Down Expand Up @@ -5305,7 +5307,7 @@ export interface PageAgent {
* @param schema
* @param options
*/
extract<Schema extends ZodTypeAny>(query: string, schema: Schema): Promise<{ result: ZodInfer<Schema>, usage: { turns: number, inputTokens: number, outputTokens: number } }>;
extract<Schema extends ZodSchema>(query: string, schema: Schema): Promise<{ result: InferZodSchema<Schema>, usage: { turns: number, inputTokens: number, outputTokens: number } }>;
/**
* Emitted when the agent makes a turn.
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/playwright-core/ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ This project incorporates components from the projects listed below. The origina
- [email protected] (https://github.com/thejoshwolfe/yauzl)
- [email protected] (https://github.com/thejoshwolfe/yazl)
- [email protected] (https://github.com/StefanTerdell/zod-to-json-schema)
- zod@3.25.76 (https://github.com/colinhacks/zod)
- zod@4.3.5 (https://github.com/colinhacks/zod)

%% @hono/[email protected] NOTICES AND INFORMATION BEGIN HERE
=========================================
Expand Down Expand Up @@ -4043,7 +4043,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
=========================================
END OF [email protected] AND INFORMATION

%% zod@3.25.76 NOTICES AND INFORMATION BEGIN HERE
%% zod@4.3.5 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License

Expand All @@ -4067,7 +4067,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=========================================
END OF zod@3.25.76 AND INFORMATION
END OF zod@4.3.5 AND INFORMATION

SUMMARY BEGIN HERE
=========================================
Expand Down
9 changes: 4 additions & 5 deletions packages/playwright-core/bundles/mcp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/playwright-core/bundles/mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@lowire/loop": "^0.0.23",
"@modelcontextprotocol/sdk": "^1.25.2",
"zod": "^3.25.76",
"zod": "^4.3.5",
"zod-to-json-schema": "^3.25.1"
}
}
2 changes: 1 addition & 1 deletion packages/playwright-core/bundles/mcp/src/mcpBundleImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ export { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/
export { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
export { CallToolRequestSchema, ListRootsRequestSchema, ListToolsRequestSchema, PingRequestSchema, ProgressNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
export { Loop } from '@lowire/loop';
export { z } from 'zod';
export * as z from 'zod';
export { zodToJsonSchema } from 'zod-to-json-schema';
12 changes: 1 addition & 11 deletions packages/playwright-core/bundles/utils/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/playwright-core/bundles/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"signal-exit": "3.0.7",
"socks-proxy-agent": "8.0.5",
"ws": "8.17.1",
"yaml": "^2.6.0",
"zod": "^3.25.76"
"yaml": "^2.6.0"
},
"devDependencies": {
"@types/debug": "^4.1.7",
Expand Down
3 changes: 0 additions & 3 deletions packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,3 @@ export const wsSender = Sender;

import yamlLibrary from 'yaml';
export const yaml = yamlLibrary;

import zodLibrary from 'zod';
export const zod = zodLibrary;
3 changes: 1 addition & 2 deletions packages/playwright-core/src/client/pageAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { Events } from './events';
import { Page } from './page';

import type * as api from '../../types/types';
import type z from 'zod';
import type * as channels from '@protocol/channels';

type PageAgentOptions = {
Expand Down Expand Up @@ -51,7 +50,7 @@ export class PageAgent extends ChannelOwner<channels.PageAgentChannel> implement
return { usage };
}

async extract<Schema extends z.ZodTypeAny>(query: string, schema: Schema, options: PageAgentOptions = {}): Promise<{ result: z.infer<Schema>, usage: channels.AgentUsage }> {
async extract<Schema extends any>(query: string, schema: Schema, options: PageAgentOptions = {}): Promise<{ result: any, usage: channels.AgentUsage }> {
const { result, usage } = await this._channel.extract({ query, schema: this._page._platform.zodToJsonSchema(schema), ...options });
return { result, usage };
}
Expand Down
Loading
Loading