From Description to Playwright: How Testoro Generates Tests
Ever wondered what happens between typing "test that users can log in" and getting a complete Playwright .spec.ts file? This article walks through Testoro's generation pipeline step by step.
The Pipeline
Testoro's test generation follows a four-stage pipeline:
Let's dive into each stage.
Stage 1: Input Parsing
Users provide test descriptions in one of two formats:
Natural language description:
"Navigate to the login page, enter valid credentials, submit the form, and verify the dashboard loads."
Structured steps:
Both formats are normalized into a structured representation that the AI can work with. Natural language is parsed for action verbs (navigate, click, fill, assert) and target descriptions.
Stage 2: DOM Crawling
This is where Testoro differs from generic AI code generators. Instead of guessing at your page structure, we actually crawl it.
Using a headless Chromium browser (via Playwright), Testoro:
This DOM context is critical. It means the generated selectors are based on your real page, not AI hallucinations.
Stage 3: Prompt Construction
The AI prompt combines three pieces of context:
The prompt instructs the AI to:
Stage 4: Code Generation
The AI model generates a complete .spec.ts file including:
The generated code is then validated for syntax correctness and returned to the user with a list of assertions and the model used.
Model Tiering
Different plan tiers use different AI models, optimizing for speed vs. quality:
| Plan | Model | Best For |
|------|-------|----------|
| Free | GPT-4.1 Nano | Quick, simple tests |
| Standard | GPT-4o Mini | Balanced quality and speed |
| Pro | GPT-4.1 | Complex, production-grade tests |
Higher-tier models produce more nuanced code — better error handling, more resilient selectors, and smarter assertion strategies.
What Makes This Different
Most AI coding tools generate tests in a vacuum — they don't know what your actual page looks like. Testoro's DOM crawling stage changes this fundamentally. The AI sees your real elements, real attributes, and real structure. The result is tests that work on the first run, not tests that need manual fixing.
This is the difference between "AI-assisted" and "AI-powered" test generation. Testoro doesn't just help you write tests faster — it writes tests that actually work.