UNPKG

e2ed

Version:

E2E testing framework over Playwright

37 lines (36 loc) 1.53 kB
import type { Expect as PlaywrightExpect } from '@playwright/test'; import type { ToMatchScreenshotOptions } from '../../types/internal'; type ElementOf<Type> = Type extends (infer Element)[] ? Element : never; type EnsureString<Type> = Type extends string ? string : never; type Extend<Type, Extended> = Type extends Extended ? Extended : never; /** * Addition matchers. */ export type NonSelectorAdditionalMatchers<Actual> = Readonly<{ contains: <R>(expected: ElementOf<Actual> | EnsureString<Actual> | Extend<Actual, R>) => Promise<void>; eql: (expected: Actual) => Promise<void>; gt: (expected: number) => Promise<void>; gte: (expected: number) => Promise<void>; lt: (expected: number) => Promise<void>; lte: (expected: number) => Promise<void>; match: (re: RegExp) => Promise<void>; notContains: <R>(unexpected: ElementOf<Actual> | EnsureString<Actual> | Extend<Actual, R>) => Promise<void>; notEql: (unexpected: Actual) => Promise<void>; notOk: () => Promise<void>; ok: () => Promise<void>; }>; /** * All matchers. */ export type NonSelectorMatchers<Actual> = NonSelectorAdditionalMatchers<Actual> & ReturnType<PlaywrightExpect>; /** * Matchers for selector. * TODO: support LocatorAssertions */ export type SelectorMatchers = Readonly<{ /** * Checks that the selector screenshot matches the one specified by `expectedScreenshotId`. */ toMatchScreenshot: (expectedScreenshotId: string, options?: ToMatchScreenshotOptions) => Promise<void>; }>; export {};