@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
52 lines • 1.42 kB
TypeScript
import type { ServerStoryFile, StoryContext } from './types';
/**
* Parse @interaction blocks from story content
*/
export declare function parseInteractionBlocks(content: string): InteractionTest[];
/**
* Run interaction tests for a story
*/
export declare function runInteractionTests(_ctx: StoryContext, story: ServerStoryFile, tests: InteractionTest[]): Promise<InteractionTestResult[]>;
/**
* Generate interaction test helpers script (for browser)
*/
export declare function getInteractionHelpersScript(): string;
/**
* Format interaction test results
*/
export declare function formatInteractionResults(results: InteractionTestResult[]): string;
/**
* Interaction step
*/
export declare interface InteractionStep {
action: 'click' | 'type' | 'select' | 'hover' | 'focus' | 'blur' | 'wait' | 'assert'
selector?: string
value?: string
duration?: number
assertion?: {
type: 'text' | 'value' | 'visible' | 'hidden' | 'class' | 'attribute'
expected: any
attribute?: string
}
}
/**
* Interaction test definition
*/
export declare interface InteractionTest {
name: string
storyId: string
variantId: string
steps: InteractionStep[]
setup?: () => Promise<void>
teardown?: () => Promise<void>
}
/**
* Interaction test result
*/
export declare interface InteractionTestResult {
name: string
passed: boolean
error?: string
duration: number
failedStep?: number
}