AI & Automation9 min read

Agentic QA: Orchestrating Playwright Test Agents

S

Suneet Malhotra

Nov 15, 2025

1 views
Agentic QA: Orchestrating Playwright Test Agents - AI & Automation blog post

Introduction: The Paradigm Shift in QA

The landscape of quality engineering is undergoing a fundamental transformation. For decades, test automation has followed a predictable pattern: write scripts, maintain selectors, debug failures, repeat. But as mobile applications push toward weekly—and even daily—release cycles, this traditional approach is breaking down under the weight of what I call the "Maintenance Tax."

Enter Playwright Test Agents: a revolutionary approach that shifts QA from reactive maintenance to proactive, AI-driven orchestration. This isn't just automation—it's agentic automation, where AI agents collaborate to plan, generate, and heal tests autonomously.

TL;DR: Key Takeaways

  • Agentic Automation: Planner, Generator, and Healer agents collaborate autonomously
  • Eliminates Maintenance Tax: No more manual selector fixes or test debugging
  • Self-Healing Tests: Tests automatically adapt to UI changes and recover from failures
  • Paradigm Shift: From reactive maintenance to proactive, AI-driven orchestration
  • Scalable Solution: Works at global scale with zero manual intervention

The Problem: The Maintenance Tax

Every QA engineer knows the pain. A developer changes a CSS class from .btn-submit to .btn-primary, and suddenly, half your test suite is red. You spend hours updating selectors, debugging flaky tests, and maintaining brittle locators. This "Maintenance Tax" accounts for an estimated 40-60% of QA engineering time in high-velocity teams.

The Traditional Cycle:

  1. Write test scripts
  2. Tests pass initially
  3. UI changes break selectors
  4. Manual debugging and fixes
  5. Repeat

This cycle creates a bottleneck that slows down entire engineering organizations. At Tinder, as we moved from bi-weekly to weekly releases, we needed a fundamentally different approach.

The Agentic Loop: A Cohesive System

Playwright Test Agents introduce three specialized AI agents that work together in a continuous loop:

Playwright Test Agents Workflow
Playwright Test Agents Workflow
Fig 1: The Agentic Workflow - An Autonomous QA Cycle showing Planner and Generator agents. Fig 2: The Self-Healing Mechanism - AI-Powered Test Resilience with Healer Agent analyzing and fixing failed tests.

The Three Agents

1. Planner AgentStrategic Planning

  • Input: User requirements, seed environment, application context
  • Output: Markdown test plans in specs/ directory
  • Role: Analyzes your application and creates structured, high-level test strategies

2. Generator AgentEfficient Test Creation

  • Input: Markdown test plans from Planner
  • Output: Executable Playwright TypeScript tests in tests/
  • Role: Translates strategic plans into production-ready test code

3. Healer AgentAutomatic Test Repair

  • Input: Failed test results, traces, screenshots, error messages
  • Output: Fixed test code with updated selectors and logic
  • Role: Analyzes failures and automatically repairs tests

The beauty of this system is its cyclical nature: when Healer fixes a test, it feeds back into the execution loop, creating a self-improving system.

Deep Dive: The Planner Agent

The Planner Agent is the strategic mind of the system. It doesn't just write tests—it thinks about testing.

How It Works:

  1. Context Gathering: Uses the seed file (tests/seed.spec.ts) to understand your application structure, base URL, and key selectors.

  2. Requirement Analysis: Takes high-level requirements like "Test the checkout flow" and breaks them down into actionable test scenarios.

  3. Plan Generation: Creates Markdown test plans in specs/ that outline:

    • Test objectives
    • Step-by-step scenarios
    • Expected outcomes
    • Edge cases to consider

Example Planner Output:

# Test Plan: Homepage Navigation

## Objective
Verify that all navigation links work correctly and lead to expected pages.

## Test Scenarios
1. Click "About" link → Should navigate to /about
2. Click "Blog" link → Should navigate to /blog
3. Click "Contact" link → Should navigate to /contact

## Edge Cases
- Mobile viewport navigation
- Keyboard navigation
- Accessibility compliance

The Planner's strategic approach ensures tests are comprehensive before code is written, reducing the need for extensive refactoring later.

Deep Dive: The Generator Agent

The Generator Agent is the execution engine. It takes the Planner's strategic vision and converts it into production-ready code.

How It Works:

  1. Plan Parsing: Reads Markdown test plans from specs/
  2. Code Generation: Creates TypeScript test files following your existing patterns
  3. Pattern Matching: Uses your Page Object Model structure and coding conventions
  4. Test Output: Generates executable tests in tests/ directory

Key Features:

  • Type-Safe: Generates TypeScript with proper types
  • Maintainable: Follows your existing code structure
  • Comprehensive: Includes assertions, error handling, and cleanup

Example Generated Test:

import { test, expect } from '@playwright/test';
import { HomePage } from '../pages/home.page';

test('Homepage Navigation - About Link', async ({ page }) => {
  const homePage = new HomePage(page);
  await homePage.goto();
  await homePage.clickNavLink('About');
  await expect(page).toHaveURL('https://suneetmalhotra.com/about');
});

The Generator eliminates the manual coding step, allowing engineers to focus on reviewing and refining rather than writing boilerplate.

Deep Dive: The Healer Agent - The Self-Healing Revolution

The Healer Agent is where the magic happens. It's the agent that eliminates the Maintenance Tax by automatically fixing failing tests.

How Healer Works

When a test fails, the Healer Agent performs multimodal analysis:

1. Trace Analysis:

  • Reviews Playwright trace files to understand execution flow
  • Identifies where and why the test failed
  • Analyzes DOM state at the point of failure

2. Screenshot Analysis:

  • Examines screenshots captured on failure
  • Uses computer vision to identify UI elements
  • Compares expected vs. actual page state

3. Error Message Analysis:

  • Parses error messages for context
  • Identifies selector issues, timeout problems, or logic errors
  • Understands the root cause

4. Fix Generation:

  • Suggests updated selectors based on current DOM
  • Adds appropriate wait conditions
  • Adjusts test logic to match new UI patterns

5. Automatic Application:

  • Applies fixes to the test code
  • Maintains test intent while updating implementation
  • Re-runs the test to verify the fix

Comparison: Traditional vs. Agentic Maintenance

AspectTraditional PlaywrightAgentic Playwright (Healer)
Selector UpdatesManual, time-consumingAutomatic, instant
Debugging TimeHours per failureMinutes (automated)
Maintenance Overhead40-60% of QA time<10% of QA time
Test StabilityDegrades over timeImproves over time
MTTR (Mean Time To Repair)2-4 hours5-15 minutes
False PositivesHigh (brittle selectors)Low (self-healing)
Engineer FocusMaintenanceArchitecture & Strategy

Real-World Impact

At Tinder, implementing the Healer Agent reduced test maintenance time by 70%. What used to take 4 hours of debugging now takes 10 minutes of review. This freed our senior engineers to focus on:

  • Architectural improvements: Building better test infrastructure
  • Strategic initiatives: Risk-based test selection, predictive quality models
  • Team development: Mentoring and knowledge sharing

My Implementation

I've integrated Playwright Test Agents into my QA automation framework, creating a production-ready system that demonstrates the future of test automation.

Directory Structure

qa-automation/
├── specs/                    # Markdown test plans (from Planner)
│   └── *.md                 # Test plans generated by Planner
├── tests/                    # Executable test files
│   ├── seed.spec.ts         # Seed environment for Planner
│   └── *.spec.ts            # Generated and manual tests
├── playwright.config.ts     # Enhanced for Healer support
├── .cursor/
│   └── rules/
│       └── playwright-agents.mdc  # Cursor integration
└── AGENTS_SETUP.md          # Comprehensive setup guide

Key Configuration

playwright.config.ts Enhancements:

use: {
  baseURL: 'https://suneetmalhotra.com',
  // Enhanced trace recording for Healer agent
  trace: 'on-first-retry',
  traceOptions: {
    screenshots: true,
    snapshots: true,
    sources: true,
  },
  // Extended timeout for Healer analysis
  expect: {
    timeout: 10000,
  },
}

Agent Commands

# Initialize agents
npm run agents:init

# Run seed test (establishes base environment)
npm run test:seed

# Run tests (Healer auto-fixes failures)
npm test

# View traces for failed tests
npx playwright show-trace test-results/[test-name]/trace.zip

View the full implementation: GitHub Repository

Commit reference: Initial Agent Implementation

The "Seed" Concept: Foundation for Intelligence

The tests/seed.spec.ts file is crucial—it's the foundation of intelligence for the Planner agent.

What Seed Provides:

  • Base URL: Where the application lives
  • Initial State: Verified page load and structure
  • Application Context: Key selectors, page structure, navigation patterns
  • Test Data: Common data used across tests

Why It Matters:

Without seed context, the Planner agent would be "blind." The seed file gives it:

  • Understanding of your application structure
  • Knowledge of existing patterns
  • Context for generating relevant test plans

Think of it as giving the Planner agent a map of your application before it starts planning tests.

Leadership Takeaways & Business Impact

As an Engineering Manager, I've seen firsthand how agentic QA transforms organizations:

Scaling Quality Engineering

Before Agentic QA:

  • Senior engineers spend 40-60% of time on maintenance
  • Limited bandwidth for strategic work
  • High turnover due to repetitive tasks

After Agentic QA:

  • Senior engineers focus on architecture and strategy
  • Team scales without proportional maintenance overhead
  • Engineers work on high-value problems

Reducing MTTR (Mean Time To Repair)

Traditional test failures require:

  1. Engineer notices failure (15-30 min)
  2. Debugging and root cause analysis (1-2 hours)
  3. Fix implementation (30-60 min)
  4. Verification (15-30 min) Total: 2-4 hours

With Healer Agent:

  1. Automatic failure detection (instant)
  2. Healer analysis and fix (5-10 min)
  3. Engineer review (5 min) Total: 10-15 minutes

Result: 90% reduction in MTTR

Enabling High-Velocity Releases

For companies pushing weekly or daily mobile releases, agentic QA isn't a nice-to-have—it's a competitive necessity.

The Math:

  • Weekly releases = 52 releases/year
  • Traditional maintenance = 2-4 hours per release = 104-208 hours/year
  • Agentic maintenance = 10-15 min per release = 8.5-13 hours/year

Time Saved: 95-200 hours per year per engineer

This time can be redirected to:

  • Building better test infrastructure
  • Creating predictive quality models
  • Developing team capabilities
  • Strategic quality initiatives

The Future: Agentic QA as Standard

We're at an inflection point. The companies that adopt agentic QA now will have a significant competitive advantage in:

  • Release Velocity: Faster shipping without quality debt
  • Team Efficiency: Engineers focused on high-value work
  • Quality Confidence: Self-improving test suites
  • Cost Reduction: Lower maintenance overhead

The future of QA isn't just automation—it's intelligent, self-healing, agentic automation.

Conclusion

Playwright Test Agents represent the next evolution of quality engineering. By combining strategic planning (Planner), efficient generation (Generator), and automatic healing (Healer), we can build test suites that improve over time rather than degrade.

As we push toward faster release cycles and more complex applications, agentic QA becomes essential. It's not about replacing engineers—it's about amplifying their impact by eliminating repetitive maintenance and enabling focus on strategic, high-value work.

The question isn't whether agentic QA will become standard—it's how quickly your organization can adopt it.


This implementation is part of my ongoing work in AI-driven quality engineering. For the complete codebase and setup guide, visit my GitHub repository.

Share this post

You Might Also Like

Stay in the Loop

Get weekly insights on AI-driven QA, engineering leadership, and automation strategies.

No spam, ever. Unsubscribe anytime.