Detox icon indicating copy to clipboard operation
Detox copied to clipboard

Count assertion API's

Open d4vidi opened this issue 1 year ago • 0 comments

Describe your idea

In some scenarios, it makes sense to assert the (visible?) amount of displayed views based on a criteria (matcher).

For example, a list with a search bar or a filter-options selector: It makes sense to assert that given a search term 'xyz', exactly 3 items would be displayed.

For this, (on behalf of the team) I'd like to propose the following conceptual API extensions, based on modifiers:

await expect(element(by.whatever(''))).count(2).toBeVisible()
await expect(element(by.whatever(''))).atLeast(2).toBeVisible()
await expect(element(by.whatever(''))).all.toBeVisible()
await expect(element(by.whatever(''))).all.toExist() // Valid for all expectation types
await expect(element(by.whatever(''))).all.not.toBeVisible() // The not modifier is still applicable

(and so on)

d4vidi avatar Mar 27 '24 14:03 d4vidi