e2ed
Version:
E2E testing framework over Playwright
64 lines (63 loc) • 2.62 kB
TypeScript
import type { Locator as PlaywrightLocator } from '@playwright/test';
import type { AttributesOptions } from '../../createLocator';
type Args = readonly (RegExp | number | string)[];
type Kind = 'css' | 'filter' | 'find' | 'nth' | 'parent' | 'withText';
type Options = Readonly<{
args?: Args | undefined;
cssString: string;
kind?: Kind;
parentSelector?: Selector;
}> & Omit<AttributesOptions, 'testIdSeparator'>;
/**
* Selector.
*/
declare class Selector {
readonly description: string;
private readonly args;
private readonly cssString;
private readonly kind;
private readonly parameterAttributePrefix;
private readonly parentSelector;
private readonly testIdAttribute;
protected constructor({ args, cssString, kind, parameterAttributePrefix, parentSelector, testIdAttribute, }: Options);
get boundingClientRect(): Promise<DOMRectReadOnly>;
get checked(): Promise<boolean | undefined>;
get count(): Promise<number>;
get exists(): Promise<boolean>;
get scrollHeight(): Promise<number>;
get scrollLeft(): Promise<number>;
get scrollTop(): Promise<number>;
get scrollWidth(): Promise<number>;
get textContent(): Promise<string>;
get value(): Promise<string | undefined>;
get visible(): Promise<boolean>;
static create({ cssString, parameterAttributePrefix, testIdAttribute, }: Pick<Options, 'cssString' | 'parameterAttributePrefix' | 'testIdAttribute'>): Selector;
createSelector(cssString: string): Selector;
filter(cssSelectorString: string): Selector;
filterByLocatorParameter(parameter: string, value: string): Selector;
filterByTestId(testId: string): Selector;
find(cssSelectorString: string): Selector;
findByLocatorParameter(parameter: string, value: string): Selector;
findByTestId(testId: string): Selector;
getAttribute(attributeName: string): Promise<string | null>;
getLocatorParameter(parameter: string): Promise<string | null>;
getPlaywrightLocator(): PlaywrightLocator;
getStyleProperty(propertyName: string): Promise<string>;
getTestId(): Promise<string | null>;
hasAttribute(attributeName: string): Promise<boolean>;
hasLocatorParameter(parameter: string): Promise<boolean>;
hasTestId(): Promise<boolean>;
nth(index: number): Selector;
parent(): Selector;
toJSON(): {
description: string;
};
/**
* Custom string presentation of selector.
*/
toString(): string;
withText(textOrRegExp: RegExp | string): Selector;
private createChildSelector;
private getParameterAttribute;
}
export { Selector };