You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Install the Detox package to your NativeScript project
45
46
46
-
```
47
+
```bash
47
48
npm install detox --save-dev
48
49
```
49
50
50
51
### Install Jest
51
52
52
-
```
53
+
```bash
53
54
npm install jest jest-cli jest-circus --save-dev --no-package-lock
54
55
```
55
56
56
57
### Initialize Detox
57
58
58
-
```
59
+
```bash
59
60
detox init -r jest
60
61
```
61
62
62
63
If things go well, you should to have this set up:
63
64
64
-
* An `e2e/` folder in your project root
65
-
* An `e2e/config.json` file; [example](https://github.com/wix/Detox/blob/master/examples/demo-react-native-jest/e2e/config.json)
66
-
* An `e2e/environment.js` file; [example](https://github.com/wix/Detox/blob/master/examples/demo-react-native-jest/e2e/environment.js)
67
-
* An `e2e/firstTest.e2e.js` file with content similar to [this](https://github.com/wix/Detox/blob/master/examples/demo-react-native-jest/e2e/app-hello.e2e.js).
65
+
- An `e2e/` folder in your project root
66
+
- An `e2e/config.json` file; [example](https://github.com/wix/Detox/blob/master/examples/demo-react-native-jest/e2e/config.json)
67
+
- An `e2e/environment.js` file; [example](https://github.com/wix/Detox/blob/master/examples/demo-react-native-jest/e2e/environment.js)
68
+
- An `e2e/firstTest.e2e.js` file with content similar to [this](https://github.com/wix/Detox/blob/master/examples/demo-react-native-jest/e2e/app-hello.e2e.js).
68
69
69
70
There should also be a file called `.detoxrc.json` in your project root.
70
71
@@ -74,42 +75,44 @@ Detox must be configued to know the location of the iOS and Android app binary a
74
75
75
76
Open `.detoxrc.json` and make the following modifications under `configurations` for iOS and Android.
76
77
77
-
*`binaryPath`: Specify the location of the app binary (probably something like below).
@@ -163,15 +166,15 @@ You should now be able to write tests to simulate user behavior and test for exp
163
166
164
167
Build your app for testing using the following command:
165
168
166
-
```
169
+
```bash
167
170
detox build -c ios|android
168
171
```
169
172
170
173
### Testing
171
174
172
175
Run your tests with the folling command:
173
176
174
-
```
177
+
```bash
175
178
detox test -c ios|android
176
179
```
177
180
@@ -181,28 +184,27 @@ To make this even easier I would suggest adding these scripts to your `package.j
181
184
182
185
```json
183
186
{
184
-
"scripts": {
185
-
...
186
-
"e2e:android:build": "detox build -c android",
187
-
"e2e:android:test": "detox test -c android && ./node_modules/.bin/enable-animations",
188
-
"e2e:ios:build": "detox build -c ios",
189
-
"e2e:ios:test": "detox test -c ios",
190
-
...
191
-
}
187
+
"scripts": {
188
+
"e2e:android:build": "detox build -c android",
189
+
"e2e:android:test": "detox test -c android && ./node_modules/.bin/enable-animations",
190
+
"e2e:ios:build": "detox build -c ios",
191
+
"e2e:ios:test": "detox test -c ios"
192
+
}
192
193
}
193
194
```
194
195
195
196
Now to build and run tests you would run:
196
197
197
198
Android:
198
-
```
199
+
200
+
```bash
199
201
npm run e2e:android:build
200
202
npm run e2e:android:test
201
203
```
202
204
203
205
iOS:
204
206
205
-
```
207
+
```bash
206
208
npm run e2e:ios:build
207
209
npm run e2e:ios:test
208
210
```
@@ -211,7 +213,7 @@ npm run e2e:ios:test
211
213
212
214
Detox requires a minimum SDK version of 18, so if you get the following error, change the `minSdkVersion` to 18 in `App_Resources/Android/app.gradle`.
213
215
214
-
```
216
+
```bash
215
217
Execution failed for task ':app:processDebugAndroidTestManifest'.
216
218
Manifest merger failed : uses-sdk:minSdkVersion 17 cannot be smaller than version 18 declared in library [com.wix:detox:17.6.1] /Users/user/.gradle/caches/transforms-2/files-2.1/91a3acd87d710d1913b266ac114d7001/jetified-detox-17.6.1/AndroidManifest.xml as the library might be using APIs not available in 17
217
219
Suggestion: use a compatible library with a minSdk of at most 17,
0 commit comments