Skip to content

Commit c06b33d

Browse files
benmonroKent C. Dodds
authored andcommitted
added examples for queryBy and note for new users. (testing-library#313)
1 parent 792748a commit c06b33d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

docs/testcafe-testing-library/intro.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ id: intro
33
title: Testcafe Testing Library
44
---
55

6-
[`testcafe-testing-library`][gh] allows the use of dom-testing queries within
7-
[Testcafe](https://devexpress.github.io/testcafe/) cross-browser end-to-end web
6+
## Introduction
7+
8+
[`testcafe-testing-library`][gh] allows the use of dom testing library queries within
9+
[Testcafe](https://devexpress.github.io/testcafe/) for cross-browser end-to-end web
810
testing.
911

12+
If you are new to the testing-library approach for writing tests, check out the [this guide on which query to use](https://testing-library.com/docs/guide-which-query) as well as the [cheat sheet](https://testing-library.com/docs/dom-testing-library/cheatsheet).
13+
14+
## Install
1015
```
1116
npm install --save-dev testcafe @testing-library/testcafe
1217
```
@@ -55,6 +60,7 @@ To show some simple examples (from
5560
[https://github.com/testing-library/testcafe-testing-library/blob/master/tests/testcafe/selectors.js](https://github.com/testing-library/testcafe-testing-library/blob/master/tests/testcafe/selectors.js)):
5661

5762
```javascript
63+
5864
test('getByPlaceHolderText', async t => {
5965
await t.typeText(
6066
getByPlaceholderText('Placeholder Text'),
@@ -71,6 +77,11 @@ test('getByLabelText', async t => {
7177
'Hello Input Labelled By Id'
7278
)
7379
})
80+
81+
test('queryAllByText', async t => {
82+
await t.expect(queryAllByText('Button Text').exists).ok()
83+
await t.expect(queryAllByText('Non-existing Button Text').exists).notOk()
84+
})
7485
```
7586

7687
## Configure

0 commit comments

Comments
 (0)