Use toHaveCount function when you want to check that an elements length is equal to the expected length
example
// could be used with Promise<Array<ElementHandle>>awaitexpect(page.$$('img')).toHaveCount(3);// or with Array<ElementHandle>constimages = awaitpage.$$('img');awaitexpect(toastElement).toHaveCount(3);// or using an array of page and selectorawaitexpect([page, 'img']).toHaveCount(3);
Use
toHaveCount
function when you want to check that an elements length is equal to the expected length