Skip to content

Commit 98f4fec

Browse files
committed
Detox iOS setup
1 parent ed92d21 commit 98f4fec

File tree

11 files changed

+27640
-1728
lines changed

11 files changed

+27640
-1728
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ android/build/
88
android/local.properties
99
android/.gradle/
1010
yarn-error.log
11+
example/.watchman*

example/.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ module.exports = {
22
root: true,
33
extends: '@react-native-community',
44
parser: '@typescript-eslint/parser',
5+
env: {
6+
jest: true,
7+
},
58
};

example/e2e/config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"maxWorkers": 1,
3+
"testEnvironment": "./environment",
4+
"testRunner": "jest-circus/runner",
5+
"testTimeout": 120000,
6+
"testRegex": "\\.e2e\\.js$",
7+
"reporters": ["detox/runners/jest/streamlineReporter"],
8+
"verbose": true
9+
}

example/e2e/detoxrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"testRunner": "jest",
3+
"runnerConfig": "./e2e/config.json",
4+
"skipLegacyWorkersInjection": true,
5+
"apps": {
6+
"ios": {
7+
"type": "ios.app",
8+
"build": "set -o pipefail && xcodebuild -workspace ios/example.xcworkspace -scheme example -sdk iphonesimulator -destination platform=iOS\\ Simulator,OS=15.5,name=iPhone\\ 13 -derivedDataPath ios/build",
9+
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app"
10+
},
11+
"android": {
12+
"type": "android.apk",
13+
"binaryPath": "SPECIFY_PATH_TO_YOUR_APP_BINARY"
14+
}
15+
},
16+
"devices": {
17+
"simulator": {
18+
"type": "ios.simulator",
19+
"device": {
20+
"type": "iPhone 13"
21+
}
22+
},
23+
"emulator": {
24+
"type": "android.emulator",
25+
"device": {
26+
"avdName": "Pixel_3a_API_30_x86"
27+
}
28+
}
29+
},
30+
"configurations": {
31+
"ios": {
32+
"device": "simulator",
33+
"app": "ios"
34+
},
35+
"android": {
36+
"device": "emulator",
37+
"app": "android"
38+
}
39+
}
40+
}

example/e2e/environment.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const {
2+
DetoxCircusEnvironment,
3+
SpecReporter,
4+
WorkerAssignReporter,
5+
} = require('detox/runners/jest-circus');
6+
7+
class CustomDetoxEnvironment extends DetoxCircusEnvironment {
8+
constructor(config, context) {
9+
super(config, context);
10+
11+
// Can be safely removed, if you are content with the default value (=300000ms)
12+
this.initTimeout = 300000;
13+
14+
// This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level.
15+
// This is strictly optional.
16+
this.registerListeners({
17+
SpecReporter,
18+
WorkerAssignReporter,
19+
});
20+
}
21+
}
22+
23+
module.exports = CustomDetoxEnvironment;

example/e2e/ldk.e2e.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*eslint-disable no-undef*/
2+
3+
// https://wix.github.io/Detox/docs/introduction/writing-first-test
4+
describe('LDK integration test', () => {
5+
beforeAll(async () => {
6+
await device.launchApp();
7+
});
8+
9+
beforeEach(async () => {
10+
// await device.reloadReactNative();
11+
});
12+
13+
it('should have heading', async () => {
14+
await expect(element(by.text('react-native-ldk'))).toBeVisible();
15+
});
16+
17+
it('should show "Node running" after tapping start', async () => {
18+
// await element(by.id('start')).tap();
19+
await element(by.text('Start')).tap();
20+
await expect(element(by.text('"Node running"'))).toBeVisible();
21+
});
22+
});

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ PODS:
282282
- React-jsinspector (0.68.2)
283283
- React-logger (0.68.2):
284284
- glog
285-
- react-native-ldk (0.0.39):
285+
- react-native-ldk (0.0.40):
286286
- React
287287
- React-perflogger (0.68.2)
288288
- React-RCTActionSheet (0.68.2):
@@ -528,7 +528,7 @@ SPEC CHECKSUMS:
528528
React-jsiexecutor: b7b553412f2ec768fe6c8f27cd6bafdb9d8719e6
529529
React-jsinspector: c5989c77cb89ae6a69561095a61cce56a44ae8e8
530530
React-logger: a0833912d93b36b791b7a521672d8ee89107aff1
531-
react-native-ldk: 280d36775926c9fc0f50793f5fcb501dd8cc6d95
531+
react-native-ldk: 225b4f44c802b8dce8c4bda766a9b3c267db1fce
532532
React-perflogger: a18b4f0bd933b8b24ecf9f3c54f9bf65180f3fe6
533533
React-RCTActionSheet: 547fe42fdb4b6089598d79f8e1d855d7c23e2162
534534
React-RCTAnimation: bc9440a1c37b06ae9ebbb532d244f607805c6034

0 commit comments

Comments
 (0)