import { CustomFacetPage } from './custom-facet.po.spec' ; describe ( 'Custom Facet Tests' , ( ) => { let page = new CustomFacetPage ( ) ; beforeAll ( async ( ) => { await page . getPage ( ) ; } ) ; it ( 'should start with no facets' , ( ) => { expect < any > ( page . getNumberOfFacets ( ) ) . toEqual ( 0 ) ; expect ( page . getClearAllButton ( ) . isPresent ( ) ) . toBeFalsy ( ) ; expect ( page . getNoItemsLabel ( ) . isPresent ( ) ) . toBeTruthy ( ) ; expect ( page . confirmIsChecked ( 0 ) ) . toBeFalsy ( ) ; expect ( page . confirmIsChecked ( 1 ) ) . toBeFalsy ( ) ; expect ( page . confirmIsChecked ( 2 ) ) . toBeFalsy ( ) ; } ) ; it ( 'should allow addition of facets' , async ( ) => { page . getCheckbox ( 0 ) . click ( ) ; expect ( page . getClearAllButton ( ) . isPresent ( ) ) . toBeTruthy ( ) ; expect ( page . getNoItemsLabel ( ) . isPresent ( ) ) . toBeFalsy ( ) ; page . getCheckbox ( 1 ) . click ( ) ; page . getCheckbox ( 2 ) . click ( ) ; expect < any > ( page . getNumberOfFacets ( ) ) . toEqual ( 3 ) ; expect ( page . getFacetName ( 0 ) ) . toMatch ( 'Components' ) ; expect ( page . getFacetName ( 1 ) ) . toMatch ( 'Charts' ) ; expect ( page . getFacetName ( 2 ) ) . toMatch ( 'CSS' ) ; expect ( page . confirmIsChecked ( 0 ) ) . toBeTruthy ( ) ; expect ( page . confirmIsChecked ( 1 ) ) . toBeTruthy ( ) ; expect ( page . confirmIsChecked ( 2 ) ) . toBeTruthy ( ) ; await page . getClearAllButton ( ) . click ( ) ; } ) ; it ( 'should allow deletion of facets one by one by clicking on the facets' , async ( ) => { await page . getCheckbox ( 0 ) . click ( ) ; await page . getCheckbox ( 1 ) . click ( ) ; await page . getCheckbox ( 2 ) . click ( ) ; expect < any > ( await page . getNumberOfFacets ( ) ) . toEqual ( 3 ) ; expect ( await page . confirmIsChecked ( 0 ) ) . toBeTruthy ( ) ; expect ( await page . confirmIsChecked ( 1 ) ) . toBeTruthy ( ) ; expect ( await page . confirmIsChecked ( 2 ) ) . toBeTruthy ( ) ; await page . closeFacet ( 2 ) ; expect < any > ( await page . getNumberOfFacets ( ) ) . toEqual ( 2 ) ; await page . closeFacet ( 0 ) ; expect < any > ( await page . getNumberOfFacets ( ) ) . toEqual ( 1 ) ; expect ( await page . confirmIsChecked ( 0 ) ) . toBeFalsy ( ) ; expect ( await page . confirmIsChecked ( 1 ) ) . toBeTruthy ( ) ; expect ( await page . confirmIsChecked ( 2 ) ) . toBeFalsy ( ) ; await page . getClearAllButton ( ) . click ( ) ; } ) ; it ( 'should allow deletion of facets one by one by clicking on the checkboxes' , async ( ) => { await page . getCheckbox ( 2 ) . click ( ) ; await page . getCheckbox ( 1 ) . click ( ) ; await page . getCheckbox ( 0 ) . click ( ) ; expect < any > ( await page . getNumberOfFacets ( ) ) . toEqual ( 3 ) ; expect ( await page . getFacetName ( 0 ) ) . toMatch ( 'CSS' ) ; expect ( await page . getFacetName ( 1 ) ) . toMatch ( 'Charts' ) ; expect ( await page . getFacetName ( 2 ) ) . toMatch ( 'Components' ) ; await page . getCheckbox ( 1 ) . click ( ) ; expect < any > ( await page . getNumberOfFacets ( ) ) . toEqual ( 2 ) ; expect ( await page . getFacetName ( 0 ) ) . toMatch ( 'CSS' ) ; expect ( await page . getFacetName ( 1 ) ) . toMatch ( 'Components' ) ; await page . getCheckbox ( 0 ) . click ( ) ; expect < any > ( await page . getNumberOfFacets ( ) ) . toEqual ( 1 ) ; expect ( await page . getFacetName ( 0 ) ) . toMatch ( 'CSS' ) ; await page . getCheckbox ( 2 ) . click ( ) ; expect < any > ( await page . getNumberOfFacets ( ) ) . toEqual ( 0 ) ; expect ( await page . confirmIsChecked ( 0 ) ) . toBeFalsy ( ) ; expect ( await page . confirmIsChecked ( 1 ) ) . toBeFalsy ( ) ; expect ( await page . confirmIsChecked ( 2 ) ) . toBeFalsy ( ) ; } ) ; it ( 'should allow deletion of all facets' , ( ) => { page . getCheckbox ( 0 ) . click ( ) ; page . getCheckbox ( 1 ) . click ( ) ; page . getCheckbox ( 2 ) . click ( ) ; expect < any > ( page . getNumberOfFacets ( ) ) . toEqual ( 3 ) ; page . getClearAllButton ( ) . click ( ) ; expect < any > ( page . getNumberOfFacets ( ) ) . toEqual ( 0 ) ; expect ( page . getClearAllButton ( ) . isPresent ( ) ) . toBeFalsy ( ) ; expect ( page . getNoItemsLabel ( ) . isPresent ( ) ) . toBeTruthy ( ) ; expect ( page . confirmIsChecked ( 0 ) ) . toBeFalsy ( ) ; expect ( page . confirmIsChecked ( 1 ) ) . toBeFalsy ( ) ; expect ( page . confirmIsChecked ( 2 ) ) . toBeFalsy ( ) ; } ) ; } ) ;