Playmatic tests use a combination of natural language with Playwright-compatible cache functions.Natural language instructions are used by a computer use agent to self-heal tests and complete actions that are difficult to test with stable selectors (e.g., smart waiting, smart assertions, or dynamic UIs).Cache functions make test actions fast and deterministic.
Copy
// natural language step as a fall back actiontestStep('Create first label', async ({ page }) => { // playwright cache function const createLabelButton = page.getByRole('button', { name: /create.*label/i }).or( page.getByRole('button', { name: /new label/i }).or( page.getByRole('button', { name: /add.*label/i }) ) ); await createLabelButton.click(); }, { // toggle to turn off self-healing when cache exists cacheOnly: true });
Combined, this framework gives developers the control to write fast tests that leverage the reasoning capabilities of agents.
The cache function is always executed first. If the cache function fails, a computer use agent will take action using the natural language instruction.If you prefer the test to not self-heal, this is a parameter that can be configured. Learn more in the writing tests guide.
We recommend using a coding agent (like Cursor or Claude Code) with our automatically loaded context file to create tests.The context file provides your coding agent with complete SDK documentation, testing patterns, and best practices to generate robust Playmatic tests.You can always further refine the generated tests using custom code and Playmatic primitives.