Validate and apply fix to spec
validate_and_apply_fixValidate proposed code changes against Playwright locator rules, then apply them to the spec file if no violations are found; otherwise, return violations for correction.
Instructions
Validate proposed code changes against LOCATOR_VIOLATION_RULES (no XPath, no bare CSS classes, iframe must use frame.locator), then apply to spec file. Returns violations if any error-level rule is violated — model must fix and retry. This is the only valid path to write spec changes; direct file edits bypass LOCATOR_RULES enforcement.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| specFilePath | Yes | Absolute path to the spec file to modify | |
| failureContext | No | Failure context for context-specific validation (e.g. iframe enforces frame.locator usage) | |
| proposedChanges | Yes | List of code replacements to apply in order |