import { Then , When } from 'cypress-cucumber-preprocessor/steps' ; Then ( 'filter number {int} is shown in the selected filters list is {boolean}' , function ( this , simpleFilterIndex , isShown ) { cy . getByDataTest ( 'selected-filters-list' ) . getByDataTest ( 'selected-filters-list-item' ) . getByDataTest ( 'filter' ) . invoke ( 'text' ) . then ( filterName => { isShown ? expect ( filterName ) . to . eq ( this [ `clickedFilter${ simpleFilterIndex }` ] ) : expect ( filterName ) . to . not . contain ( this [ `clickedFilter${ simpleFilterIndex }` ] ) ; } ) ; } ) ; When ( 'child hierarchical filter {int} from parent filter {int} in {string} is clicked' , ( childFilterIndex , parentFilterIndex , facetName ) => { cy . getByDataTest ( `${ facetName }-filter` ) . eq ( parentFilterIndex ) . getByDataTest ( 'children-filters' ) . getByDataTest ( 'filter' ) . eq ( childFilterIndex ) . click ( ) . invoke ( 'text' ) . as ( `clickedChildFilter${ childFilterIndex }` ) ; } ) ; Then ( 'selection status of child filter number {int} in facet {string} is {boolean}' , function ( this , simpleFilterIndex , facetName , isSelected ) { cy . getByDataTest ( `${ facetName }-filter` ) . contains ( this [ `clickedChildFilter${ simpleFilterIndex }` ] ) . should ( `${ isSelected ? '' : 'not.' }to.have.class` , 'x-filter--is-selected' ) ; } ) ;