export type Event = 'request' // This is the base Browser interface all browser // classes should build off of, it is the bare // methods we aim to support across tests export class BrowserInterface { private promise: any private then: any private catch: any protected chain(nextCall: any): BrowserInterface { if (!this.promise) { this.promise = Promise.resolve(this) } this.promise = this.promise.then(nextCall) this.then = (...args) => this.promise.then(...args) this.catch = (...args) => this.promise.catch(...args) return this } async setup(browserName: string, locale?: string): Promise {} async close(): Promise {} async quit(): Promise {} elementsByCss(selector: string): BrowserInterface[] { return [this] } elementByCss(selector: string): BrowserInterface { return this } elementById(selector: string): BrowserInterface { return this } touchStart(): BrowserInterface { return this } click(opts?: { modifierKey?: boolean }): BrowserInterface { return this } keydown(key: string): BrowserInterface { return this } keyup(key: string): BrowserInterface { return this } focusPage(): BrowserInterface { return this } type(text: string): BrowserInterface { return this } moveTo(): BrowserInterface { return this } waitForElementByCss(selector: string, timeout?: number): BrowserInterface { return this } waitForCondition(snippet: string, timeout?: number): BrowserInterface { return this } back(): BrowserInterface { return this } forward(): BrowserInterface { return this } refresh(): BrowserInterface { return this } setDimensions(opts: { height: number; width: number }): BrowserInterface { return this } addCookie(opts: { name: string; value: string }): BrowserInterface { return this } deleteCookies(): BrowserInterface { return this } on(event: Event, cb: (...args: any[]) => void) {} off(event: Event, cb: (...args: any[]) => void) {} async loadPage( url: string, { disableCache: boolean, beforePageLoad: Function } ): Promise {} async get(url: string): Promise {} async getValue(): Promise {} async getAttribute(name: string): Promise {} async eval(snippet: string | Function): Promise {} async evalAsync(snippet: string | Function): Promise {} async text(): Promise { return '' } async getComputedCss(prop: string): Promise { return '' } async hasElementByCssSelector(selector: string): Promise { return false } async log(): Promise< { source: 'error' | 'info' | 'log'; message: string }[] > { return [] } async websocketFrames(): Promise { return [] } async url(): Promise { return '' } }