import { by , ElementArrayFinder } from 'protractor' ; import { GenericFilter } from './generic-filter' ; import { BrowserActions } from '@alfresco/adf-testing' ; export class SizeFilter extends GenericFilter { constructor ( ) { super ( 'Size' ) ; } facets : ElementArrayFinder = this . filterDialogOpened . all ( by . css ( '.mat-checkbox' ) ) ; selectedFacets : ElementArrayFinder = this . filterDialogOpened . all ( by . css ( '.mat-checkbox.mat-checkbox-checked' ) ) ; async getFiltersValues ( ) { return this . facets . map ( ( option ) => { return option . getText ( ) ; } ) ; } async getFiltersCheckedValues ( ) { return this . selectedFacets . map ( ( option ) => { return option . getText ( ) ; } ) ; } async resetPanel ( ) { if ( ( await this . selectedFacets . count ( ) ) > 0 ) { await this . openDialog ( ) ; await this . selectedFacets . each ( async ( elem ) => { await BrowserActions . click ( elem ) ; } ) ; } await this . closeDialog ( ) ; } async checkSizeSmall ( ) { const small = this . facets . filter ( async ( elem ) => ( await elem . getText ( ) ) === 'Small' ) . first ( ) ; await BrowserActions . click ( small ) ; } async checkSizeMedium ( ) { const medium = this . facets . filter ( async ( elem ) => ( await elem . getText ( ) ) === 'Medium' ) . first ( ) ; await BrowserActions . click ( medium ) ; } async checkSizeLarge ( ) { const large = this . facets . filter ( async ( elem ) => ( await elem . getText ( ) ) === 'Large' ) . first ( ) ; await BrowserActions . click ( large ) ; } async checkSizeHuge ( ) { const huge = this . facets . filter ( async ( elem ) => ( await elem . getText ( ) ) === 'Huge' ) . first ( ) ; await BrowserActions . click ( huge ) ; } }