Bug fixes: - #1 /logs?level=error returned 404 — use pathname for route matching - #2 Duplicate initialization — added 'initialized' guard flag Should fix: - #4 Added screenshot() to IPage interface - #5 Graceful shutdown rejects pending requests before exit - #6 Use process.execPath instead of 'npx tsx' for faster daemon spawn Cleanup: - #7 Removed duplicate 'browser' keyword in package.json - #8 Removed unused normalizeEvaluateSource import from browser.ts - #9 Changed dynamic import to static import in intercept.ts - #10 Added explicit throw at end of sendCommand for clarity 61 tests pass (4 test files). Extension: 10.55KB.
28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
/**
|
|
* Page interface: type-safe abstraction over Playwright MCP browser page.
|
|
*
|
|
* All pipeline steps and CLI adapters should use this interface
|
|
* instead of `any` for browser interactions.
|
|
*/
|
|
|
|
export interface IPage {
|
|
goto(url: string): Promise<void>;
|
|
evaluate(js: string): Promise<any>;
|
|
snapshot(opts?: { interactive?: boolean; compact?: boolean; maxDepth?: number; raw?: boolean }): Promise<any>;
|
|
click(ref: string): Promise<void>;
|
|
typeText(ref: string, text: string): Promise<void>;
|
|
pressKey(key: string): Promise<void>;
|
|
wait(options: number | { text?: string; time?: number; timeout?: number }): Promise<void>;
|
|
tabs(): Promise<any>;
|
|
closeTab(index?: number): Promise<void>;
|
|
newTab(): Promise<void>;
|
|
selectTab(index: number): Promise<void>;
|
|
networkRequests(includeStatic?: boolean): Promise<any>;
|
|
consoleMessages(level?: string): Promise<any>;
|
|
scroll(direction?: string, amount?: number): Promise<void>;
|
|
autoScroll(options?: { times?: number; delayMs?: number }): Promise<void>;
|
|
installInterceptor(pattern: string): Promise<void>;
|
|
getInterceptedRequests(): Promise<any[]>;
|
|
screenshot(options?: { format?: 'png' | 'jpeg'; quality?: number; fullPage?: boolean; path?: string }): Promise<string>;
|
|
}
|