@@ -26,9 +26,26 @@ present.
26
26
27
27
### queryAllBy
28
28
29
- ` queryAllBy* ` queries return an array of all matching nodes for a query, and
29
+ ` queryAllBy* ` queries return an array of all matching nodes for a query, and
30
30
return an empty array (` [] ` ) if no elements match.
31
31
32
+ ### findBy
33
+
34
+ ` findBy* ` queries return a promise which resolves when an element is found which
35
+ matches the given query. The promise is rejected if no element is found after
36
+ a default timeout of ` 4500 ` ms.
37
+
38
+ > Note, this is a simple combination of ` getBy* ` queries and
39
+ > [ ` waitForElement ` ] ( /docs/api-async#waitforelement ) . The ` findBy* ` queries
40
+ > accept the ` waitForElement ` options as the last argument. (i.e.
41
+ > ` findByText(container, 'text', queryOptions, waitForElementOptions) ` )
42
+
43
+ ### findAllBy
44
+
45
+ ` findAllBy* ` queries return a promise which resolves to an array of elements when
46
+ any elements are found which match the given query. The promise is rejected if no
47
+ elements are found after a default timeout of ` 4500 ` ms.
48
+
32
49
## Options
33
50
34
51
The argument to a query can be a _ string_ , _ regular expression_ , or _ function_ .
@@ -41,6 +58,7 @@ See [TextMatch](#textmatch) for documentation on what can be passed to a query.
41
58
### ` ByLabelText `
42
59
43
60
> getByLabelText, queryByLabelText, getAllByLabelText, queryAllByLabelText
61
+ > findByLabelText, findAllByLabelText
44
62
45
63
``` typescript
46
64
getByLabelText (
@@ -128,7 +146,7 @@ const inputNode = getByLabelText(container, 'username', {
128
146
### ` ByPlaceholderText `
129
147
130
148
> getByPlaceholderText, queryByPlaceholderText, getAllByPlaceholderText,
131
- > queryAllByPlaceholderText
149
+ > queryAllByPlaceholderText, findByPlaceholderText, findAllByPlaceholderText
132
150
133
151
``` typescript
134
152
getByPlaceholderText (
@@ -182,7 +200,7 @@ cy.getByPlaceholderText('Username').should('exist')
182
200
183
201
### ` ByText `
184
202
185
- > getByText, queryByText, getAllByText, queryAllByText
203
+ > getByText, queryByText, getAllByText, queryAllByText, findByText, findAllByText
186
204
187
205
``` typescript
188
206
getByText (
@@ -253,7 +271,8 @@ If you'd rather disable this behavior, set `ignore` to `false`.
253
271
254
272
### ` ByAltText `
255
273
256
- > getByAltText, queryByAltText, getAllByAltText, queryAllByAltText
274
+ > getByAltText, queryByAltText, getAllByAltText, queryAllByAltText, findByAltText,
275
+ > findAllByAltText
257
276
258
277
``` typescript
259
278
getByAltText (
@@ -308,7 +327,8 @@ cy.getByAltText(/incredibles.*png$/i).should('exist')
308
327
309
328
### ` ByTitle `
310
329
311
- > getByTitle, queryByTitle, getAllByTitle, queryAllByTitle
330
+ > getByTitle, queryByTitle, getAllByTitle, queryAllByTitle, findByTitle,
331
+ > findAllByTitle
312
332
313
333
``` typescript
314
334
getByTitle (
@@ -366,7 +386,7 @@ cy.getByTitle('Close').should('exist')
366
386
### ` ByDisplayValue `
367
387
368
388
> getByDisplayValue, queryByDisplayValue, getAllByDisplayValue,
369
- > queryAllByDisplayValue
389
+ > queryAllByDisplayValue, findByDisplayValue, findAllByDisplayValue
370
390
371
391
``` typescript
372
392
getByDisplayValue (
@@ -501,7 +521,8 @@ cy.getByDisplayName('Alaska').should('exist')
501
521
502
522
### ` ByRole `
503
523
504
- > getByRole, queryByRole, getAllByRole, queryAllByRole
524
+ > getByRole, queryByRole, getAllByRole, queryAllByRole, findByRole,
525
+ > findAllByRole
505
526
506
527
``` typescript
507
528
getByRole (
@@ -550,7 +571,8 @@ cy.getByRole('dialog').should('exist')
550
571
551
572
### ` ByTestId `
552
573
553
- > getByTestId, queryByTestId, getAllByTestId, queryAllByTestId
574
+ > getByTestId, queryByTestId, getAllByTestId, queryAllByTestId, findByTestId,
575
+ > findAllByTestId
554
576
555
577
``` typescript
556
578
getByTestId (
0 commit comments