import { imageCompare } from '../common/image-compare' ; import { FacetContainerPage } from './facet-container.po.spec' ; describe ( 'FacetContainerPage Tests' , ( ) => { let page = new FacetContainerPage ( ) ; beforeAll ( async ( ) => { await page . getPage ( ) ; } ) ; it ( 'should start with no facets' , async ( ) => { expect < any > ( page . getNumberOfFacets ( ) ) . toEqual ( 0 ) ; expect ( page . getClearAllButton ( ) . isPresent ( ) ) . toBeFalsy ( ) ; expect ( page . getNoItemsLabel ( ) . isPresent ( ) ) . toBeTruthy ( ) ; expect ( await imageCompare ( 'facet-container-list-initial' ) ) . toEqual ( 0 ) ; } ) ; it ( 'should allow addition of facets' , async ( ) => { await page . addFacet . click ( ) ; expect ( await page . getClearAllButton ( ) . isPresent ( ) ) . toBeTruthy ( ) ; expect ( await page . getNoItemsLabel ( ) . isPresent ( ) ) . toBeFalsy ( ) ; await page . addFacet . click ( ) ; await page . addFacet . click ( ) ; expect ( await page . getNumberOfFacets ( ) ) . toEqual ( 3 ) ; expect ( await imageCompare ( 'facet-container-list-addition' ) ) . toEqual ( 0 ) ; expect ( await page . getFacetName ( 0 ) ) . toMatch ( '\\w+\\d*\\w*' ) ; expect ( await page . getFacetName ( 1 ) ) . toMatch ( '\\w+\\d*\\w*' ) ; expect ( await page . getFacetName ( 2 ) ) . toMatch ( '\\w+\\d*\\w*' ) ; await page . getClearAllButton ( ) . click ( ) ; } ) ; it ( 'should allow deletion of facets one by one' , async ( ) => { await page . addFacet . click ( ) ; await page . addFacet . click ( ) ; await page . addFacet . click ( ) ; expect ( await page . getNumberOfFacets ( ) ) . toEqual ( 3 ) ; await page . closeFacet ( 2 ) ; expect ( await page . getNumberOfFacets ( ) ) . toEqual ( 2 ) ; await page . closeFacet ( 0 ) ; expect ( await page . getNumberOfFacets ( ) ) . toEqual ( 1 ) ; await page . getClearAllButton ( ) . click ( ) ; } ) ; it ( 'should allow deletion of all facets' , async ( ) => { await page . addFacet . click ( ) ; await page . addFacet . click ( ) ; await page . addFacet . click ( ) ; expect ( await page . getNumberOfFacets ( ) ) . toEqual ( 3 ) ; await page . getClearAllButton ( ) . click ( ) ; expect ( await page . getNumberOfFacets ( ) ) . toEqual ( 0 ) ; } ) ; } ) ;