UNPKG

e2ed

Version:

E2E testing framework over Playwright

39 lines (32 loc) 678 B
import {inputSelector} from 'autotests/selectors'; import {typeText} from 'e2ed/actions'; import type {Selector} from 'e2ed/types'; /** * Common input pageObject component. */ export class Input { /** * Input element. */ readonly input: Selector; /** * Name of input element. */ private readonly name: string; constructor(name: string) { this.name = name; this.input = inputSelector(this.name); } /** * Input value. */ get value(): Promise<string> { return this.input.value as Promise<string>; } /** * Type text into an input. */ type(text: string): Promise<void> { return typeText(this.input, text); } }