playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature] expect.toHaveCountGreaterThan() and expect.toHaveCountLowerThan()

Open gskierk opened this issue 2 years ago • 0 comments

Let us know what functionality you'd like to see in Playwright and what your use case is. Do you think others might benefit from this as well?

I consider it worthwhile to introduce new kinds of matchers to expect the number of elements that locator.count() returns.

const locator = page.locator('.selector')

await expect(locator).toHaveCount(2) // already implemented
await expect(locator).toHaveCountGreaterThan(5)
await expect(locator).toHaveCountLowerThan(10)

gskierk avatar May 21 '23 17:05 gskierk