@fletta/sdk
v1.1.1
Published
fletta SDK for self-healing test selectors
Maintainers
Readme
@fletta/sdk
TypeScript SDK for fletta self-healing. Healing algorithms run in Rust Core via WASM (healJson).
Installation
npm install @fletta/sdkNo Rust or WASM build required — the WASM binary is bundled with the package.
Quick Start
import { createHealingEngine, type HealResult, type DOMSnapshot } from '@fletta/sdk';
const engine = await createHealingEngine({ minConfidence: 0.85 });
// When a selector fails, heal it using the element signature
const result: HealResult = engine.heal(
'[data-testid="pay-btn"]',
signature, // Original element signature (captured during recording)
domSnapshot // Current DOM snapshot
);
if (result.healed) {
console.log(`Healed to: ${result.selector} (confidence: ${result.confidence})`);
}API
import { createHealingEngine, type HealResult, type DOMSnapshot } from '@fletta/sdk';
const engine = await createHealingEngine({ minConfidence: 0.85, reportDir: './fletta-reports' });
const result: HealResult = engine.heal(primarySelector, signature, domSnapshot);HealingEngine.heal()— callsfletta_coreWASM (HealRequest/HealResultJSON contract)HealingEngine.extractSignature()— snapshot helper (TypeScript; DOM capture stays in adapter)
Development Build
If you need to build from source (for development or contributing):
# Requires: rust, wasm-pack, wasm32-unknown-unknown
npm install
npm run build # build:wasm + tscWASM output: wasm/ (gitignored; built in CI).
Dev fallback
If WASM is missing during development:
export FLETTA_TS_FALLBACK=1Uses legacy TypeScript healing (core-fallback.ts). Not for production.
