Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: do not run agents perform by default (#38596)

Pavel Feldman425a616083b2
diff --git a/docs/src/test-api/class-fullconfig.md b/docs/src/test-api/class-fullconfig.md
index 7ce3da974b..4a72cf0556 100644
--- a/docs/src/test-api/class-fullconfig.md
+++ b/docs/src/test-api/class-fullconfig.md
@@ -104,6 +104,12 @@ See [`property: TestConfig.reportSlowTests`].
Base directory for all relative paths used in the reporters.
+## property: FullConfig.runAgents
+* since: v1.58
+- type: <boolean>
+
+Run agents to generate the code for [`method: Page.perform`] and similar.
+
## property: FullConfig.shard
* since: v1.10
- type: <[null]|[Object]>
diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md
index d8247126c7..5b24da84c2 100644
--- a/docs/src/test-api/class-testconfig.md
+++ b/docs/src/test-api/class-testconfig.md
@@ -514,6 +514,12 @@ export default defineConfig({
});
```
+## property: TestConfig.runAgents
+* since: v1.58
+- type: ?<boolean>
+
+Run agents to generate the code for [`method: Page.perform`] and similar.
+
## property: TestConfig.shard
* since: v1.10
- type: ?<[null]|[Object]>
diff --git a/docs/src/test-api/class-testoptions.md b/docs/src/test-api/class-testoptions.md
index 98cd67238e..3e00f43929 100644
--- a/docs/src/test-api/class-testoptions.md
+++ b/docs/src/test-api/class-testoptions.md
@@ -46,9 +46,15 @@ export default defineConfig({
});
```
-## property: TestOptions.agent = %%-context-option-agent-%%
+## property: TestOptions.agent
* since: v1.58
-
+- type: <[Object]>
+ - `cachePathTemplate` ?<[string]> Cache file template to use/generate code for performed actions into.
+ - `maxTurns` ?<[int]> Maximum number of agentic turns to take per call. Defaults to 10.
+ - `maxTokens` ?<[int]> Maximum number of tokens to consume per call. The agentic loop will stop after input + output tokens exceed this value. Defaults on unlimited.
+ - `model` <[string]> Model identifier within provider.
+ - `provider` <[string]> LLM provider to use.
+ - `secrets` ?<[Object]<[string], [string]>> Secrets to hide from the LLM.
## property: TestOptions.baseURL = %%-context-option-baseURL-%%
* since: v1.10
diff --git a/examples/todomvc/tests/adding-new-todos/add-multiple-todos-2.spec.ts b/examples/todomvc/tests/adding-new-todos/add-multiple-todos-2.spec.ts
index 779aae1cfa..a0bdcc180f 100644
--- a/examples/todomvc/tests/adding-new-todos/add-multiple-todos-2.spec.ts
+++ b/examples/todomvc/tests/adding-new-todos/add-multiple-todos-2.spec.ts
@@ -4,8 +4,6 @@ test.use({
agent: {
provider: 'github',
model: 'gpt-4.1',
- cachePathTemplate: '{testDir}/{testFilePath}-cache.json',
- cacheMode: process.env.UPDATE_CACHE ? 'update' : process.env.CI ? 'force' : 'auto',
}
});
diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts
index 463ac13133..b16632e904 100644
--- a/packages/playwright/src/common/config.ts
+++ b/packages/playwright/src/common/config.ts
@@ -108,10 +108,11 @@ export class FullConfigInternal {
maxFailures: takeFirst(configCLIOverrides.debug ? 1 : undefined, configCLIOverrides.maxFailures, userConfig.maxFailures, 0),
metadata: metadata ?? userConfig.metadata,
preserveOutput: takeFirst(userConfig.preserveOutput, 'always'),
+ projects: [],
+ quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false),
reporter: takeFirst(configCLIOverrides.reporter, resolveReporters(userConfig.reporter, configDir), [[defaultReporter]]),
reportSlowTests: takeFirst(userConfig.reportSlowTests, { max: 5, threshold: 300_000 /* 5 minutes */ }),
- quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false),
- projects: [],
+ runAgents: takeFirst(configCLIOverrides.runAgents, userConfig.runAgents, false),
shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null),
tags: globalTags,
updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, 'missing'),
diff --git a/packages/playwright/src/common/ipc.ts b/packages/playwright/src/common/ipc.ts
index 42f5e40d4e..65ec1be783 100644
--- a/packages/playwright/src/common/ipc.ts
+++ b/packages/playwright/src/common/ipc.ts
@@ -42,6 +42,7 @@ export type ConfigCLIOverrides = {
ignoreSnapshots?: boolean;
updateSnapshots?: 'all' | 'changed' | 'missing' | 'none';
updateSourceMethod?: 'overwrite' | 'patch' | '3way';
+ runAgents?: boolean;
workers?: number | string;
projects?: { name: string, use?: any }[],
use?: any;
diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.ts
index b2bbc322f6..0bd6d0cb5f 100644
--- a/packages/playwright/src/index.ts
+++ b/packages/playwright/src/index.ts
@@ -125,7 +125,6 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
}, { scope: 'worker', timeout: 0 }],
acceptDownloads: [({ contextOptions }, use) => use(contextOptions.acceptDownloads ?? true), { option: true, box: true }],
- agent: [({ contextOptions }, use) => use(contextOptions.agent), { option: true, box: true }],
bypassCSP: [({ contextOptions }, use) => use(contextOptions.bypassCSP ?? false), { option: true, box: true }],
colorScheme: [({ contextOptions }, use) => use(contextOptions.colorScheme === undefined ? 'light' : contextOptions.colorScheme), { option: true, box: true }],
deviceScaleFactor: [({ contextOptions }, use) => use(contextOptions.deviceScaleFactor), { option: true, box: true }],
@@ -153,10 +152,10 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
}, { option: true, box: true }],
serviceWorkers: [({ contextOptions }, use) => use(contextOptions.serviceWorkers ?? 'allow'), { option: true, box: true }],
contextOptions: [{}, { option: true, box: true }],
+ agent: [({}, use) => use(undefined), { option: true, box: true }],
_combinedContextOptions: [async ({
acceptDownloads,
- agent,
bypassCSP,
clientCertificates,
colorScheme,
@@ -183,8 +182,6 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
const options: BrowserContextOptions = {};
if (acceptDownloads !== undefined)
options.acceptDownloads = acceptDownloads;
- if (agent !== undefined)
- options.agent = agent;
if (bypassCSP !== undefined)
options.bypassCSP = bypassCSP;
if (colorScheme !== undefined)
@@ -710,15 +707,17 @@ class ArtifactsRecorder {
}
private async _cloneAgentCache(options: BrowserContextOptions) {
- if (!this._agent || this._agent.cacheMode === 'ignore')
- return;
- if (!this._agent.cacheFile && !this._agent.cachePathTemplate)
+ if (!this._agent)
return;
- const cacheFile = this._agent.cacheFile ?? this._testInfo._applyPathTemplate(this._agent.cachePathTemplate!, 'cache', '.json');
+ const cachePathTemplate = this._agent.cachePathTemplate ?? '{testDir}/{testFilePath}-cache.json';
+ const cacheFile = this._testInfo._applyPathTemplate(cachePathTemplate, '', '.json');
const workerFile = await this._testInfo._cloneStorage(cacheFile);
- if (this._agent && workerFile)
- options.agent = { ...this._agent, cacheFile: workerFile };
+ options.agent = {
+ ...this._agent,
+ cacheFile: workerFile,
+ cacheMode: this._testInfo.config.runAgents ? 'update' : 'force',
+ };
}
private async _upstreamAgentCache(context: BrowserContextImpl) {
diff --git a/packages/playwright/src/isomorphic/teleReceiver.ts b/packages/playwright/src/isomorphic/teleReceiver.ts
index 2319d5ba72..43d94d0007 100644
--- a/packages/playwright/src/isomorphic/teleReceiver.ts
+++ b/packages/playwright/src/isomorphic/teleReceiver.ts
@@ -779,6 +779,7 @@ export const baseFullConfig: reporterTypes.FullConfig = {
tags: [],
updateSnapshots: 'missing',
updateSourceMethod: 'patch',
+ runAgents: false,
version: '',
workers: 0,
webServer: null,
diff --git a/packages/playwright/src/isomorphic/testServerInterface.ts b/packages/playwright/src/isomorphic/testServerInterface.ts
index 8cc611790d..e356678117 100644
--- a/packages/playwright/src/isomorphic/testServerInterface.ts
+++ b/packages/playwright/src/isomorphic/testServerInterface.ts
@@ -97,6 +97,7 @@ export interface TestServerInterface {
workers?: number | string;
updateSnapshots?: 'all' | 'changed' | 'missing' | 'none';
updateSourceMethod?: 'overwrite' | 'patch' | '3way';
+ runAgents?: boolean;
reporters?: string[],
trace?: 'on' | 'off';
video?: 'on' | 'off';
diff --git a/packages/playwright/src/program.ts b/packages/playwright/src/program.ts
index 922ea766e0..885668feec 100644
--- a/packages/playwright/src/program.ts
+++ b/packages/playwright/src/program.ts
@@ -305,6 +305,7 @@ function overridesFromOptions(options: { [key: string]: any }): ConfigCLIOverrid
ignoreSnapshots: options.ignoreSnapshots ? !!options.ignoreSnapshots : undefined,
updateSnapshots: options.updateSnapshots,
updateSourceMethod: options.updateSourceMethod,
+ runAgents: options.runAgents,
workers: options.workers,
};
@@ -408,6 +409,7 @@ const testOptions: [string, { description: string, choices?: string[], preset?:
['--repeat-each <N>', { description: `Run each test N times (default: 1)` }],
['--reporter <reporter>', { description: `Reporter to use, comma-separated, can be ${builtInReporters.map(name => `"${name}"`).join(', ')} (default: "${defaultReporter}")` }],
['--retries <retries>', { description: `Maximum retry count for flaky tests, zero for no retries (default: no retries)` }],
+ ['--run-agents', { description: `Run agents to generate the code for page.perform` }],
['--shard <shard>', { description: `Shard tests and execute only the selected shard, specify in the form "current/all", 1-based, for example "3/5"` }],
['--test-list <file>', { description: `Path to a file containing a list of tests to run. See https://playwright.dev/docs/test-cli for more details.` }],
['--test-list-invert <file>', { description: `Path to a file containing a list of tests to skip. See https://playwright.dev/docs/test-cli for more details.` }],
diff --git a/packages/playwright/src/runner/testRunner.ts b/packages/playwright/src/runner/testRunner.ts
index 0fd445df61..5639735add 100644
--- a/packages/playwright/src/runner/testRunner.ts
+++ b/packages/playwright/src/runner/testRunner.ts
@@ -68,6 +68,7 @@ export type RunTestsParams = {
workers?: number | string;
updateSnapshots?: 'all' | 'changed' | 'missing' | 'none';
updateSourceMethod?: 'overwrite' | 'patch' | '3way';
+ runAgents?: boolean;
reporters?: string[],
trace?: 'on' | 'off';
video?: 'on' | 'off';
@@ -331,6 +332,7 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {
},
...(params.updateSnapshots ? { updateSnapshots: params.updateSnapshots } : {}),
...(params.updateSourceMethod ? { updateSourceMethod: params.updateSourceMethod } : {}),
+ ...(params.runAgents ? { runAgents: params.runAgents } : {}),
...(params.workers ? { workers: params.workers } : {}),
};
diff --git a/packages/playwright/src/runner/testServer.ts b/packages/playwright/src/runner/testServer.ts
index 627e4f7a25..657d6700c1 100644
--- a/packages/playwright/src/runner/testServer.ts
+++ b/packages/playwright/src/runner/testServer.ts
@@ -78,6 +78,7 @@ export type RunTestsParams = {
workers?: number | string;
updateSnapshots?: 'all' | 'changed' | 'missing' | 'none';
updateSourceMethod?: 'overwrite' | 'patch' | '3way';
+ runAgents?: boolean;
reporters?: string[],
trace?: 'on' | 'off';
video?: 'on' | 'off';
diff --git a/packages/playwright/src/worker/testInfo.ts b/packages/playwright/src/worker/testInfo.ts
index 6564551723..09f6d8f13c 100644
--- a/packages/playwright/src/worker/testInfo.ts
+++ b/packages/playwright/src/worker/testInfo.ts
@@ -67,12 +67,21 @@ type SnapshotNames = {
};
type TestInfoCallbacks = {
- onStepBegin?: (payload: ipc.StepBeginPayload) => void;
- onStepEnd?: (payload: ipc.StepEndPayload) => void;
- onAttach?: (payload: ipc.AttachmentPayload) => void;
- onTestPaused?: (payload: ipc.TestPausedPayload) => Promise<ipc.ResumePayload>;
- onCloneStorage?: (payload: ipc.CloneStoragePayload) => Promise<string>;
- onUpstreamStorage?: (payload: ipc.UpstreamStoragePayload) => Promise<void>;
+ onStepBegin: (payload: ipc.StepBeginPayload) => void;
+ onStepEnd: (payload: ipc.StepEndPayload) => void;
+ onAttach: (payload: ipc.AttachmentPayload) => void;
+ onTestPaused: (payload: ipc.TestPausedPayload) => Promise<ipc.ResumePayload>;
+ onCloneStorage: (payload: ipc.CloneStoragePayload) => Promise<string>;
+ onUpstreamStorage: (payload: ipc.UpstreamStoragePayload) => Promise<void>;
+};
+
+export const emtpyTestInfoCallbacks: TestInfoCallbacks = {
+ onStepBegin: () => {},
+ onStepEnd: () => {},
+ onAttach: () => {},
+ onTestPaused: () => Promise.reject(new Error('TestInfoImpl not initialized')),
+ onCloneStorage: () => Promise.reject(new Error('TestInfoImpl not initialized')),
+ onUpstreamStorage: () => Promise.resolve(),
};
export class TestInfoImpl implements TestInfo {
@@ -347,7 +356,7 @@ export class TestInfoImpl implements TestInfo {
suggestedRebaseline: result.suggestedRebaseline,
annotations: step.info.annotations,
};
- this._callbacks.onStepEnd?.(payload);
+ this._callbacks.onStepEnd(payload);
}
if (step.group !== 'internal') {
const errorForTrace = step.error ? { name: '', message: step.error.message || '', stack: step.error.stack } : undefined;
@@ -370,7 +379,7 @@ export class TestInfoImpl implements TestInfo {
wallTime: Date.now(),
location: step.location,
};
- this._callbacks.onStepBegin?.(payload);
+ this._callbacks.onStepBegin(payload);
}
if (step.group !== 'internal') {
this._tracing.appendBeforeActionForStep({
@@ -468,7 +477,7 @@ export class TestInfoImpl implements TestInfo {
const location = (this._isFailure() ? this._errorLocation() : await this._testEndLocation()) ?? { file: this.file, line: this.line, column: this.column };
const step = this._addStep({ category: 'hook', title: 'Paused', location });
const result = await Promise.race([
- this._callbacks.onTestPaused!({ testId: this.testId, stepId: step.stepId, errors: this._isFailure() ? this.errors : [] }),
+ this._callbacks.onTestPaused({ testId: this.testId, stepId: step.stepId, errors: this._isFailure() ? this.errors : [] }),
this._interruptedPromise.then(() => 'interrupted' as const),
]);
if (result !== 'interrupted') {
@@ -523,7 +532,7 @@ export class TestInfoImpl implements TestInfo {
this._tracing.appendAfterActionForStep(stepId, undefined, [attachment]);
}
- this._callbacks.onAttach?.({
+ this._callbacks.onAttach({
testId: this.testId,
name: attachment.name,
contentType: attachment.contentType,
@@ -659,9 +668,9 @@ export class TestInfoImpl implements TestInfo {
this._timeoutManager.setTimeout(timeout);
}
- async _cloneStorage(cacheFileTemplate: string): Promise<string | undefined> {
+ async _cloneStorage(cacheFileTemplate: string): Promise<string> {
const storageFile = this._applyPathTemplate(cacheFileTemplate, 'cache', '.json');
- return await this._callbacks.onCloneStorage?.({ storageFile });
+ return await this._callbacks.onCloneStorage!({ storageFile });
}
async _upstreamStorage(workerFile: string) {
diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts
index 7bdcf385f9..ea70b028a7 100644
--- a/packages/playwright/src/worker/workerMain.ts
+++ b/packages/playwright/src/worker/workerMain.ts
@@ -22,7 +22,7 @@ import { setCurrentTestInfo, setIsWorkerProcess } from '../common/globals';
import { stdioChunkToParams } from '../common/ipc';
import { debugTest, relativeFilePath } from '../util';
import { FixtureRunner } from './fixtureRunner';
-import { TestSkipError, TestInfoImpl } from './testInfo';
+import { TestSkipError, TestInfoImpl, emtpyTestInfoCallbacks } from './testInfo';
import { testInfoError } from './util';
import { inheritFixtureNames } from '../common/fixtures';
import { PoolBuilder } from '../common/poolBuilder';
@@ -119,7 +119,7 @@ export class WorkerMain extends ProcessRunner {
return;
}
// Ignore top-level errors, they are already inside TestInfo.errors.
- const fakeTestInfo = new TestInfoImpl(this._config, this._project, this._params, undefined, 0, {});
+ const fakeTestInfo = new TestInfoImpl(this._config, this._project, this._params, undefined, 0, emtpyTestInfoCallbacks);
const runnable = { type: 'teardown' } as const;
// We have to load the project to get the right deadline below.
await fakeTestInfo._runWithTimeout(runnable, () => this._loadIfNeeded()).catch(() => {});
diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts
index aa94fed21e..20735502d4 100644
--- a/packages/playwright/types/test.d.ts
+++ b/packages/playwright/types/test.d.ts
@@ -1611,6 +1611,12 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
*/
retries?: number;
+ /**
+ * Run agents to generate the code for
+ * [page.perform(task[, options])](https://playwright.dev/docs/api/class-page#page-perform) and similar.
+ */
+ runAgents?: boolean;
+
/**
* Shard tests and execute only the selected shard. Specify in the one-based form like `{ total: 5, current: 2 }`.
*
@@ -2067,6 +2073,12 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
*/
rootDir: string;
+ /**
+ * Run agents to generate the code for
+ * [page.perform(task[, options])](https://playwright.dev/docs/api/class-page#page-perform) and similar.
+ */
+ runAgents: boolean;
+
/**
* See [testConfig.shard](https://playwright.dev/docs/api/class-testconfig#test-config-shard).
*/
@@ -6644,7 +6656,6 @@ export type Fixtures<T extends {} = {}, W extends {} = {}, PT extends {} = {}, P
[K in Exclude<keyof T, keyof PW | keyof PT>]?: TestFixtureValue<T[K], T & W & PT & PW> | [TestFixtureValue<T[K], T & W & PT & PW>, { scope?: 'test', auto?: boolean, option?: boolean, timeout?: number | undefined, title?: string, box?: boolean | 'self' }];
};
-type Agent = Exclude<BrowserContextOptions['agent'], undefined> & { cachePathTemplate?: string } | undefined;
type BrowserName = 'chromium' | 'firefox' | 'webkit';
type BrowserChannel = Exclude<LaunchOptions['channel'], undefined>;
type ColorScheme = Exclude<BrowserContextOptions['colorScheme'], undefined>;
@@ -6935,6 +6946,15 @@ export interface PlaywrightWorkerOptions {
export type ScreenshotMode = 'off' | 'on' | 'only-on-failure' | 'on-first-failure';
export type TraceMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'on-all-retries' | 'retain-on-first-failure';
export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry';
+export type Agent = {
+ provider: string;
+ model: string;
+ cachePathTemplate?: string;
+ maxTurns?: number;
+ maxTokens?: number;
+ runAgents?: boolean;
+ secrets?: { [key: string]: string };
+};
/**
* Playwright Test provides many options to configure test environment,
@@ -6975,11 +6995,7 @@ export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry';
*
*/
export interface PlaywrightTestOptions {
- /**
- * Agent settings for [page.perform(task[, options])](https://playwright.dev/docs/api/class-page#page-perform) and
- * [page.extract(query, schema[, options])](https://playwright.dev/docs/api/class-page#page-extract).
- */
- agent: Agent;
+ agent: Agent | undefined;
/**
* Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.
*
diff --git a/tests/library/perform-task.spec.ts b/tests/library/perform-task.spec.ts
index 0edc7c5d29..906e0061c7 100644
--- a/tests/library/perform-task.spec.ts
+++ b/tests/library/perform-task.spec.ts
@@ -22,8 +22,6 @@ test.use({
agent: {
provider: 'github',
model: 'gpt-4.1',
- cachePathTemplate: '{testDir}/{testFilePath}-cache.json',
- cacheMode: process.env.UPDATE_CACHE ? 'update' : process.env.CI ? 'force' : 'auto',
secrets: {
'x-secret-email': '[email protected]',
}
@@ -33,6 +31,7 @@ test.use({
test('page.perform', async ({ page, server }) => {
await page.goto(server.PREFIX + '/evals/fill-form.html');
page.on('agentturn', turn => {
+ // For debugging purposes it is on for now.
console.log('agentturn', turn);
});
await page.perform('Fill out the form with the following details:\n' +
diff --git a/tests/library/perform-task.spec.ts-cache.json b/tests/library/perform-task.spec.ts-cache.json
index ccd4d4a958..e1c65b0eb2 100644
--- a/tests/library/perform-task.spec.ts-cache.json
+++ b/tests/library/perform-task.spec.ts-cache.json
@@ -1,72 +1,72 @@
{
"Enter x-secret-email into the email field": {
- "timestamp": 1765673294749,
+ "timestamp": 1766011465551,
"actions": [
{
"method": "fill",
"selector": "internal:role=textbox[name=\"Email Address\"i]",
"text": "x-secret-email",
"code": "await page.getByRole('textbox', { name: 'Email Address' }).fill('x-secret-email');",
- "intent": "Enter 'x-secret-email' into the 'Email Address' textbox."
+ "intent": "Type 'x-secret-email' into the email field labeled 'Email Address'."
}
]
},
"Fill out the form with the following details:\nName: John Smith\nAddress: 1045 La Avenida St, Mountain View, CA 94043\nEmail: [email protected]": {
- "timestamp": 1765673328439,
+ "timestamp": 1766011466078,
"actions": [
{
"method": "fill",
"selector": "internal:role=textbox[name=\"Full Name *\"i]",
"text": "John Smith",
"code": "await page.getByRole('textbox', { name: 'Full Name *' }).fill('John Smith');",
- "intent": "Fill in the name, address, and email fields according to the provided user information."
+ "intent": "Fill in the name, address, and email fields with the user's provided information."
},
{
"method": "fill",
"selector": "internal:role=textbox[name=\"Email Address *\"i]",
"text": "[email protected]",
"code": "await page.getByRole('textbox', { name: 'Email Address *' }).fill('[email protected]');",
- "intent": "Fill in the name, address, and email fields according to the provided user information."
+ "intent": "Fill in the name, address, and email fields with the user's provided information."
},
{
"method": "fill",
"selector": "internal:role=textbox[name=\"Street Address *\"i]",
"text": "1045 La Avenida St",
"code": "await page.getByRole('textbox', { name: 'Street Address *' }).fill('1045 La Avenida St');",
- "intent": "Fill in the name, address, and email fields according to the provided user information."
+ "intent": "Fill in the name, address, and email fields with the user's provided information."
},
{
"method": "fill",
"selector": "internal:role=textbox[name=\"City *\"i]",
"text": "Mountain View",
"code": "await page.getByRole('textbox', { name: 'City *' }).fill('Mountain View');",
- "intent": "Fill in the name, address, and email fields according to the provided user information."
+ "intent": "Fill in the name, address, and email fields with the user's provided information."
},
{
"method": "fill",
"selector": "internal:role=textbox[name=\"State/Province *\"i]",
"text": "CA",
"code": "await page.getByRole('textbox', { name: 'State/Province *' }).fill('CA');",
- "intent": "Fill in the name, address, and email fields according to the provided user information."
+ "intent": "Fill in the name, address, and email fields with the user's provided information."
},
{
"method": "fill",
"selector": "internal:role=textbox[name=\"ZIP/Postal Code *\"i]",
"text": "94043",
"code": "await page.getByRole('textbox', { name: 'ZIP/Postal Code *' }).fill('94043');",
- "intent": "Fill in the name, address, and email fields according to the provided user information."
+ "intent": "Fill in the name, address, and email fields with the user's provided information."
}
]
},
"- Enter \"bogus\" into the email field\n - Check that the value is in fact \"bogus\"\n - Check that the error message is displayed": {
- "timestamp": 1765673309068,
+ "timestamp": 1766011480106,
"actions": [
{
"method": "fill",
"selector": "internal:role=textbox[name=\"Email Address\"i]",
"text": "bogus",
"code": "await page.getByRole('textbox', { name: 'Email Address' }).fill('bogus');",
- "intent": "Enter 'bogus' into the email field to simulate invalid input and test validation."
+ "intent": "Enter 'bogus' in the email field to test email validation and proceed to verification steps."
},
{
"method": "expectValue",
@@ -74,14 +74,14 @@
"type": "textbox",
"value": "bogus",
"code": "await expect(page.getByRole('textbox', { name: 'Email Address' })).toHaveValue('bogus');",
- "intent": "Check that the value in the email field is 'bogus'.\nCheck that the error message is displayed for the invalid email."
+ "intent": "Verify the value 'bogus' is present in the email input field.\nCheck for the presence of an error message after entering an invalid email."
},
{
"method": "expectVisible",
"selector": "internal:text=\"error\"i",
"code": "await expect(page.getByText('error')).toBeVisible();",
- "intent": "Check that the value in the email field is 'bogus'.\nCheck that the error message is displayed for the invalid email."
+ "intent": "Verify the value 'bogus' is present in the email input field.\nCheck for the presence of an error message after entering an invalid email."
}
]
}
-}
+}
\ No newline at end of file
diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.ts
index 4b2bec3390..9cf5e4291c 100644
--- a/utils/generate_types/overrides-test.d.ts
+++ b/utils/generate_types/overrides-test.d.ts
@@ -209,7 +209,6 @@ export type Fixtures<T extends {} = {}, W extends {} = {}, PT extends {} = {}, P
[K in Exclude<keyof T, keyof PW | keyof PT>]?: TestFixtureValue<T[K], T & W & PT & PW> | [TestFixtureValue<T[K], T & W & PT & PW>, { scope?: 'test', auto?: boolean, option?: boolean, timeout?: number | undefined, title?: string, box?: boolean | 'self' }];
};
-type Agent = Exclude<BrowserContextOptions['agent'], undefined> & { cachePathTemplate?: string } | undefined;
type BrowserName = 'chromium' | 'firefox' | 'webkit';
type BrowserChannel = Exclude<LaunchOptions['channel'], undefined>;
type ColorScheme = Exclude<BrowserContextOptions['colorScheme'], undefined>;
@@ -266,9 +265,18 @@ export interface PlaywrightWorkerOptions {
export type ScreenshotMode = 'off' | 'on' | 'only-on-failure' | 'on-first-failure';
export type TraceMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'on-all-retries' | 'retain-on-first-failure';
export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry';
+export type Agent = {
+ provider: string;
+ model: string;
+ cachePathTemplate?: string;
+ maxTurns?: number;
+ maxTokens?: number;
+ runAgents?: boolean;
+ secrets?: { [key: string]: string };
+};
export interface PlaywrightTestOptions {
- agent: Agent;
+ agent: Agent | undefined;
acceptDownloads: boolean;
bypassCSP: boolean;
colorScheme: ColorScheme;