import { $ , $$ , browser , ElementFinder } from 'protractor' ; export class ColumnResizingSortingPage { table = $ ( 'table' ) ; tableBody = this . table . $ ( 'tbody' ) ; nameHeader = $$ ( 'th' ) . first ( ) ; async getPage ( ) { await browser . get ( '#/column-resizing/column-resizing-sorting' ) ; } async resizeColumn ( columnIndex , amount ) { const handle = this . getColumnResizeHandle ( columnIndex ) ; await browser . actions ( ) . mouseDown ( handle ) . mouseMove ( { x : amount , y : 0 } ) . mouseUp ( ) . perform ( ) ; } getColumnResizeHandle ( columnIndex ) { const columnHeaders = this . table . $$ ( 'th' ) ; const column = columnHeaders . get ( columnIndex ) ; return column . $ ( '.ux-resizable-table-column-handle' ) ; } async getColumnValues ( cellClass ) { const cells = this . tableBody . $$ ( `td.${ cellClass }` ) ; return await cells . map ( async ( cell ) => await cell . getText ( ) ) ; } async sortByName ( ) { return this . nameHeader . click ( ) ; } }