/** * StepTracker — generated into ai-helpers/step-tracker.ts in the user's project. * * Design goals: * - Collect ALL step failures before stopping (never abort mid-test on first error) * - Self-heal using stored ElementContext metadata before marking a step failed * - Save step context to disk for every step (pending → passed/healed/failed) * - Expose a reusable element resolver so POM actions can be retried with healed locators * - Call tracker.done() at the very end of each test to surface collected failures */ import { Page } from '@playwright/test'; export interface ElementContext { key: string; description: string; tag?: string; role?: string; label?: string; placeholder?: string; text?: string; testId?: string; actionType?: 'click' | 'fill' | 'select' | 'check' | 'assert' | 'navigate'; originalLocator: string; } export interface StepResult { stepIndex: number; stepDescription: string; elementKey?: string; locatorUsed: string; status: 'passed' | 'failed' | 'healed' | 'skipped'; error?: string; healedLocator?: string; healingStrategy?: string; durationMs: number; timestamp: string; } export interface StepFailure { stepIndex: number; description: string; error: Error; healingAttempted: boolean; } export declare class StepTracker { private readonly page; private readonly testName; private readonly elementContexts; private readonly continueOnFailure; private failures; private results; private contextsDir; /** * @param page Playwright Page * @param testName Unique name used for context file naming * @param elementContexts ELEMENT_CONTEXTS from the Page Object * @param continueOnFailure true = collect all failures, report at done() (default) * false = throw immediately on first unhealed failure */ constructor(page: Page, testName: string, elementContexts?: Record, continueOnFailure?: boolean); /** * Execute a single test step with automatic healing and failure collection. * * @param index Zero-based step index * @param description Plain-English step description (used for semantic healing) * @param action Async function performing the step * @param elementKey Key into ELEMENT_CONTEXTS for the primary element (enables richer healing) */ step(index: number, description: string, action: () => Promise, elementKey?: string): Promise; /** * Call at the very end of the test. * Writes the full run summary and throws a combined error if any steps failed. */ done(): Promise; /** Returns all step results for custom assertions. */ getResults(): StepResult[]; /** Returns healed steps — useful for updating the POM after a successful run. */ getHealedSteps(): StepResult[]; private healFromContext; private semanticScan; /** * Retry the original action after healing. * Since POM locators are computed lazily, simply re-running the action * picks up the current DOM state. Returns true on success. */ private retryWithLocator; private saveContext; private writeSummary; private pushResult; private log; } //# sourceMappingURL=step-tracker-template.d.ts.map