detox 20.0.14-next-is-hittable-check-2.0 → 20.0.15-prerelease.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.md5 → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar.md5} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha1 → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar.sha1} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha256 → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar.sha256} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha512 → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar.sha512} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios.tbz +0 -0
- package/index.d.ts +3 -6
- package/internals.d.ts +26 -5
- package/local-cli/cli.js +1 -1
- package/local-cli/init.js +1 -1
- package/local-cli/test.js +6 -6
- package/local-cli/test.test.js +61 -28
- package/local-cli/testCommand/TestRunnerCommand.js +77 -87
- package/local-cli/testCommand/builder.js +0 -1
- package/local-cli/testCommand/middlewares.js +4 -13
- package/local-cli/testCommand/warnings.js +0 -3
- package/package.json +14 -8
- package/runners/deprecation.js +42 -44
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/index.test.js +13 -0
- package/runners/jest/reporters/DetoxReporter.js +21 -10
- package/runners/jest/testEnvironment/index.js +57 -41
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +62 -35
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +12 -14
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -5
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
- package/src/DetoxWorker.js +84 -46
- package/src/android/interactions/native.js +3 -2
- package/src/artifacts/ArtifactsManager.js +6 -6
- package/src/configuration/collectCliConfig.js +1 -12
- package/src/configuration/composeRunnerConfig.js +4 -3
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +1 -1
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +2 -0
- package/src/devices/runtime/RuntimeDevice.js +3 -3
- package/src/errors/DetoxConfigErrorComposer.js +6 -1
- package/src/ios/expectTwo.js +3 -2
- package/src/ipc/SessionState.js +7 -5
- package/src/logger/DetoxLogger.js +32 -41
- package/src/logger/index.js +1 -0
- package/src/logger/utils/BunyanLogger.js +11 -7
- package/src/logger/utils/CategoryThreadDispatcher.js +7 -29
- package/src/logger/utils/DetoxLogFinalizer.js +140 -0
- package/src/logger/utils/ThreadDispatcher.js +5 -25
- package/src/logger/utils/customConsoleLogger.js +4 -3
- package/src/logger/utils/sanitizeBunyanContext.js +3 -1
- package/src/logger/utils/streamUtils.js +34 -26
- package/src/logger/utils/tracerLegacy.js +14 -25
- package/src/realms/DetoxContext.js +8 -7
- package/src/realms/DetoxPrimaryContext.js +22 -82
- package/src/realms/DetoxSecondaryContext.js +0 -8
- package/src/utils/argparse.js +11 -0
- package/src/utils/logger.js +1 -1
- package/src/utils/traceInvocationCall.js +21 -0
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha512 +0 -1
- package/runners/jest/deprecation.js +0 -25
- package/src/configuration/utils/warnings.js +0 -12
- package/src/utils/trace.js +0 -3
@@ -1,4 +1,5 @@
|
|
1
1
|
const chalk = require('chalk').default;
|
2
|
+
const noop = require('lodash/noop');
|
2
3
|
|
3
4
|
const { config, log, session } = require('../../../../internals');
|
4
5
|
const { traceln } = require('../utils/stdout');
|
@@ -15,16 +16,21 @@ class SpecReporter {
|
|
15
16
|
this._suitesDesc = '';
|
16
17
|
}
|
17
18
|
|
18
|
-
|
19
|
+
setup() {
|
19
20
|
const jestSection = config.testRunner.jest;
|
20
21
|
const reportSpecs = jestSection && jestSection.reportSpecs;
|
21
|
-
|
22
|
-
|
22
|
+
const enabled = reportSpecs !== undefined ? reportSpecs : session.workersCount === 1;
|
23
|
+
|
24
|
+
if (!enabled) {
|
25
|
+
this.run_describe_start = noop;
|
26
|
+
this.run_describe_finish = noop;
|
27
|
+
this.test_start = noop;
|
28
|
+
this.test_done = noop;
|
29
|
+
this.test_skip = noop;
|
30
|
+
}
|
23
31
|
}
|
24
32
|
|
25
33
|
run_describe_start(event) {
|
26
|
-
if (!this.enabled) return;
|
27
|
-
|
28
34
|
if (event.describeBlock.parent !== undefined) {
|
29
35
|
this._onSuiteStart({
|
30
36
|
description: event.describeBlock.name,
|
@@ -33,16 +39,12 @@ class SpecReporter {
|
|
33
39
|
}
|
34
40
|
|
35
41
|
run_describe_finish(event) {
|
36
|
-
if (!this.enabled) return;
|
37
|
-
|
38
42
|
if (event.describeBlock.parent !== undefined) {
|
39
43
|
this._onSuiteEnd();
|
40
44
|
}
|
41
45
|
}
|
42
46
|
|
43
47
|
test_start(event) {
|
44
|
-
if (!this.enabled) return;
|
45
|
-
|
46
48
|
const { test } = event;
|
47
49
|
this._onTestStart({
|
48
50
|
description: test.name,
|
@@ -51,8 +53,6 @@ class SpecReporter {
|
|
51
53
|
}
|
52
54
|
|
53
55
|
test_done(event) {
|
54
|
-
if (!this.enabled) return;
|
55
|
-
|
56
56
|
const { test } = event;
|
57
57
|
const testInfo = {
|
58
58
|
description: test.name,
|
@@ -62,8 +62,6 @@ class SpecReporter {
|
|
62
62
|
}
|
63
63
|
|
64
64
|
test_skip(event) {
|
65
|
-
if (!this.enabled) return;
|
66
|
-
|
67
65
|
const testInfo = {
|
68
66
|
description: event.test.name,
|
69
67
|
};
|
@@ -110,7 +108,7 @@ class SpecReporter {
|
|
110
108
|
.concat(suite.description)
|
111
109
|
.concat((index === total - 1) ? ': ' : '');
|
112
110
|
});
|
113
|
-
this._suitesDesc = chalk.bold
|
111
|
+
this._suitesDesc = chalk.bold(this._suitesDesc);
|
114
112
|
}
|
115
113
|
|
116
114
|
_traceTest({ description, invocations }, _status = undefined) {
|
@@ -13,7 +13,7 @@ class WorkerAssignReporter {
|
|
13
13
|
|
14
14
|
run_start() {
|
15
15
|
if (config.testRunner.jest.reportWorkerAssign) {
|
16
|
-
log.info({ cat: 'lifecycle' }, `${this.
|
16
|
+
log.info({ cat: 'lifecycle' }, `${chalk.bold(this._testName)} is assigned to ${this._formatDeviceName()}`);
|
17
17
|
}
|
18
18
|
}
|
19
19
|
|
@@ -25,10 +25,6 @@ class WorkerAssignReporter {
|
|
25
25
|
|
26
26
|
return formattedDeviceName;
|
27
27
|
}
|
28
|
-
|
29
|
-
_formatTestName() {
|
30
|
-
return chalk.whiteBright(this._testName);
|
31
|
-
}
|
32
28
|
}
|
33
29
|
|
34
30
|
module.exports = WorkerAssignReporter;
|
@@ -1,8 +1,10 @@
|
|
1
1
|
const fs = require('fs');
|
2
2
|
const path = require('path');
|
3
3
|
|
4
|
+
const resolveFrom = require('resolve-from');
|
4
5
|
const semver = require('semver');
|
5
6
|
|
7
|
+
const { log } = require('../../../../internals');
|
6
8
|
const detoxPackageJson = require('../../../../package.json');
|
7
9
|
const { DetoxRuntimeError } = require('../../../../src/errors');
|
8
10
|
|
@@ -25,6 +27,10 @@ function assertJestCircus27(maybeProjectConfig) {
|
|
25
27
|
});
|
26
28
|
}
|
27
29
|
|
30
|
+
const jestManifestPath = resolveFrom(process.cwd(), 'jest/package.json');
|
31
|
+
const jestManifest = require(jestManifestPath);
|
32
|
+
assertSupportedVersion(jestManifest.version);
|
33
|
+
|
28
34
|
const circusVersion = require(circusPackageJson).version;
|
29
35
|
if (!circusVersion) {
|
30
36
|
throw new DetoxRuntimeError({
|
@@ -33,7 +39,14 @@ function assertJestCircus27(maybeProjectConfig) {
|
|
33
39
|
});
|
34
40
|
}
|
35
41
|
|
36
|
-
|
42
|
+
if (jestManifest.version !== circusVersion) {
|
43
|
+
log.warn([
|
44
|
+
`jest-circus@${circusVersion} does not match jest@${jestManifest.version}.\n`,
|
45
|
+
`- jest@${jestManifest.version} resolved path:\n\t${jestManifestPath}`,
|
46
|
+
`- jest-circus@${circusVersion} resolved path:\n\t${circusPackageJson}`,
|
47
|
+
`\nPlease make sure that your versions match to avoid unexpected behavior!`,
|
48
|
+
].join('\n'));
|
49
|
+
}
|
37
50
|
|
38
51
|
return maybeProjectConfig;
|
39
52
|
}
|
@@ -41,11 +54,12 @@ function assertJestCircus27(maybeProjectConfig) {
|
|
41
54
|
function assertSupportedVersion(actualVersion) {
|
42
55
|
const supportedRange = detoxPackageJson.peerDependencies.jest;
|
43
56
|
const minSupportedVersion = semver.minVersion(supportedRange);
|
57
|
+
const action = semver.lt(actualVersion, minSupportedVersion) ? 'upgrade' : 'downgrade';
|
44
58
|
|
45
|
-
if (semver.
|
59
|
+
if (!semver.satisfies(actualVersion, supportedRange, { includePrerelease: true })) {
|
46
60
|
throw new DetoxRuntimeError({
|
47
61
|
message: `Detected an unsupported jest@${actualVersion} version.`,
|
48
|
-
hint: `Please
|
62
|
+
hint: `Please ${action} your Jest test runner to the supported range: ${supportedRange}.`
|
49
63
|
});
|
50
64
|
}
|
51
65
|
}
|
package/src/DetoxWorker.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
const CAF = require('caf');
|
1
2
|
const _ = require('lodash');
|
2
3
|
|
3
4
|
const Client = require('./client/Client');
|
@@ -11,7 +12,6 @@ const uuid = require('./utils/uuid');
|
|
11
12
|
class DetoxWorker {
|
12
13
|
constructor(context) {
|
13
14
|
this._context = context;
|
14
|
-
this._isCleaningUp = false;
|
15
15
|
this._injectedGlobalProperties = [];
|
16
16
|
this._config = context[symbols.config];
|
17
17
|
this._runtimeErrorComposer = new DetoxRuntimeErrorComposer(this._config);
|
@@ -33,6 +33,18 @@ class DetoxWorker {
|
|
33
33
|
onError: this._onEmitError.bind(this),
|
34
34
|
});
|
35
35
|
|
36
|
+
|
37
|
+
/** @type {DetoxInternals.RuntimeConfig['apps']} */
|
38
|
+
this._appsConfig = null;
|
39
|
+
/** @type {DetoxInternals.RuntimeConfig['artifacts']} */
|
40
|
+
this._artifactsConfig = null;
|
41
|
+
/** @type {DetoxInternals.RuntimeConfig['behavior']} */
|
42
|
+
this._behaviorConfig = null;
|
43
|
+
/** @type {DetoxInternals.RuntimeConfig['device']} */
|
44
|
+
this._deviceConfig = null;
|
45
|
+
/** @type {DetoxInternals.RuntimeConfig['session']} */
|
46
|
+
this._sessionConfig = null;
|
47
|
+
|
36
48
|
/** @type {string} */
|
37
49
|
this.id = 'worker';
|
38
50
|
/** @type {Detox.Device} */
|
@@ -54,11 +66,23 @@ class DetoxWorker {
|
|
54
66
|
this.trace = this._context.trace;
|
55
67
|
/** @deprecated */
|
56
68
|
this.traceCall = this._context.traceCall;
|
57
|
-
}
|
58
69
|
|
59
|
-
|
60
|
-
|
70
|
+
this._reinstallAppsOnDevice = CAF(this._reinstallAppsOnDevice.bind(this));
|
71
|
+
this._initToken = new CAF.cancelToken();
|
72
|
+
|
73
|
+
this._cafWrap([
|
74
|
+
'init',
|
75
|
+
'onRunDescribeStart',
|
76
|
+
'onTestStart',
|
77
|
+
'onHookFailure',
|
78
|
+
'onTestFnFailure',
|
79
|
+
'onTestDone',
|
80
|
+
'onRunDescribeFinish',
|
81
|
+
]);
|
82
|
+
}
|
61
83
|
|
84
|
+
/** @this {DetoxWorker} */
|
85
|
+
init = function* (signal) {
|
62
86
|
const {
|
63
87
|
apps: appsConfig,
|
64
88
|
artifacts: artifactsConfig,
|
@@ -72,6 +96,7 @@ class DetoxWorker {
|
|
72
96
|
this._behaviorConfig = behaviorConfig;
|
73
97
|
this._deviceConfig = deviceConfig;
|
74
98
|
this._sessionConfig = sessionConfig;
|
99
|
+
// @ts-ignore
|
75
100
|
this._sessionConfig.sessionId = sessionConfig.sessionId || uuid.UUID();
|
76
101
|
this._runtimeErrorComposer.appsConfig = this._appsConfig;
|
77
102
|
|
@@ -83,8 +108,7 @@ class DetoxWorker {
|
|
83
108
|
}
|
84
109
|
};
|
85
110
|
|
86
|
-
|
87
|
-
if (this._isCleaningUp) return;
|
111
|
+
yield this._client.connect();
|
88
112
|
|
89
113
|
const invocationManager = new InvocationManager(this._client);
|
90
114
|
|
@@ -101,8 +125,7 @@ class DetoxWorker {
|
|
101
125
|
} = environmentFactory.createFactories(this._deviceConfig);
|
102
126
|
|
103
127
|
const envValidator = envValidatorFactory.createValidator();
|
104
|
-
|
105
|
-
if (this._isCleaningUp) return;
|
128
|
+
yield envValidator.validate();
|
106
129
|
|
107
130
|
const commonDeps = {
|
108
131
|
invocationManager,
|
@@ -113,8 +136,7 @@ class DetoxWorker {
|
|
113
136
|
|
114
137
|
this._artifactsManager = artifactsManagerFactory.createArtifactsManager(this._artifactsConfig, commonDeps);
|
115
138
|
this._deviceAllocator = deviceAllocatorFactory.createDeviceAllocator(commonDeps);
|
116
|
-
this._deviceCookie =
|
117
|
-
if (this._isCleaningUp) return;
|
139
|
+
this._deviceCookie = yield this._deviceAllocator.allocate(this._deviceConfig);
|
118
140
|
|
119
141
|
this.device = runtimeDeviceFactory.createRuntimeDevice(
|
120
142
|
this._deviceCookie,
|
@@ -125,7 +147,6 @@ class DetoxWorker {
|
|
125
147
|
deviceConfig: this._deviceConfig,
|
126
148
|
sessionConfig,
|
127
149
|
});
|
128
|
-
if (this._isCleaningUp) return;
|
129
150
|
|
130
151
|
const matchers = matchersFactory.createMatchers({
|
131
152
|
invocationManager,
|
@@ -146,26 +167,22 @@ class DetoxWorker {
|
|
146
167
|
}
|
147
168
|
|
148
169
|
// @ts-ignore
|
149
|
-
|
150
|
-
if (this._isCleaningUp) return;
|
170
|
+
yield this.device.installUtilBinaries();
|
151
171
|
|
152
172
|
if (behaviorConfig.init.reinstallApp) {
|
153
|
-
|
154
|
-
if (this._isCleaningUp) return;
|
173
|
+
yield this._reinstallAppsOnDevice(signal);
|
155
174
|
}
|
156
175
|
|
157
176
|
const appAliases = Object.keys(this._appsConfig);
|
158
177
|
if (appAliases.length === 1) {
|
159
|
-
|
178
|
+
yield this.device.selectApp(appAliases[0]);
|
160
179
|
} else {
|
161
|
-
|
180
|
+
yield this.device.selectApp(null);
|
162
181
|
}
|
163
|
-
|
164
|
-
return this;
|
165
|
-
}
|
182
|
+
};
|
166
183
|
|
167
184
|
async cleanup() {
|
168
|
-
this.
|
185
|
+
this._initToken.abort('CLEANUP');
|
169
186
|
|
170
187
|
for (const key of this._injectedGlobalProperties) {
|
171
188
|
delete DetoxWorker.global[key];
|
@@ -198,38 +215,45 @@ class DetoxWorker {
|
|
198
215
|
return this._context.log;
|
199
216
|
}
|
200
217
|
|
201
|
-
onRunDescribeStart =
|
202
|
-
|
203
|
-
|
218
|
+
onRunDescribeStart = function* (_signal, ...args) {
|
219
|
+
yield this._artifactsManager.onRunDescribeStart(...args);
|
220
|
+
};
|
221
|
+
|
222
|
+
onTestStart = function* (_signal, testSummary) {
|
204
223
|
this._validateTestSummary('beforeEach', testSummary);
|
205
224
|
|
206
|
-
|
207
|
-
await this._dumpUnhandledErrorsIfAny({
|
225
|
+
yield this._dumpUnhandledErrorsIfAny({
|
208
226
|
pendingRequests: false,
|
209
227
|
testName: testSummary.fullName,
|
210
228
|
});
|
211
229
|
|
212
|
-
|
213
|
-
|
230
|
+
yield this._artifactsManager.onTestStart(testSummary);
|
231
|
+
};
|
232
|
+
|
233
|
+
onHookFailure = function* (_signal, ...args) {
|
234
|
+
yield this._artifactsManager.onHookFailure(...args);
|
235
|
+
};
|
236
|
+
|
237
|
+
onTestFnFailure = function* (_signal, ...args) {
|
238
|
+
yield this._artifactsManager.onTestFnFailure(...args);
|
214
239
|
};
|
215
|
-
|
216
|
-
|
217
|
-
onTestDone = async (testSummary) => {
|
218
|
-
if (this._isCleaningUp) return;
|
240
|
+
|
241
|
+
onTestDone = function* (_signal, testSummary) {
|
219
242
|
this._validateTestSummary('afterEach', testSummary);
|
220
243
|
|
221
|
-
|
222
|
-
await this._artifactsManager.onTestDone(testSummary);
|
244
|
+
yield this._artifactsManager.onTestDone(testSummary);
|
223
245
|
|
224
|
-
|
225
|
-
await this._dumpUnhandledErrorsIfAny({
|
246
|
+
yield this._dumpUnhandledErrorsIfAny({
|
226
247
|
pendingRequests: testSummary.timedOut,
|
227
248
|
testName: testSummary.fullName,
|
228
249
|
});
|
229
250
|
};
|
230
|
-
onRunDescribeFinish = async (...args) => this._artifactsManager.onRunDescribeFinish(...args);
|
231
251
|
|
232
|
-
|
252
|
+
onRunDescribeFinish = function* (_signal, ...args) {
|
253
|
+
yield this._artifactsManager.onRunDescribeFinish(...args);
|
254
|
+
};
|
255
|
+
|
256
|
+
*_reinstallAppsOnDevice(_signal) {
|
233
257
|
const appNames = _(this._appsConfig)
|
234
258
|
.map((config, key) => [key, `${config.binaryPath}:${config.testBinaryPath}`])
|
235
259
|
.uniqBy(1)
|
@@ -237,17 +261,13 @@ class DetoxWorker {
|
|
237
261
|
.value();
|
238
262
|
|
239
263
|
for (const appName of appNames) {
|
240
|
-
|
241
|
-
|
242
|
-
await this.device.uninstallApp();
|
243
|
-
if (this._isCleaningUp) return;
|
264
|
+
yield this.device.selectApp(appName);
|
265
|
+
yield this.device.uninstallApp();
|
244
266
|
}
|
245
267
|
|
246
268
|
for (const appName of appNames) {
|
247
|
-
|
248
|
-
|
249
|
-
await this.device.installApp();
|
250
|
-
if (this._isCleaningUp) return;
|
269
|
+
yield this.device.selectApp(appName);
|
270
|
+
yield this.device.installApp();
|
251
271
|
}
|
252
272
|
}
|
253
273
|
|
@@ -279,6 +299,24 @@ class DetoxWorker {
|
|
279
299
|
error
|
280
300
|
);
|
281
301
|
}
|
302
|
+
|
303
|
+
_cafWrap(methodNames) {
|
304
|
+
for (const methodName of methodNames) {
|
305
|
+
const cafMethod = CAF(this[methodName].bind(this));
|
306
|
+
this[methodName] = async (...args) => {
|
307
|
+
try {
|
308
|
+
await cafMethod(this._initToken.signal, ...args);
|
309
|
+
} catch (e) {
|
310
|
+
if (e !== 'CLEANUP') {
|
311
|
+
throw e;
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
return this;
|
316
|
+
};
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
282
320
|
}
|
283
321
|
|
284
322
|
/**
|
@@ -1,6 +1,7 @@
|
|
1
1
|
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
2
2
|
const { expectDescription, actionDescription } = require('../../utils/invocationTraceDescriptions');
|
3
|
-
const
|
3
|
+
const log = require('../../utils/logger').child({ cat: 'ws-client, ws' });
|
4
|
+
const traceInvocationCall = require('../../utils/traceInvocationCall').bind(null, log);
|
4
5
|
const { ScrollAmountStopAtEdgeAction } = require('../actions/native');
|
5
6
|
const { NativeMatcher } = require('../core/NativeMatcher');
|
6
7
|
const DetoxAssertionApi = require('../espressoapi/DetoxAssertion');
|
@@ -18,7 +19,7 @@ class Interaction {
|
|
18
19
|
}
|
19
20
|
|
20
21
|
async execute() {
|
21
|
-
return
|
22
|
+
return traceInvocationCall(this._traceDescription, this._call,
|
22
23
|
this._invocationManager.execute(this._call).then((resultObj) => resultObj ? resultObj.result : undefined));
|
23
24
|
}
|
24
25
|
}
|
@@ -46,13 +46,13 @@ class ArtifactsManager extends EventEmitter {
|
|
46
46
|
_resolveArtifactsPathBuilder(pathBuilder, rootDir) {
|
47
47
|
if (typeof pathBuilder === 'string') {
|
48
48
|
pathBuilder = resolveModuleFromPath(pathBuilder);
|
49
|
+
}
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
51
|
+
if (typeof pathBuilder === 'function') {
|
52
|
+
try {
|
53
|
+
pathBuilder = pathBuilder({ rootDir });
|
54
|
+
} catch (e) {
|
55
|
+
pathBuilder = new pathBuilder({ rootDir });
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
@@ -1,9 +1,6 @@
|
|
1
1
|
const _ = require('lodash');
|
2
2
|
|
3
3
|
const argparse = require('../utils/argparse');
|
4
|
-
const log = require('../utils/logger').child({ cat: 'config' });
|
5
|
-
|
6
|
-
const { DEVICE_LAUNCH_ARGS_GENERIC_DEPRECATION } = require('./utils/warnings');
|
7
4
|
|
8
5
|
const asBoolean = (value) => {
|
9
6
|
if (typeof value === 'boolean') {
|
@@ -25,14 +22,6 @@ const asNumber = (value) => {
|
|
25
22
|
: undefined;
|
26
23
|
};
|
27
24
|
|
28
|
-
const deprecateDeviceLaunchArgs = (value) => {
|
29
|
-
if (value) {
|
30
|
-
log.warn(DEVICE_LAUNCH_ARGS_GENERIC_DEPRECATION);
|
31
|
-
}
|
32
|
-
|
33
|
-
return value;
|
34
|
-
};
|
35
|
-
|
36
25
|
function collectCliConfig({ argv }) {
|
37
26
|
const env = (key) => argparse.getArgValue(key);
|
38
27
|
const get = (key, fallback) => {
|
@@ -51,7 +40,7 @@ function collectCliConfig({ argv }) {
|
|
51
40
|
configPath: get('config-path'),
|
52
41
|
configuration: get('configuration'),
|
53
42
|
debugSynchronization: asNumber(get('debug-synchronization')),
|
54
|
-
deviceBootArgs: get('device-boot-args'
|
43
|
+
deviceBootArgs: get('device-boot-args'),
|
55
44
|
appLaunchArgs: get('app-launch-args'),
|
56
45
|
deviceName: get('device-name'),
|
57
46
|
forceAdbInstall: asBoolean(get('force-adb-install')),
|
@@ -120,9 +120,10 @@ function hasEmptyPositionalArgs(value, key) {
|
|
120
120
|
* @param {Detox.DetoxTestRunnerConfig} config
|
121
121
|
*/
|
122
122
|
function inspectBrkHookDefault(config) {
|
123
|
-
|
124
|
-
|
125
|
-
|
123
|
+
/* istanbul ignore next */
|
124
|
+
config.args.$0 = os.platform() !== 'win32'
|
125
|
+
? `node --inspect-brk ./node_modules/.bin/jest`
|
126
|
+
: `node --inspect-brk ./node_modules/jest/bin/jest.js`;
|
126
127
|
config.args.runInBand = true;
|
127
128
|
delete config.args.w;
|
128
129
|
delete config.args.workers;
|
@@ -93,7 +93,7 @@ class AppleSimUtils {
|
|
93
93
|
`(https://developer.apple.com/xcode/). In case you already have the latest Xcode version installed, ` +
|
94
94
|
`try run the command: \`sudo xcode-select -s /Applications/Xcode.app\`. If you are running tests from CI, ` +
|
95
95
|
`we recommend running them with "--headless" device configuration (see: ` +
|
96
|
-
`https://wix.github.io/Detox/docs/next/
|
96
|
+
`https://wix.github.io/Detox/docs/next/cli/test/#options).`
|
97
97
|
);
|
98
98
|
}
|
99
99
|
|
@@ -10,6 +10,8 @@ class GenyGlobalLifecycleHandler {
|
|
10
10
|
this._instanceLifecycleService = instanceLifecycleService;
|
11
11
|
}
|
12
12
|
|
13
|
+
// TODO: remove this ignore as soon as DetoxPrimaryContext is covered with tests
|
14
|
+
/* istanbul ignore next */
|
13
15
|
async globalInit() {}
|
14
16
|
|
15
17
|
emergencyCleanup() {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
2
2
|
const debug = require('../../utils/debug'); // debug utils, leave here even if unused
|
3
3
|
const log = require('../../utils/logger').child({ cat: 'device' });
|
4
|
-
const { traceCall } = require('../../utils/trace');
|
5
4
|
const traceMethods = require('../../utils/traceMethods');
|
6
5
|
const wrapWithStackTraceCutter = require('../../utils/wrapWithStackTraceCutter');
|
7
6
|
|
@@ -22,6 +21,7 @@ class RuntimeDevice {
|
|
22
21
|
'disableSynchronization',
|
23
22
|
'enableSynchronization',
|
24
23
|
'installApp',
|
24
|
+
'installUtilBinaries',
|
25
25
|
'launchApp',
|
26
26
|
'matchFace',
|
27
27
|
'matchFinger',
|
@@ -258,12 +258,12 @@ class RuntimeDevice {
|
|
258
258
|
async installUtilBinaries() {
|
259
259
|
const paths = this._deviceConfig.utilBinaryPaths;
|
260
260
|
if (paths) {
|
261
|
-
await
|
261
|
+
await this.deviceDriver.installUtilBinaries(paths);
|
262
262
|
}
|
263
263
|
}
|
264
264
|
|
265
265
|
async reloadReactNative() {
|
266
|
-
await
|
266
|
+
await this.deviceDriver.reloadReactNative();
|
267
267
|
}
|
268
268
|
|
269
269
|
async openURL(params) {
|
@@ -664,7 +664,12 @@ Examine your Detox config${this._atPath()}`,
|
|
664
664
|
}
|
665
665
|
|
666
666
|
invalidTestRunnerProperty(isGlobal) {
|
667
|
-
const testRunner = _.get(
|
667
|
+
const testRunner = _.get(
|
668
|
+
isGlobal
|
669
|
+
? this.contents
|
670
|
+
: this._getSelectedConfiguration(),
|
671
|
+
['testRunner']
|
672
|
+
);
|
668
673
|
|
669
674
|
return new DetoxConfigError({
|
670
675
|
message: `testRunner should be an object, not a ${typeof testRunner}`,
|
package/src/ios/expectTwo.js
CHANGED
@@ -8,7 +8,8 @@ const tempfile = require('tempfile');
|
|
8
8
|
|
9
9
|
const { assertEnum, assertNormalized } = require('../utils/assertArgument');
|
10
10
|
const { actionDescription, expectDescription } = require('../utils/invocationTraceDescriptions');
|
11
|
-
const
|
11
|
+
const log = require('../utils/logger').child({ cat: 'ws-client, ws' });
|
12
|
+
const traceInvocationCall = require('../utils/traceInvocationCall').bind(null, log);
|
12
13
|
|
13
14
|
const assertDirection = assertEnum(['left', 'right', 'up', 'down']);
|
14
15
|
const assertSpeed = assertEnum(['fast', 'slow']);
|
@@ -747,7 +748,7 @@ function throwElementError(param) {
|
|
747
748
|
}
|
748
749
|
|
749
750
|
function _executeInvocation(invocationManager, invocation, traceDescription) {
|
750
|
-
return
|
751
|
+
return traceInvocationCall(traceDescription, invocation, invocationManager.execute(invocation));
|
751
752
|
}
|
752
753
|
|
753
754
|
module.exports = IosExpect;
|
package/src/ipc/SessionState.js
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
const vm = require('vm');
|
2
|
+
|
1
3
|
const cycle = require('json-cycle');
|
2
4
|
|
3
|
-
const
|
5
|
+
const context = vm.createContext({ require }, {
|
6
|
+
name: 'VM User Context',
|
7
|
+
});
|
4
8
|
|
5
9
|
class SessionState {
|
6
10
|
constructor({
|
7
|
-
id =
|
11
|
+
id = '',
|
8
12
|
contexts = [],
|
9
|
-
detoxConfigSnapshotPath = '',
|
10
13
|
detoxConfig = null,
|
11
14
|
detoxIPCServer = '',
|
12
15
|
testResults = [],
|
@@ -15,7 +18,6 @@ class SessionState {
|
|
15
18
|
}) {
|
16
19
|
this.id = id;
|
17
20
|
this.contexts = contexts;
|
18
|
-
this.detoxConfigSnapshotPath = detoxConfigSnapshotPath;
|
19
21
|
this.detoxConfig = detoxConfig;
|
20
22
|
this.detoxIPCServer = detoxIPCServer;
|
21
23
|
this.testResults = testResults;
|
@@ -42,7 +44,7 @@ class SessionState {
|
|
42
44
|
|
43
45
|
static reviver(key, val) {
|
44
46
|
if (typeof val === 'object' && val !== null && typeof val.$fn == 'string') {
|
45
|
-
return
|
47
|
+
return vm.runInContext(val.$fn, context);
|
46
48
|
} else {
|
47
49
|
return val;
|
48
50
|
}
|