import { $ , browser , ElementArrayFinder , ElementFinder , Key } from 'protractor' ; export class VirtualForSelectionPage { table = $ ( 'tbody' ) ; selectionText = $ ( '#selection-text' ) ; async getPage ( ) { return await browser . get ( '#/virtual-for/selection' ) ; } getRow ( id ) { return this . table . $ ( `#row-${ id }` ) ; } getSelectedRows ( ) { return this . table . $$ ( '.table-row.ux-selection-selected' ) ; } async getSelectionText ( ) { return this . selectionText . getText ( ) ; } async getSelectionCount ( ) { return ( await this . getSelectionText ( ) ) . split ( ', ' ) . length ; } async setMode ( mode ) { await $ ( `#mode-${ mode }` ) . click ( ) ; } async scrollToPosition ( position ) { await browser . executeScript ( `arguments[0].scrollTop = ${ position }` , this . table ) ; } async shiftClick ( element ) { await browser . actions ( ) . mouseMove ( element ) . keyDown ( Key . SHIFT ) . click ( ) . perform ( ) ; } async ctrlClick ( element ) { await browser . actions ( ) . mouseMove ( element ) . keyDown ( Key . CONTROL ) . click ( ) . perform ( ) ; } }