@rnw-community/wdio 0.52.0 → 0.52.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/readme.md +28 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnw-community/wdio",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.3",
|
|
4
4
|
"description": "WDIO commands, page objects and utils",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wdio",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=14.0.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "746401aa95832a290fc72d6c9b6beb68be1384c7",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@rnw-community/shared": "^0.52.
|
|
48
|
+
"@rnw-community/shared": "^0.52.3",
|
|
49
49
|
"@wdio/globals": "^8.5.1",
|
|
50
50
|
"@wdio/protocols": "^8.3.11",
|
|
51
51
|
"expect-type": "^0.13.0",
|
package/readme.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
WDIO commands and utils.
|
|
4
4
|
|
|
5
|
+
[](https://badge.fury.io/js/%40rnw-community%2Fwdio)
|
|
6
|
+
[](https://www.npmjs.com/package/%40rnw-community%2Fwdio)
|
|
7
|
+
|
|
5
8
|
## TODO
|
|
6
9
|
|
|
7
10
|
- Refactor tests to mock MockElement(rename to MockElementPromise), use it instead of mockElement object
|
|
@@ -56,19 +59,19 @@ interface Props extends TestIDProps, React.PropsWithChildren {
|
|
|
56
59
|
|
|
57
60
|
const defaultTestID = 'DynamicComponent.Root';
|
|
58
61
|
|
|
59
|
-
export const DynamicComponent = ({children, ...props}:Props) => (
|
|
60
|
-
<View {...setPropTestID(defaultTestID, props)}>
|
|
61
|
-
|
|
62
|
-
</View>);
|
|
62
|
+
export const DynamicComponent = ({ children, ...props }: Props) => (
|
|
63
|
+
<View {...setPropTestID(defaultTestID, props)}>{children}</View>
|
|
64
|
+
);
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
## Commands
|
|
66
68
|
|
|
67
69
|
### Setup
|
|
70
|
+
|
|
68
71
|
#### copy 2 d.ts files into root of your e2e project
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
- [wdio.d.ts](https://github.com/rnw-community/rnw-community/blob/9294a867193951b8f37310ef0f7092c74f6b87f2/packages/wdio/src/wdio.d.ts)
|
|
74
|
+
- [webdriverio.d.ts](https://github.com/rnw-community/rnw-community/blob/9294a867193951b8f37310ef0f7092c74f6b87f2/packages/wdio/src/wevdriverio.d.ts)
|
|
72
75
|
|
|
73
76
|
#### add wdio.config.js to your e2e project
|
|
74
77
|
|
|
@@ -76,13 +79,13 @@ export const DynamicComponent = ({children, ...props}:Props) => (
|
|
|
76
79
|
import { addWdioCommands } from '@rnw-community/wdio';
|
|
77
80
|
|
|
78
81
|
export const wdioBaseConfiguration = (): WebdriverIO.Config => ({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
//...your config
|
|
83
|
+
before(_capabilities, _specs, browser: WebdriverIO.Browser) {
|
|
84
|
+
addWdioCommands(browser);
|
|
85
|
+
},
|
|
83
86
|
});
|
|
84
|
-
|
|
85
87
|
```
|
|
88
|
+
|
|
86
89
|
### Usage
|
|
87
90
|
|
|
88
91
|
#### openDeepLink
|
|
@@ -126,6 +129,7 @@ describe('DynamicComponent', () => {
|
|
|
126
129
|
});
|
|
127
130
|
});
|
|
128
131
|
```
|
|
132
|
+
|
|
129
133
|
#### slowInput
|
|
130
134
|
|
|
131
135
|
`slowInput` is the same as `setValue` but with support for typing speed
|
|
@@ -144,6 +148,7 @@ describe('Form', () => {
|
|
|
144
148
|
#### clearInput
|
|
145
149
|
|
|
146
150
|
`clearInput` does several things:
|
|
151
|
+
|
|
147
152
|
- clearValue which usually doesn't work
|
|
148
153
|
- setValue('') which usually doesn't work either
|
|
149
154
|
- gets text and deletes it character by character
|
|
@@ -174,7 +179,6 @@ describe('Form', () => {
|
|
|
174
179
|
});
|
|
175
180
|
```
|
|
176
181
|
|
|
177
|
-
|
|
178
182
|
## Components
|
|
179
183
|
|
|
180
184
|
### createComponent
|
|
@@ -205,6 +209,7 @@ describe('Card', () => {
|
|
|
205
209
|
`getComponent` is a helper function to get wdio component class with testID support
|
|
206
210
|
|
|
207
211
|
#### card.component.ts
|
|
212
|
+
|
|
208
213
|
```ts
|
|
209
214
|
import { getComponent } from '@rnw-community/wdio';
|
|
210
215
|
import { CardSelectors } from 'my-react-native-project/src/card.selectors';
|
|
@@ -215,7 +220,9 @@ export class Card extends getComponent(CardSelectors) {
|
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
222
|
```
|
|
223
|
+
|
|
218
224
|
#### card.spec.ts
|
|
225
|
+
|
|
219
226
|
```ts
|
|
220
227
|
import { Card } from './card.component';
|
|
221
228
|
|
|
@@ -264,6 +271,7 @@ describe('Card', () => {
|
|
|
264
271
|
`getRootedComponent` is a helper function to get wdio component class with testID support and root element
|
|
265
272
|
|
|
266
273
|
#### card.component.ts
|
|
274
|
+
|
|
267
275
|
```ts
|
|
268
276
|
import { getRootedComponent } from '@rnw-community/wdio';
|
|
269
277
|
import { CardSelectors } from 'my-react-native-project/src/card.selectors';
|
|
@@ -274,7 +282,9 @@ export class Card extends getRootedComponent(CardSelectors) {
|
|
|
274
282
|
}
|
|
275
283
|
}
|
|
276
284
|
```
|
|
285
|
+
|
|
277
286
|
#### card.spec.ts
|
|
287
|
+
|
|
278
288
|
```ts
|
|
279
289
|
import { Card } from './card.component';
|
|
280
290
|
|
|
@@ -294,11 +304,13 @@ describe('Card', () => {
|
|
|
294
304
|
});
|
|
295
305
|
});
|
|
296
306
|
```
|
|
307
|
+
|
|
297
308
|
## Recommendations
|
|
298
309
|
|
|
299
310
|
### Create Selectors enum for each component close to the component file
|
|
300
311
|
|
|
301
312
|
#### card.selectors.ts
|
|
313
|
+
|
|
302
314
|
```tsx
|
|
303
315
|
export enum CardSelectors {
|
|
304
316
|
Root = 'Root',
|
|
@@ -307,7 +319,8 @@ export enum CardSelectors {
|
|
|
307
319
|
```
|
|
308
320
|
|
|
309
321
|
#### card.tsx
|
|
310
|
-
|
|
322
|
+
|
|
323
|
+
```tsx
|
|
311
324
|
import { CardSelectors as Selectors } from './card.selectors';
|
|
312
325
|
export const Card = () => (
|
|
313
326
|
<View {...setTestID(CardSelectors.Root)}>
|
|
@@ -315,10 +328,11 @@ export const Card = () => (
|
|
|
315
328
|
</View>
|
|
316
329
|
);
|
|
317
330
|
```
|
|
331
|
+
|
|
318
332
|
### Export all selectors from your project in selectors.ts file in your src folder
|
|
319
333
|
|
|
320
334
|
#### selectors.ts
|
|
335
|
+
|
|
321
336
|
```tsx
|
|
322
337
|
export * from './card/card.selectors';
|
|
323
338
|
```
|
|
324
|
-
|