Options
All
  • Public
  • Public/Protected
  • All
Menu

Module toHaveCount

Index

Functions

Functions

toHaveCount

  • toHaveCount(elements: UIElements, expectedCount: number): Promise<SyncExpectationResult>
  • 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>>
    await expect(page.$$('img')).toHaveCount(3);
    
    // or with Array<ElementHandle>
    const images = await page.$$('img');
    await expect(toastElement).toHaveCount(3);
    
    // or using an array of page and selector
    await expect([page, 'img']).toHaveCount(3);
    

    Parameters

    • elements: UIElements
    • expectedCount: number

    Returns Promise<SyncExpectationResult>

Generated using TypeDoc