70 lines
1.8 KiB
TypeScript
70 lines
1.8 KiB
TypeScript
import { StepId } from '../../domain/value-objects/StepId';
|
|
import {
|
|
NavigationResult,
|
|
FormFillResult,
|
|
ClickResult,
|
|
WaitResult,
|
|
ModalResult,
|
|
AutomationResult,
|
|
} from './AutomationResults';
|
|
|
|
/**
|
|
* Browser automation interface for Playwright-based automation.
|
|
*
|
|
* This interface defines the contract for browser automation using
|
|
* standard DOM manipulation via Playwright. All automation is done
|
|
* through browser DevTools protocol - no OS-level automation.
|
|
*/
|
|
export interface IBrowserAutomation {
|
|
/**
|
|
* Navigate to a URL.
|
|
*/
|
|
navigateToPage(url: string): Promise<NavigationResult>;
|
|
|
|
/**
|
|
* Fill a form field by name or selector.
|
|
*/
|
|
fillFormField(fieldName: string, value: string): Promise<FormFillResult>;
|
|
|
|
/**
|
|
* Click an element by selector or action name.
|
|
*/
|
|
clickElement(target: string): Promise<ClickResult>;
|
|
|
|
/**
|
|
* Wait for an element to appear.
|
|
*/
|
|
waitForElement(target: string, maxWaitMs?: number): Promise<WaitResult>;
|
|
|
|
/**
|
|
* Handle modal dialogs.
|
|
*/
|
|
handleModal(stepId: StepId, action: string): Promise<ModalResult>;
|
|
|
|
/**
|
|
* Execute a complete workflow step.
|
|
*/
|
|
executeStep?(stepId: StepId, config: Record<string, unknown>): Promise<AutomationResult>;
|
|
|
|
/**
|
|
* Initialize the browser connection.
|
|
* Returns an AutomationResult indicating success or failure.
|
|
*/
|
|
connect?(): Promise<AutomationResult>;
|
|
|
|
/**
|
|
* Clean up browser resources.
|
|
*/
|
|
disconnect?(): Promise<void>;
|
|
|
|
/**
|
|
* Check if browser is connected and ready.
|
|
*/
|
|
isConnected?(): boolean;
|
|
}
|
|
|
|
/**
|
|
* @deprecated Use IBrowserAutomation directly. IScreenAutomation was for OS-level
|
|
* automation which has been removed in favor of browser-only automation.
|
|
*/
|
|
export type IScreenAutomation = IBrowserAutomation; |