Skip to content

feat: Add Playwright-BDD Plugin - Complete Test Generation Framework#16

Open
Akash-incuByte wants to merge 10 commits intomainfrom
feature/playwright-bdd-plugin-complete
Open

feat: Add Playwright-BDD Plugin - Complete Test Generation Framework#16
Akash-incuByte wants to merge 10 commits intomainfrom
feature/playwright-bdd-plugin-complete

Conversation

@Akash-incuByte
Copy link

@Akash-incuByte Akash-incuByte commented Feb 23, 2026

Summary

Complete implementation of the Playwright-BDD plugin for automated test generation from Gherkin scenarios. This plugin adds intelligent test automation with semantic step matching, pattern-learning code generation, and support for UI/API/hybrid repositories.

What's New

🎯 /bee:playwright Command

New command that orchestrates end-to-end test generation from .feature files.

📦 All 5 Phases Implemented

Phase 1: Step Matching & Code Generation ✅

  • Semantic step matching with LLM-based confidence scoring (0-100 scale)
  • Reuse existing step definitions or generate new ones
  • Pattern-learning from existing code style
  • File-based approval workflow

Phase 2: Page Object Generation (UI Tests) ✅

  • UI step classification and POM semantic matching
  • Generate stable Playwright locators from outerHTML
  • Pattern-learning from existing page objects
  • Update step definitions with POM method calls

Phase 3: Service Layer Generation (API Tests) ✅

  • API step classification and service semantic matching
  • Generate service methods for REST/GraphQL/database operations
  • Type-safe response parsing
  • Update step definitions with service method calls

Phase 4: Hybrid Repo Support & Utilities ✅

  • Support UI-only, API-only, or hybrid repositories
  • Intelligent utility extraction (data transformation, DRY violations)
  • Developer approval for each extraction

Phase 5: Scenario Outlines & Test Execution ✅

  • Convert similar scenarios to parameterized scenario outlines
  • Generate Examples tables automatically
  • Execute tests using package.json scripts
  • Display test results with pass/fail summary

Architecture

Pattern: Command + Agent Delegation

  • 1 Command Orchestrator: bee/commands/playwright-bdd.md
  • 10 Specialized Agents: Organized in bee/agents/playwright/

Agent Organization

All 10 Playwright-BDD agents are organized in a dedicated folder:

bee/agents/playwright/
├── playwright-step-matcher.md
├── playwright-code-generator.md
├── playwright-pom-matcher.md
├── playwright-pom-generator.md
├── playwright-locator-generator.md
├── playwright-service-matcher.md
├── playwright-service-generator.md
├── playwright-utility-generator.md
├── playwright-outline-converter.md
└── playwright-test-executor.md

Key Features

Semantic Matching - LLM-based similarity scoring
Pattern Learning - Adapts to ANY repo structure
Approval Workflow - Developer controls every decision
Hybrid Support - UI-only, API-only, or both
Stable Locators - Playwright best practices
Utility Extraction - DRY principle applied
Scenario Outlines - Automatic parameterization
Test Execution - Run tests after generation

Usage

/bee:playwright /absolute/path/to/feature.feature

Documentation Updates 📚

Main README (bee/README.md)

  • Updated plugin metrics: 11 commands, 36 agents
  • Added comprehensive /bee:playwright command documentation
  • Documented all 10 Playwright-BDD agents with their roles
  • Updated project structure to reflect agents/playwright/ organization

Cursor Integration README (bee/.cursor/README.md)

  • Added bee-playwright command to usage table
  • Documented workflow: step definitions → POMs → services → utilities → scenario outlines

Files Changed

Latest Commit (Documentation)

  • bee/README.md - Complete plugin documentation update
  • bee/.cursor/README.md - Cursor integration docs update

Previous Commits

  • 1 command orchestrator (bee/commands/playwright-bdd.md)
  • 10 specialized agents in bee/agents/playwright/
  • Complete discovery and specs documentation in docs/specs/

🤖 Generated with Claude Sonnet 4.5

AshahKyruus and others added 8 commits February 23, 2026 12:54
- Accept absolute paths to .feature files
- Reject relative paths with clear error
- Reject directory paths
- Validate feature file existence
- Include Gherkin syntax validation placeholder
- Follow bee command orchestration pattern

Implements Slice 1 (Behaviors 1-5) of Phase 1 TDD plan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Index existing step definitions with Cucumber expression parsing
- Perform LLM-based semantic matching (0-100 confidence scores)
- Filter candidates below 50% confidence threshold
- Order by confidence then usage frequency
- Track step usage across feature files
- Detect duplicate step definitions
- Handle empty repos gracefully

Implements Slice 3 of Phase 1 TDD plan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Analyze existing step files to detect code patterns
- Generate new step definitions matching repo conventions
- Handle imports, parameter style, formatting, indentation
- Support both new files and appending to existing files
- Fall back to minimal template for empty repos
- File naming: one file per feature (search.feature → search.steps.ts)

Implements Slice 6 of Phase 1 TDD plan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
**New Agents:**
- playwright-pom-matcher: UI step classification and POM semantic matching
- playwright-pom-generator: Generate POM methods/classes, update step defs
- playwright-locator-generator: Generate stable Playwright locators from outerHTML

**Command Updates:**
- Integrated Phase 2 workflow after step definition generation
- POM matching with confidence scores (reuse class/method/create new)
- outerHTML collection for new UI elements
- Locator generation following Playwright best practices
- Step definition updates (TODO → POM method calls)
- File-based approval workflow consistent with Phase 1

**Pattern Learning:**
- Analyzes existing POMs for structure, imports, locator style
- Generates matching code following repo conventions
- Falls back to minimal template for empty repos

Phase 2 complete - UI test generation fully automated

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
**New Agents:**
- playwright-service-matcher: API step classification and service semantic matching
- playwright-service-generator: Generate service methods/classes for API tests

**Command Updates:**
- Integrated Phase 3 workflow (parallel to Phase 2 but for API steps)
- Service matching with confidence scores (reuse method/add method/create service)
- Response structure collection for type-safe API parsing
- Step definition updates (TODO → service method calls)
- File-based approval workflow

**Pattern Learning:**
- Analyzes existing services for HTTP client patterns, error handling
- Generates matching code following repo conventions

Phase 3 complete - API test generation fully automated

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
**New Agent:**
- playwright-utility-generator: Detect utility opportunities, generate reusable helpers

**Command Updates:**
- Hybrid mode now functional: "Both" implements UI first, then API
- Phase 2/3 conditionally execute based on hybrid_mode setting
- Utility detection after POMs/services generated
- Extract data transformations, duplicated logic, complex calculations
- Developer approval for each utility extraction
- File-based review workflow

**Hybrid Workflow:**
- UI-only: Phase 2 only
- API-only: Phase 3 only
- Both: Phase 2 → Phase 3 sequentially

Phase 4 complete - hybrid repos and utilities fully supported

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
**New Agents:**
- playwright-outline-converter: Detect parameterization opportunities, convert to scenario outlines
- playwright-test-executor: Detect and run test scripts from package.json

**Command Updates:**
- Optional scenario outline analysis (developer opt-in)
- Detect scenarios with identical flow but varying data
- Generate scenario outlines with Examples tables
- Update step definitions to accept parameters
- Show impact on other feature files
- Optional test execution after generation
- Detect test scripts (test:bdd, test:e2e, playwright)
- Developer selects script to run
- Capture and display test results (pass/fail summary)

**Phase 5 Workflow:**
1. Ask if outline analysis wanted
2. Show conversion suggestions with before/after
3. Apply approved conversions
4. Ask if test execution wanted
5. Select script and run tests
6. Display results

Phase 5 complete - ALL PHASES IMPLEMENTED ✅

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Moved all 10 playwright-related agents to bee/agents/playwright/:
- playwright-step-matcher.md
- playwright-code-generator.md
- playwright-pom-matcher.md
- playwright-pom-generator.md
- playwright-locator-generator.md
- playwright-service-matcher.md
- playwright-service-generator.md
- playwright-utility-generator.md
- playwright-outline-converter.md
- playwright-test-executor.md

Better organization: keeps playwright agents grouped together

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Updated agent count from 26 to 36
- Updated command count from 10 to 11
- Added /bee:playwright command documentation with 5-phase workflow
- Documented all 10 new Playwright-BDD agents:
  * playwright-step-matcher: semantic step matching
  * playwright-code-generator: step definition generation
  * playwright-pom-matcher: UI step classification
  * playwright-pom-generator: Page Object Model generation
  * playwright-locator-generator: stable locator generation
  * playwright-service-matcher: API step classification
  * playwright-service-generator: service layer generation
  * playwright-utility-generator: utility extraction
  * playwright-outline-converter: scenario outline conversion
  * playwright-test-executor: test execution
- Updated project structure to show agents/playwright/ directory
- Added bee-playwright command to Cursor integration docs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ng improvements

CRITICAL FIXES:
- Fix agent count in README (36 → 37 specialist agents)
- Clarify phase description in playwright-bdd command (all 5 phases, not just Phase 1)
- Add comprehensive agent delegation error handling with structured error messages
- Fix silent file read errors in step-matcher with proper tracking and warnings
- Fix parse error handling in pom-matcher to prevent duplicate POM creation

HIGH PRIORITY:
- Improve test execution exit code handling to distinguish failure types (test failures vs syntax errors vs environment issues)
- Enhance path validation error messages with helpful suggestions and diagnostics
- Add structured error responses in locator-generator for proper orchestrator handling

MEDIUM PRIORITY:
- Standardize error handling across all 10 Playwright agents
- Document confidence threshold rationale (50% for matching, 70% for method-level)
- Add error handling sections to utility-generator, service-matcher, service-generator
- Add cross-file dependency checks in outline-converter
- Enhance POM generator with naming conflict detection

All agents now have consistent error handling with:
- File read error tracking with user warnings
- LLM API failure handling with retry logic and rate limiting detection
- Parse error detection and comprehensive reporting
- Actionable recovery steps for all error conditions
- No silent failures - all catch blocks properly log and report

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants