/** * Locator kit for application (`locator` function, that produce attributes object, * and additional `getTestId` function). */ export type AppLocatorKit = Omit, 'getSelector'>; /** * Attributes object. */ export type Attributes = Readonly>; /** * Attributes options used to get attributes from the locator. */ export type AttributesOptions = Readonly<{ /** * Prefix of attribute's names for parameters. */ parameterAttributePrefix: 'data-test-' | string; /** * Attribute's name for `testId`. */ testIdAttribute: 'data-testid' | string; /** * Separator between parts of `testId`. */ testIdSeparator: '-' | string; }>; /** * Options of `createLocator` function. */ export type CreateLocatorOptions = Readonly<{ /** * Attributes options used to get attributes from the locator. */ attributesOptions: AttributesOptions; /** * If `true`, locator doesn't render (`locator(...)` returns empty object). */ isProduction: boolean; }>; /** * Options of `createTestLocator` function. */ export type CreateTestLocatorOptions = Readonly<{ /** * Attributes options used to get attributes from the locator. */ attributesOptions: AttributesOptions; /** * Creates `Locator` object by CSS selector. */ createLocatorByCssSelector: (this: void, selector: string) => Locator; /** * If `true`, asterisks in `testId` and locator parameters are considered * to represent any string (as wildcards). */ supportWildcardsInCssSelectors: boolean; }>; /** * Locator function. */ export type LocatorFunction = ByParts & ByParts & ByParts & ByParts & ByParts & ByParts & ByParts & ByParts; /** * Locator kit for tests (`locator` function, that produce locators, * and additional `getSelector` and `getTestId` functions). */ export type LocatorKit = Readonly<{ locator: LocatorFunction; getSelector: LocatorFunction; getTestId: LocatorFunction; }>; /** * Locator parameters object. */ export type LocatorParameters = Readonly>; /** * Stringifiable or empty (`null`/`undefined`) value. */ export type Stringifiable = boolean | null | number | string | undefined; type ByParts = ( this: void, ...testIdParts: readonly [Part, ...Parts, parameters?: LocatorParameters] ) => Locator; type Part = Stringifiable;