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
7 changes: 5 additions & 2 deletions docs/src/test-api/class-fullconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,12 @@ Base directory for all relative paths used in the reporters.

## property: FullConfig.runAgents
* since: v1.58
- type: <boolean>
- type: <['RunAgentsMode]<"all"|"missing"|"none">>

Run agents to generate the code for [`method: Page.perform`] and similar.
Whether to run LLM agent for [`method: Page.perform`]:
* "all" disregards existing cache and performs all actions via LLM
* "missing" only performs actions that don't have generated cache actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this one also update failing performs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear yet :)

* "none" does not talk to LLM at all, relies on the cached actions (default)

## property: FullConfig.shard
* since: v1.10
Expand Down
7 changes: 5 additions & 2 deletions docs/src/test-api/class-testconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,12 @@ export default defineConfig({

## property: TestConfig.runAgents
* since: v1.58
- type: ?<boolean>
- type: ?<['RunAgentsMode]<"all"|"missing"|"none">>

Run agents to generate the code for [`method: Page.perform`] and similar.
Whether to run LLM agent for [`method: Page.perform`]:
* "all" disregards existing cache and performs all actions via LLM
* "missing" only performs actions that don't have generated cache actions
* "none" does not talk to LLM at all, relies on the cached actions (default)

## property: TestConfig.shard
* since: v1.10
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class FullConfigInternal {
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 */ }),
runAgents: takeFirst(configCLIOverrides.runAgents, userConfig.runAgents, false),
runAgents: takeFirst(configCLIOverrides.runAgents, userConfig.runAgents, 'none'),
shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null),
tags: globalTags,
updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, 'missing'),
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/common/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type ConfigCLIOverrides = {
ignoreSnapshots?: boolean;
updateSnapshots?: 'all' | 'changed' | 'missing' | 'none';
updateSourceMethod?: 'overwrite' | 'patch' | '3way';
runAgents?: boolean;
runAgents?: 'all' | 'missing' | 'none';
workers?: number | string;
projects?: { name: string, use?: any }[],
use?: any;
Expand Down
4 changes: 3 additions & 1 deletion packages/playwright/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,11 @@ class ArtifactsRecorder {
this._agentCacheFile = this._testInfo._applyPathTemplate(cachePathTemplate, '', '.json');
this._agentCacheOutFile = path.join(this._testInfo.artifactsDir(), 'agent-cache-' + createGuid() + '.json');

const cacheFile = this._testInfo.config.runAgents ? undefined : await this._testInfo._cloneStorage(this._agentCacheFile);
const cacheFile = this._testInfo.config.runAgents === 'all' ? undefined : await this._testInfo._cloneStorage(this._agentCacheFile);
options.agent = {
...this._agent,
provider: this._testInfo.config.runAgents !== 'none' ? this._agent.provider : undefined,
model: this._testInfo.config.runAgents !== 'none' ? this._agent.model : undefined,
cacheFile,
cacheOutFile: this._agentCacheOutFile,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/isomorphic/teleReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ export const baseFullConfig: reporterTypes.FullConfig = {
tags: [],
updateSnapshots: 'missing',
updateSourceMethod: 'patch',
runAgents: false,
runAgents: 'none',
version: '',
workers: 0,
webServer: null,
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/isomorphic/testServerInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface TestServerInterface {
workers?: number | string;
updateSnapshots?: 'all' | 'changed' | 'missing' | 'none';
updateSourceMethod?: 'overwrite' | 'patch' | '3way';
runAgents?: boolean;
runAgents?: 'all' | 'missing' | 'none';
reporters?: string[],
trace?: 'on' | 'off';
video?: 'on' | 'off';
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +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` }],
['--run-agents <mode>', { description: `Run agents to generate the code for page.perform`, choices: ['missing', 'all', 'none'], preset: 'none' }],
['--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.` }],
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/runner/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export type RunTestsParams = {
workers?: number | string;
updateSnapshots?: 'all' | 'changed' | 'missing' | 'none';
updateSourceMethod?: 'overwrite' | 'patch' | '3way';
runAgents?: boolean;
runAgents?: 'all' | 'missing' | 'none';
reporters?: string[],
trace?: 'on' | 'off';
video?: 'on' | 'off';
Expand Down
20 changes: 13 additions & 7 deletions packages/playwright/types/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1612,10 +1612,13 @@ 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.
* Whether to run LLM agent for
* [page.perform(task[, options])](https://playwright.dev/docs/api/class-page#page-perform):
* - "all" disregards existing cache and performs all actions via LLM
* - "missing" only performs actions that don't have generated cache actions
* - "none" does not talk to LLM at all, relies on the cached actions (default)
*/
runAgents?: boolean;
runAgents?: "all"|"missing"|"none";

/**
* Shard tests and execute only the selected shard. Specify in the one-based form like `{ total: 5, current: 2 }`.
Expand Down Expand Up @@ -2074,10 +2077,13 @@ 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.
* Whether to run LLM agent for
* [page.perform(task[, options])](https://playwright.dev/docs/api/class-page#page-perform):
* - "all" disregards existing cache and performs all actions via LLM
* - "missing" only performs actions that don't have generated cache actions
* - "none" does not talk to LLM at all, relies on the cached actions (default)
*/
runAgents: boolean;
runAgents: "all"|"missing"|"none";

/**
* See [testConfig.shard](https://playwright.dev/docs/api/class-testconfig#test-config-shard).
Expand Down Expand Up @@ -6952,7 +6958,7 @@ export type Agent = {
cachePathTemplate?: string;
maxTurns?: number;
maxTokens?: number;
runAgents?: boolean;
runAgents?: 'all' | 'missing' | 'none';
secrets?: { [key: string]: string };
};

Expand Down
2 changes: 1 addition & 1 deletion utils/generate_types/overrides-test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export type Agent = {
cachePathTemplate?: string;
maxTurns?: number;
maxTokens?: number;
runAgents?: boolean;
runAgents?: 'all' | 'missing' | 'none';
secrets?: { [key: string]: string };
};

Expand Down
Loading