import { ChainablePromiseElement } from 'webdriverio' ; class Modals { private get closeBtn ( ) : ChainablePromiseElement < Promise < WebdriverIO . Element > > { return $ ( '.modal-dialog .modal-footer button' ) ; } private get title ( ) : ChainablePromiseElement < Promise < WebdriverIO . Element > > { return $ ( '.modal-title' ) ; } public async close ( ) { await this . closeBtn . click ( ) ; } public async assertTitle ( expectedTitle ) { const text = await this . title . getText ( ) ; expect ( text ) . toContain ( expectedTitle ) ; } public async assertExists ( ) { await $ ( '.modal' ) . waitForExist ( ) ; } } export default new Modals ( ) ;