import { ElementHandle, FrameBase } from 'puppeteer'; export abstract class E2EBase { name: string; constructor(name: string) { this.name = name; } async getSelector(): Promise { return page as FrameBase; } async getElement(): Promise { if (!(await this.getSelector())) { return null; } return (await this.getSelector()).$(this.selector()); } async waitForElement(): Promise { return (await this.getSelector()).waitForSelector(this.selector(), { timeout: 1000 }); } protected abstract selector(): string; }