import type { Expect as PlaywrightExpect } from '@playwright/test'; import type { Fn, ToBeInViewportOptions, ToMatchScreenshotOptions } from '../../types/internal'; type ElementOf = Type extends (infer Element)[] ? Element : never; type EnsureString = Type extends string ? string : never; type Extend = Type extends Extended ? Extended : never; type PlaywrightMatchers = ReturnType; /** * Addition matchers. */ export type NonSelectorAdditionalMatchers = Readonly<{ contains: (expected: ElementOf | EnsureString | Extend) => Promise; eql: (expected: Actual) => Promise; gt: (expected: number) => Promise; gte: (expected: number) => Promise; lt: (expected: number) => Promise; lte: (expected: number) => Promise; match: (re: RegExp) => Promise; notContains: (unexpected: ElementOf | EnsureString | Extend) => Promise; notEql: (unexpected: Actual) => Promise; notOk: () => Promise; ok: () => Promise; }>; /** * All matchers. */ export type NonSelectorMatchers = NonSelectorAdditionalMatchers & { readonly [Key in keyof PlaywrightMatchers]: Fn unknown ? Args : never, Promise, void>; }; /** * Matchers for selector. * TODO: support LocatorAssertions */ export type SelectorMatchers = Readonly<{ /** * Ensures that selector element intersects viewport, according to the intersection observer API. */ toBeInViewport: (options?: ToBeInViewportOptions) => Promise; /** * Checks that the selector screenshot matches the one specified by `expectedScreenshotId`. */ toMatchScreenshot: (expectedScreenshotId: string, options?: ToMatchScreenshotOptions) => Promise; }>; export {};