donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
59 lines • 3.05 kB
TypeScript
import type { PlaywrightWorkerOptions, TestInfo } from '@playwright/test';
import type { GptClient } from '../../clients/GptClient';
import type { BrowserStorageState } from '../../models/BrowserStorageState';
import { FlowLogBuffer } from '../../utils/FlowLogBuffer';
import type { DonobuExtendedPage } from '../page/DonobuExtendedPage';
export * from '@playwright/test';
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
flowLoggingContext: {
flowId: string;
logBuffer: FlowLogBuffer;
};
pwApiStepLogger: void;
storageState?: BrowserStorageState | Promise<BrowserStorageState>;
gptClient?: GptClient;
page: DonobuExtendedPage;
}, import("@playwright/test").PlaywrightWorkerArgs & PlaywrightWorkerOptions & {
/**
* Auto worker-scoped fixture that drains pending file uploads to
* Donobu Cloud at the end of each Playwright worker's lifetime. Without
* this, the worker process would exit while uploads are still in-flight
* — fine for local dev (the next process resumes them) but a real
* data-loss case in ephemeral CI runners.
*
* Logs loudly when it has work to do so the user understands why
* teardown is taking time instead of wondering why the process isn't
* exiting.
*/
donobuFileUploadDrainGuard: void;
}>;
export declare function emitPlaywrightStepLog(step: any): void;
/** Reset the source-line cache. Test-only. */
export declare function _resetSourceLineCacheForTests(): void;
/**
* Monkey-patch `testInfo._callbacks.onStepEnd` so each Playwright step in
* the `pw:api` / `expect` categories emits an `appLogger.info` entry once
* Playwright signals the step has finished. Returns a teardown function
* that restores the original callback.
*
* Why patch `onStepEnd` and not `_addStep`:
* Playwright captures the step's source location with a stack walk inside
* `_addStep` (see playwright/lib/worker/testInfo.js). Patching `_addStep`
* inserts a Donobu library frame into that stack, and Playwright's
* built-in filter only excludes `@playwright/test` / `playwright-core`
* paths — so for steps that don't pre-set `data.location` (most notably
* `expect`), the captured location lands inside our wrapper in
* `node_modules/donobu/...`. The downstream node_modules filter would
* then drop the entry. `_callbacks.onStepEnd` runs AFTER the stack
* capture, so this hook is invisible to Playwright's location resolution.
*
* Verified against @playwright/test 1.57+. `_callbacks` / `_stepMap` and
* the step shape (category, title, params, endWallTime, error, location)
* are private Playwright internals — install and per-step logging are
* wrapped in try/catch so any shape drift degrades to a no-op rather than
* failing the test.
*
* Exported for unit testing.
*/
export declare function installPlaywrightStepLogger(testInfo: TestInfo): () => void;
//# sourceMappingURL=testExtension.d.ts.map