DEV Community

Cover image for Playwright Agents: Planner, Generator, and Healer in Action

Playwright Agents: Planner, Generator, and Healer in Action

Debbie O'Brien on October 06, 2025

Playwright has introduced a powerful new feature: Playwright Agents, new in Version 1.56. These agents can generate test plans, create tests based ...
Collapse
 
vinav_mevada_4176b941c4c9 profile image
Vinav Mevada

I am getting below exception while executing code .

Error: Playwright Test did not expect test() to be called here.
Most common reasons include:

  • You are calling test() in a configuration file.
  • You are calling test() in a file that is imported by the configuration file.
  • You have two different versions of @playwright/test. This usually happens when one of the dependencies in your package.json depends on @playwright/test.

at seed.spec.ts:3

1 | import { test, expect } from '@playwright/test';
2 |

3 | test('User is able to login', async ({ page }) => {
| ^
4 | await page.goto('thinking-tester-contact-list.herok...);

Collapse
 
vinav_mevada_4176b941c4c9 profile image
Vinav Mevada

import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
testDir: './tests',
testMatch: ['*/.spec.ts'], // only runs .spec.ts files
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [['html', { open: 'never' }]],
use: {
baseURL: 'thinking-tester-contact-list.herok...',
trace: 'on-first-retry',
headless: false,
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],

// optional web server (disable if not needed)
// webServer: {
// command: 'npm run start',
// url: 'localhost:3000',
// reuseExistingServer: !process.env.CI,
// },
});
this is playwright.config.ts file.could you please look into it ?

Collapse
 
lokeshtheramaraja profile image
Lokesh Theramaraja

I am getting the same.. pls assist

Collapse
 
carien_hartzenberg_9ee032 profile image
Carien Hartzenberg • Edited

@debs_obrien As a huge Playwright fan, this functionality really has me super excited and I am starting to play around and "test" it a little.
I am also very curious about the security behind these agents? Coming from a security software industry, I am super reluctant to just have any AI access my Automation "secrets". Some of my project store the secrets (credentials, api keys, database connection strings etc) in Azure Keyvault and others in appsettings for instance. I do not feel comfortable running my automation tests, extracting these sensitive information via my secret provider service, and have the Playwright agents access it in any way?

Does Playwright use a RAG at all? and how safe is it to have the Playwright planner for instance, access a website and then logging in with credentials either from storage state or provided via my secret provider service (a function I built in my framework)?

Collapse
 
varun_kumar_5778fd2f95b09 profile image
varun kumar

@debs_obrien Thanks this is great explanation. Just curious, these agents are using playwright MCP server under the hood , or we need to have playwright map server configured as well as a pre-requisite.

Collapse
 
lokeshtheramaraja profile image
Lokesh Theramaraja

Getting below error for me and my whole team. unable to find any answers anywhere... pls assist folks.

Collapse
 
slobo989 profile image
Slobo989

There is a bug opened for this:
github.com/microsoft/playwright/is...

Collapse
 
oscaruzzo profile image
Oscaruzzo

Interesting, but when I try the step "In VS Code open chat mode and select the Playwright Planner Agent" I press ctrl+alt+i and I see no chat mode selection.

Collapse
 
oscaruzzo profile image
Oscaruzzo

I enabled agent mode in VSCode according to this document (it would be nice if you mention it as a prerequisite) code.visualstudio.com/docs/copilot...

But the planner agent does not really open any browser on my pages (I added a page.goto(...) in my seed file).

Collapse
 
debs_obrien profile image
Debbie O'Brien Playwright end to end Testing

Interesting. Thanks. Am using VS Code Insiders which is the latest build of VS Code. They should be releasing this week and that should fix some issues. Thought agent mode was turned on by default

Collapse
 
slobo989 profile image
Slobo989

Hello @debs_obrien is there a plan to release these agents to .net version of playwright?

Collapse
 
kailashpathak7 profile image
Kailash P.

Thanks Deb .. Explained very well.