@@ -63,66 +63,9 @@ should be installed as one of your project's `devDependencies`:
63
63
npm install --save-dev testcafe-testing-library
64
64
```
65
65
66
- ### With typescript
67
-
68
- TODO: Add typescript support #10 PRs welcome!
69
-
70
- <!--
71
- Typings are defined under `cypress-testing-library/typings`, and should be added as follows in `tsconfig.json`:
72
-
73
- ```json
74
- {
75
- "compilerOptions": {
76
- "types": ["cypress", "../cypress-testing-library/typings"]
77
- }
78
- }
79
- ```
80
- -->
81
-
82
66
## Usage
83
67
84
- ` testcafe-testing-library ` provides custom Selectors allowing you to query the
85
- dom.
86
-
87
- Add ` testcafe-testing-library ` to your test fixture's ` beforeEach ` hook:
88
-
89
- ``` javascript
90
- import {
91
- getByText , // or any other queries you want
92
- addTestcafeTestingLibrary ,
93
- } from ' testcafe-testing-library'
94
-
95
- fixture` selectors` .beforeEach (addTestcafeTestingLibrary)
96
- .page ` http://localhost:13370`
97
- ```
98
-
99
- You can now import & use ` getBy ` , ` getAllBy ` , ` queryBy ` and ` queryAllBy `
100
- selectors in your tests.
101
- [ See ` dom-testing-library ` API for reference] ( dom-testing-library/api-queries.md )
102
-
103
- ## Examples
104
-
105
- To show some simple examples (from
106
- [ https://github.com/benmonro/testcafe-testing-library/blob/master/tests/testcafe/selectors.js ] ( https://github.com/benmonro/testcafe-testing-library/blob/master/tests/testcafe/selectors.js ) ):
107
-
108
- ``` javascript
109
- test (' getByPlaceHolderText' , async t => {
110
- await t .typeText (
111
- getByPlaceholderText (' Placeholder Text' ),
112
- ' Hello Placeholder' ,
113
- )
114
- })
115
- test (' getByText' , async t => {
116
- await t .click (getByText (' getByText' ))
117
- })
118
-
119
- test (' getByLabelText' , async t => {
120
- await t .typeText (
121
- getByLabelText (' Label For Input Labelled By Id' ),
122
- ' Hello Input Labelled By Id' ,
123
- )
124
- })
125
- ```
68
+ [ Usage Docs] ( https://testing-library.com/docs/testcafe-testing-library/intro#usage )
126
69
127
70
## Other Solutions
128
71
0 commit comments