import { $ , $$ , browser } from 'protractor' ; export class SelectListPage { input = $ ( '#search-input' ) ; list = $ ( 'ux-select-list' ) ; items = $$ ( 'ux-select-list-item' ) ; output = $ ( '#select-output' ) ; toggleButton = $ ( '#toggle-btn' ) ; resetButton = $ ( '#reset-btn' ) ; async getPage ( ) { return await browser . get ( '#/select-list' ) ; } async getItemCount ( ) { return await this . items . count ( ) ; } async getSelection ( ) { return await this . output . getText ( ) ; } async selectItem ( index ) { await this . items . get ( index ) . click ( ) ; } async search ( query ) { await this . input . sendKeys ( query ) ; } async getTabbableItemCount ( ) { const items = await this . items . map ( element => element . getAttribute ( 'tabindex' ) ) ; return items . filter ( item => item === '0' ) . length ; } async getTabbableItem ( ) { const items = await this . items . filter ( element => element . getAttribute ( 'tabindex' ) . then ( tabindex => tabindex === '0' ) ) ; return await items [ 0 ] . getText ( ) ; } async reset ( ) { return this . resetButton . click ( ) ; } }