Skip to content

Commit d957e5c

Browse files
updated detox test
1 parent 77f0d0b commit d957e5c

File tree

9 files changed

+195
-112
lines changed

9 files changed

+195
-112
lines changed

InstabugSample/.detoxrc.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"test-runner": "jest",
3+
"runner-config": "e2e/config.json",
4+
"configurations": {
5+
"ios.sim.debug": {
6+
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/InstabugSample.app",
7+
"build": "xcodebuild -workspace ios/InstabugSample.xcworkspace -scheme InstabugSample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
8+
"type": "ios.simulator",
9+
"name": "iPhone 12"
10+
},
11+
"ios.sim.release": {
12+
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/InstabugSample.app",
13+
"build": "xcodebuild -workspace ios/InstabugSample.xcworkspace -scheme InstabugSample -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
14+
"type": "ios.simulator",
15+
"name": "iPhone 12"
16+
},
17+
"android.emu.debug": {
18+
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
19+
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
20+
"type": "android.emulator",
21+
"name": "Pixel_3_API_28"
22+
},
23+
"android.emu.release": {
24+
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
25+
"build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
26+
"type": "android.emulator",
27+
"name": "Nexus_6P_API_27"
28+
}
29+
}
30+
}

InstabugSample/__e2e__/config.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

InstabugSample/__e2e__/init.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

InstabugSample/e2e/config.json

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

InstabugSample/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;

InstabugSample/__e2e__/firstTest.spec.js renamed to InstabugSample/e2e/firstTest.e2e.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
describe('Example', () => {
2-
beforeEach(async () => {
2+
beforeAll(async () => {
33
await device.launchApp();
44
});
55

6+
beforeEach(async () => {
7+
await device.reloadReactNative();
8+
});
9+
610
it('should have welcome screen', async () => {
711
await expect(element(by.id('welcome'))).toBeVisible();
812
});

InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
186186
A81BBED9C3312B4D853082DA /* [CP] Embed Pods Frameworks */,
187187
13C378C335FC13F596D2F0D4 /* [CP] Copy Pods Resources */,
188+
B8AD49B72488C8F0D000F195 /* [CP-User] [instabug-reactnative] Upload Sourcemap */,
188189
);
189190
buildRules = (
190191
);
@@ -360,6 +361,16 @@
360361
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InstabugSample/Pods-InstabugSample-frameworks.sh\"\n";
361362
showEnvVarsInLog = 0;
362363
};
364+
B8AD49B72488C8F0D000F195 /* [CP-User] [instabug-reactnative] Upload Sourcemap */ = {
365+
isa = PBXShellScriptBuildPhase;
366+
buildActionMask = 2147483647;
367+
files = (
368+
);
369+
name = "[CP-User] [instabug-reactnative] Upload Sourcemap";
370+
runOnlyForDeploymentPostprocessing = 0;
371+
shellPath = /bin/sh;
372+
shellScript = "bash \"../node_modules/instabug-reactnative/ios/upload_sourcemap.sh\"";
373+
};
363374
DD1AA4DBFEAB75A854826F0C /* [CP] Embed Pods Frameworks */ = {
364375
isa = PBXShellScriptBuildPhase;
365376
buildActionMask = 2147483647;

InstabugSample/package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@
1919
"@babel/runtime": "^7.15.4",
2020
"@react-native-community/eslint-config": "^3.0.1",
2121
"babel-jest": "^27.2.5",
22-
"detox": "18.16.0",
22+
"detox": "^18.22.1",
2323
"eslint": "^7.32.0",
2424
"jest": "^27.2.5",
2525
"metro-react-native-babel-preset": "^0.66.2",
2626
"react-test-renderer": "17.0.2"
2727
},
28-
2928
"detox": {
3029
"test-runner": "jest",
31-
"runner-config": "__e2e__/config.json",
30+
"runner-config": "e2e/config.json",
3231
"configurations": {
3332
"ios.sim.debug": {
3433
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/InstabugSample.app",
@@ -44,15 +43,13 @@
4443
},
4544
"android.emu.debug": {
4645
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
47-
"build":
48-
"cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
46+
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
4947
"type": "android.emulator",
5048
"name": "Pixel_3_API_28"
5149
},
5250
"android.emu.release": {
5351
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
54-
"build":
55-
"cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
52+
"build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
5653
"type": "android.emulator",
5754
"name": "Nexus_6P_API_27"
5855
}

0 commit comments

Comments
 (0)