UNPKG

@autifyhq/muon

Version:

Muon - AI-Powered Playwright Test Coding Agent with Advanced Test Fixing Capabilities

117 lines (116 loc) 2.93 kB
interface ToolFunction { name: string; description: string; parameters: { type: string; properties: Record<string, any>; required?: string[]; }; func: (args: any) => Promise<any>; } import type { Page } from 'playwright'; export interface ToolLogger { logToolCall(toolName: string, input: any, output: string): void; } export interface PaginatedReadResult { content: string; totalSize: number; showing: number; skipped: number; totalLines: number; showingLines: number; filePath: string; hasMore: boolean; } export interface SearchResult { file: string; line: number; content: string; match: string; } export interface PaginatedSearchResult { matches: SearchResult[]; total: number; showing: number; skipped: number; searchText: string; filePattern: string; } export interface TestStep { id: number; timestamp: string; name: string; action: string; selector?: string; value?: any; url?: string; } export interface TestScript { id?: number; filename: string; content: string; testCaseId?: string; status: 'pending' | 'completed'; implemented?: boolean; imported?: string; exported?: string; lastUpdated: string; } export declare class CodingTools { private projectPath; private logger; private browser; private context; private page; private pages; private activePage; private isBrowserInitialized; private serverUrl; private currentTestSteps; constructor(projectPath: string, logger?: ToolLogger); private logTool; launchBrowser(headless?: boolean): Promise<void>; closeBrowser(): Promise<void>; getBrowserPage(): Page | null; isBrowserOpen(): boolean; validateBrowserInitialized(): void; resolveFrame(iframeSelectors?: string[]): Promise<any>; recordTestStep(stepName: string, action: string, selector?: string, value?: any): TestStep; getTools(): ToolFunction[]; extractFrameDOM(frame: any): Promise<string>; getIframeList(page: Page): Promise<Array<{ name?: string; src?: string; id?: string; }>>; getCompletePageDOM(page: Page, includeIframes?: boolean): Promise<PageDOMResult>; } export declare class DefaultToolLogger implements ToolLogger { logToolCall(toolName: string, input: any, output: string): void; } export interface PageDOMResult { success: boolean; url?: string; title?: string; viewport?: { width: number; height: number; }; mainFrame?: string; iframes?: IframeDOMResult[]; stats?: { totalElements: number; iframeCount: number; }; error?: string; } export interface IframeDOMResult { name?: string; src?: string; url: string; title: string; accessible: boolean; dom?: string; error?: string; } export {};