import * as _$playwright from "playwright"; import { Browser, BrowserContext, Page } from "playwright"; import * as _$playwright_test0 from "playwright/test"; //#region src/services/TestInfoAdapter.d.ts interface RunSpecAttachment { name: string; contentType: string; path: string; } interface RunSpecAttachmentOptions { body?: Buffer | string; path?: string; contentType?: string; } interface RunSpecTestInfo { readonly title: string; readonly attachments: readonly RunSpecAttachment[]; attach(name: string, options: RunSpecAttachmentOptions): Promise; } //#endregion //#region src/stubs/playwright-test.d.ts declare const playwrightExpect: _$playwright_test0.Expect<{}>; /** * Re-export all real playwright/test exports that specs may use. * Our custom `test` and `expect` override the real ones; everything * else (request, chromium, firefox, webkit, devices, selectors, * defineConfig, mergeExpects, mergeTests) is passed through unchanged. */ declare const request: unknown, chromium: unknown, firefox: unknown, webkit: unknown, devices: unknown, selectors: unknown, defineConfig: unknown, mergeExpects: unknown, mergeTests: unknown; /** * Fixtures passed to test functions. * Compatible with Playwright's test fixture pattern. * Browser is optional for extension mode which uses persistent context. */ interface TestFixtures { page: Page; context: BrowserContext; browser?: Browser; /** Playwright module instance for creating API request contexts */ playwright?: typeof _$playwright; /** API request context scoped to the test */ request?: _$playwright.APIRequestContext; /** Extended fixtures added via test.extend() */ [key: string]: unknown; } /** * Config collected from test.use() and test.describe.configure(). * Unknown keys are preserved to keep the collector extensible. */ interface CollectedScopeConfig { mode?: 'default' | 'parallel' | 'serial'; use?: Record; [key: string]: unknown; } /** * A single test block collected from the spec file. * The `fn` stores the RAW test function — fixture resolution happens in flattenTests. */ interface TestBlock { /** Test title */ title: string; /** Test function (raw — no fixture wrapping at collection time) */ fn: (fixtures: TestFixtures, testInfo?: RunSpecTestInfo) => Promise; /** Full path including describe blocks */ fullTitle: string; /** Whether test is marked with test.only() */ only: boolean; /** Whether test is marked with test.skip() */ skip: boolean; /** Resolved config inherited from describe/use scopes. */ config: CollectedScopeConfig; /** Nearest serial describe scope id, if serial mode is enabled. */ serialScopeId?: number; } /** * Holds fixture definitions for a describe scope. * Fixtures are inherited from parent scopes and merged with local definitions. */ declare class FixtureScope { private readonly defs; private readonly parent; constructor(defs: Map, parent?: FixtureScope | null); /** Merges all fixture defs from root to this scope */ getAllDefs(): Map; /** Creates a child scope that inherits from this one */ extend(defs: Map): FixtureScope; } /** * A describe block containing tests and hooks. */ interface DescribeBlock { /** Stable id for this describe scope. */ id: number; /** Describe block title */ title: string; /** Tests within this describe */ tests: TestBlock[]; /** beforeAll hooks (run once before first test in block) */ beforeAllHooks?: TestFunction[]; /** afterAll hooks (run once after last test in block) */ afterAllHooks?: TestFunction[]; /** beforeEach hooks (raw — not fixture-wrapped) */ beforeEachHooks: TestFunction[]; /** afterEach hooks (raw — not fixture-wrapped) */ afterEachHooks: TestFunction[]; /** Nested describe blocks */ children: DescribeBlock[]; /** Parent describe block (null for root) */ parent: DescribeBlock | null; /** Fixture scope for this describe block — merged from test.extend() calls */ fixtureScope: FixtureScope | null; /** Scope config declared via test.use() and test.describe.configure(). */ config: CollectedScopeConfig; } /** * Complete test suite collected from a spec file. */ interface TestSuite { /** Spec file path or identifier */ specPath: string; /** Root describe block (unnamed) */ root: DescribeBlock; /** Flattened list of all tests in execution order */ allTests: TestBlock[]; /** Total test count */ testCount: number; } /** * Thrown by test.skip() inside a test body to signal the test should be skipped. */ declare class SkipTestError extends Error { readonly isSkip = true; constructor(reason?: string); } /** * Test function type that matches Playwright's test() signature. */ type TestFunction = (fixtures: TestFixtures, testInfo: RunSpecTestInfo) => Promise; type DescribeFunction = ((title: string, fn: () => void) => void) & { configure: (config: CollectedScopeConfig) => void; }; interface TestApi { (title: string, fn: TestFunction): void; only(title: string, fn: TestFunction): void; skip(titleOrCondition?: string | boolean, fnOrReason?: TestFunction | string): void; describe: DescribeFunction; beforeAll(fn: TestFunction): void; afterAll(fn: TestFunction): void; beforeEach(fn: TestFunction): void; afterEach(fn: TestFunction): void; use(useConfig: Record): void; extend(fixtures: Record): TestApi; } /** * Fixture definition function following Playwright's async use() pattern. * Setup runs before use(), teardown runs after use() returns. */ type FixtureFunction = (fixtures: Record, use: (value: unknown) => Promise) => Promise; declare function splitUseConfig(useConfig: Record | undefined): { runtimeUse: Record; fixtureOverrides: Record; unsupportedKeys: string[]; }; declare const test: TestApi; /** * Initializes the collector for a new spec file. * Call this before loading a spec file. */ declare function initCollector(specPath: string): void; /** * Retrieves the collected test suite and resets the collector. * Call this after loading a spec file. */ declare function getCollectedSuite(): TestSuite; /** * Peeks at the current collected test suite without resetting. */ declare function peekCollectedSuite(): TestSuite; /** * Resets the collector without retrieving. * Useful for cleanup on error. */ declare function resetCollector(): void; /** * Wrapper around Playwright's expect that detects proxy objects * and routes assertions through extension-mode DOM evaluation. * Falls back to real Playwright expect for non-proxy targets. * * Implemented as a Proxy with only an `apply` trap so every static property * (`expect.objectContaining`, `expect.poll`, `expect.soft`, `expect.not`, ...) * resolves on the real Playwright export. A plain wrapper function would drop * them — Playwright's own `expect` is itself a Proxy that synthesizes * `soft`/`poll`/`configure` in its `get` trap, so they cannot be copied with * `Object.assign` either (RXX2-70). */ declare const expect: typeof playwrightExpect; //#endregion export { CollectedScopeConfig, DescribeBlock, SkipTestError, TestBlock, TestFixtures, TestSuite, chromium, defineConfig, devices, expect, firefox, getCollectedSuite, initCollector, mergeExpects, mergeTests, peekCollectedSuite, request, resetCollector, selectors, splitUseConfig, test, webkit }; //# sourceMappingURL=playwright-test.d.mts.map