detox 20.1.0-next-is-hittable-check.0 → 20.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +2 -7
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar → 20.1.1/detox-20.1.1-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar → 20.1.1/detox-20.1.1-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom → 20.1.1/detox-20.1.1.pom} +1 -1
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.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/android/build.gradle +0 -1
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +3 -3
- package/android/detox/src/full/java/com/wix/detox/adapters/server/QueryStatusActionHandler.kt +12 -80
- package/android/detox/src/full/java/com/wix/detox/espresso/common/UiControllerImplReflected.kt +16 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/idlingresources/DescriptiveIdlingResource.kt +8 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/BusyResourcesInquirer.kt +48 -0
- package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResource.kt +92 -0
- package/android/detox/src/full/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescription.kt → inquiry/DetoxBusyResourceDescription.kt} +6 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AnimatedModuleIdlingResource.java +18 -7
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResource.kt +3 -4
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/BridgeIdlingResource.java +12 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DetoxBaseIdlingResource.java +2 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +14 -8
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +2 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIManagerModuleReflected.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +4 -6
- package/android/detox/src/testFull/java/com/wix/detox/adapters/server/QueryStatusActionHandlerSpec.kt +35 -94
- package/android/detox/src/testFull/java/com/wix/detox/espresso/registry/{IRStatusInquirerTest.kt → BusyResourcesInquirerTest.kt} +46 -7
- package/android/detox/src/testFull/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescriptionSpec.kt → inquiry/DetoxBusyResourceDescriptionSpec.kt} +6 -6
- package/android/detox/src/testFull/java/com/wix/detox/inquiry/DetoxBusyResourceSpec.kt +134 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResourceSpec.kt +4 -5
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +5 -5
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResourceSpec.kt +4 -6
- package/index.d.ts +102 -18
- package/index.js +12 -1
- package/internals.d.ts +34 -9
- package/internals.js +10 -3
- package/local-cli/cli.js +6 -3
- package/local-cli/init.js +1 -1
- package/local-cli/test.js +6 -6
- package/local-cli/testCommand/TestRunnerCommand.js +97 -94
- package/local-cli/testCommand/TestRunnerError.js +17 -0
- 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 +31 -16
- package/runners/deprecation.js +42 -44
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- 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/src/DetoxWorker.js +96 -50
- package/src/android/core/NativeMatcher.js +14 -10
- package/src/android/espressoapi/EspressoDetox.js +1 -1
- package/src/android/espressoapi/web/WebElement.js +1 -1
- package/src/android/interactions/native.js +3 -2
- package/src/android/matchers/native.js +1 -2
- package/src/artifacts/ArtifactsManager.js +6 -6
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
- package/src/artifacts/templates/plugin/TwoSnapshotsPerTestPlugin.js +2 -1
- package/src/artifacts/templates/plugin/WholeTestRecorderPlugin.js +3 -2
- package/src/artifacts/utils/temporaryPath.js +32 -2
- package/src/client/AsyncWebSocket.js +3 -2
- package/src/client/actions/SyncStatusSchema.json +21 -0
- package/src/client/actions/formatters/SyncStatusFormatter.js +2 -0
- package/src/client/actions/formatters/sync-resources/BgThreadFormatter.js +5 -0
- package/src/configuration/collectCliConfig.js +2 -13
- package/src/configuration/composeLoggerConfig.js +1 -0
- package/src/configuration/composeRunnerConfig.js +5 -4
- package/src/devices/allocation/drivers/AllocationDriverBase.js +4 -2
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -3
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +3 -16
- package/src/devices/allocation/factories/base.js +1 -1
- package/src/devices/common/drivers/android/exec/ADB.js +4 -0
- package/src/devices/common/drivers/android/tools/AppInstallHelper.js +4 -4
- package/src/devices/common/drivers/android/tools/{FileXfer.js → FileTransfer.js} +2 -2
- package/src/devices/common/drivers/android/tools/TempFileTransfer.js +14 -0
- 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/devices/runtime/drivers/android/AndroidDriver.js +7 -6
- package/src/devices/runtime/factories/android.js +6 -5
- package/src/devices/runtime/factories/base.js +3 -2
- package/src/errors/DetoxConfigErrorComposer.js +6 -1
- package/src/errors/DetoxError.js +5 -1
- package/src/ios/expectTwo.js +22 -13
- package/src/ipc/IPCClient.js +26 -17
- package/src/ipc/IPCServer.js +11 -3
- package/src/ipc/SessionState.js +11 -11
- package/src/logger/DetoxLogger.js +67 -47
- package/src/logger/index.js +1 -0
- package/src/logger/utils/BunyanLogger.js +54 -10
- package/src/logger/utils/CategoryThreadDispatcher.js +8 -29
- package/src/logger/utils/DetoxLogFinalizer.js +166 -0
- package/src/logger/utils/MessageStack.js +17 -6
- package/src/logger/utils/ThreadDispatcher.js +5 -25
- package/src/logger/utils/customConsoleLogger.js +22 -5
- package/src/logger/utils/getMainCategory.js +5 -0
- package/src/logger/utils/sanitizeBunyanContext.js +3 -1
- package/src/logger/utils/streams/BunyanTransformer.js +72 -0
- package/src/logger/utils/streams/ChromeTraceTransformer.js +132 -0
- package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
- package/src/logger/utils/streams/JSONLStringer.js +55 -0
- package/src/logger/utils/streams/index.js +7 -0
- package/src/logger/utils/streams/transformers.js +39 -0
- package/src/logger/utils/tracerLegacy.js +14 -25
- package/src/realms/DetoxContext.js +16 -9
- package/src/realms/DetoxInternalsFacade.js +1 -7
- package/src/realms/DetoxPrimaryContext.js +42 -87
- package/src/realms/DetoxSecondaryContext.js +9 -13
- package/src/{symbols.js → realms/symbols.js} +0 -0
- package/src/servicelocator/android/index.js +2 -2
- package/src/utils/ExclusiveLockfile.js +1 -0
- package/src/utils/argparse.js +11 -27
- package/src/utils/logger.js +1 -1
- package/src/utils/pathUtils.js +11 -0
- package/src/utils/shellUtils.js +17 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/IRStatusInquirer.kt +0 -24
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DescriptiveIdlingResource.kt +0 -10
- package/local-cli/build.test.js +0 -104
- package/local-cli/run-server.test.js +0 -23
- package/local-cli/test.test.js +0 -569
- package/runners/jest/deprecation.js +0 -25
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -23
- package/src/configuration/utils/warnings.js +0 -12
- package/src/devices/common/drivers/android/tools/TempFileXfer.js +0 -16
- package/src/logger/utils/streamUtils.js +0 -240
- package/src/realms/index.js +0 -10
- package/src/utils/trace.js +0 -3
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
1
2
|
// @ts-nocheck
|
2
3
|
const DetoxRuntimeError = require('../../../errors/DetoxRuntimeError');
|
3
4
|
|
@@ -85,7 +86,7 @@ class TwoSnapshotsPerTestPlugin extends ArtifactPlugin {
|
|
85
86
|
* @protected
|
86
87
|
* @abstract
|
87
88
|
*/
|
88
|
-
async preparePathForSnapshot(testSummary, snapshotName) {}
|
89
|
+
async preparePathForSnapshot(testSummary, snapshotName) {}
|
89
90
|
|
90
91
|
/***
|
91
92
|
* Creates a handle for a test artifact (video recording, log, etc.)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
2
2
|
const ArtifactPlugin = require('./ArtifactPlugin');
|
3
3
|
|
4
4
|
/***
|
@@ -8,6 +8,7 @@ class WholeTestRecorderPlugin extends ArtifactPlugin {
|
|
8
8
|
constructor({ api }) {
|
9
9
|
super({ api });
|
10
10
|
|
11
|
+
/** @type {*} */
|
11
12
|
this.testRecording = null;
|
12
13
|
}
|
13
14
|
|
@@ -51,7 +52,7 @@ class WholeTestRecorderPlugin extends ArtifactPlugin {
|
|
51
52
|
* @abstract
|
52
53
|
* @protected
|
53
54
|
*/
|
54
|
-
createTestRecording() {}
|
55
|
+
createTestRecording(config) {}
|
55
56
|
|
56
57
|
/***
|
57
58
|
* @abstract
|
@@ -1,14 +1,42 @@
|
|
1
1
|
const path = require('path');
|
2
|
+
const { promisify } = require('util');
|
2
3
|
|
4
|
+
const glob = require('glob');
|
3
5
|
const tempfile = require('tempfile');
|
4
6
|
|
7
|
+
const { useForwardSlashes } = require('../../utils/shellUtils');
|
8
|
+
|
9
|
+
const globSync = glob.sync;
|
10
|
+
const globAsync = promisify(glob);
|
11
|
+
|
12
|
+
function getRoot() {
|
13
|
+
return path.dirname(tempfile());
|
14
|
+
}
|
15
|
+
|
16
|
+
function createGlobber(ext) {
|
17
|
+
const fullExt = `.detox.${ext}`;
|
18
|
+
|
19
|
+
return {
|
20
|
+
sync: (pattern) => {
|
21
|
+
const cwd = getRoot();
|
22
|
+
const files = globSync(useForwardSlashes(pattern + fullExt), { cwd });
|
23
|
+
return files.map(f => path.join(cwd, f));
|
24
|
+
},
|
25
|
+
async: async (pattern) => {
|
26
|
+
const cwd = getRoot();
|
27
|
+
const files = await globAsync(useForwardSlashes(pattern + fullExt), { cwd });
|
28
|
+
return files.map(f => path.join(cwd, f));
|
29
|
+
},
|
30
|
+
};
|
31
|
+
}
|
32
|
+
|
5
33
|
function createTempFileBuilderFn(fileExtension) {
|
6
34
|
/**
|
7
35
|
* @param {string} [basename]
|
8
36
|
*/
|
9
37
|
return (basename) => {
|
10
38
|
return basename
|
11
|
-
? path.join(
|
39
|
+
? path.join(getRoot(), `${basename}.detox.${fileExtension}`)
|
12
40
|
: tempfile(`.detox.${fileExtension}`);
|
13
41
|
};
|
14
42
|
}
|
@@ -23,5 +51,7 @@ module.exports = {
|
|
23
51
|
dtxrec: createTempFileBuilderFn('dtxrec'),
|
24
52
|
viewhierarchy: createTempFileBuilderFn('viewhierarchy'),
|
25
53
|
},
|
26
|
-
|
54
|
+
find: {
|
55
|
+
jsonl: createGlobber('jsonl'),
|
56
|
+
},
|
27
57
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
1
2
|
// @ts-nocheck
|
2
3
|
const _ = require('lodash');
|
3
4
|
const WebSocket = require('ws');
|
@@ -176,7 +177,7 @@ class AsyncWebSocket {
|
|
176
177
|
* @param {WebSocket.OpenEvent} event
|
177
178
|
* @private
|
178
179
|
*/
|
179
|
-
_onOpen(event) {
|
180
|
+
_onOpen(event) {
|
180
181
|
log.trace(`opened web socket to: ${this._url}`);
|
181
182
|
this._opening.resolve();
|
182
183
|
this._opening = null;
|
@@ -268,7 +269,7 @@ class AsyncWebSocket {
|
|
268
269
|
* @param {WebSocket.CloseEvent | null} event
|
269
270
|
* @private
|
270
271
|
*/
|
271
|
-
_onClose(event) {
|
272
|
+
_onClose(event) {
|
272
273
|
if (this._closing) {
|
273
274
|
this._closing.resolve();
|
274
275
|
}
|
@@ -232,6 +232,27 @@
|
|
232
232
|
],
|
233
233
|
"additionalProperties":false
|
234
234
|
},
|
235
|
+
{
|
236
|
+
"properties":{
|
237
|
+
"name":{
|
238
|
+
"const":"bg"
|
239
|
+
},
|
240
|
+
"description":{
|
241
|
+
"type":"object",
|
242
|
+
"properties":{
|
243
|
+
"reason":{
|
244
|
+
"type":"string"
|
245
|
+
}
|
246
|
+
},
|
247
|
+
"additionalProperties":false
|
248
|
+
}
|
249
|
+
},
|
250
|
+
"required":[
|
251
|
+
"name",
|
252
|
+
"description"
|
253
|
+
],
|
254
|
+
"additionalProperties":false
|
255
|
+
},
|
235
256
|
{
|
236
257
|
"properties":{
|
237
258
|
"name":{
|
@@ -4,6 +4,7 @@ const Ajv = require('ajv');
|
|
4
4
|
const DetoxInternalError = require('../../../errors/DetoxInternalError');
|
5
5
|
const statusSchema = require('../SyncStatusSchema.json');
|
6
6
|
|
7
|
+
const bgThreadFormatter = require('./sync-resources/BgThreadFormatter');
|
7
8
|
const delayedPerformSelectorFormatter = require('./sync-resources/DelayedPerformSelectorFormatter');
|
8
9
|
const dispatchQueueFormatter = require('./sync-resources/DispatchQueueFormatter');
|
9
10
|
const jsTimersFormatter = require('./sync-resources/JavaScriptTimersFormatter');
|
@@ -51,6 +52,7 @@ function resourcesDescriptionsFromJSON(jsonDescriptions) {
|
|
51
52
|
}
|
52
53
|
|
53
54
|
const resourceFormatters = {
|
55
|
+
bg: bgThreadFormatter,
|
54
56
|
delayed_perform_selector: delayedPerformSelectorFormatter,
|
55
57
|
dispatch_queue: dispatchQueueFormatter,
|
56
58
|
run_loop: runLoopFormatter,
|
@@ -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,16 +22,8 @@ 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
|
-
const env = (key) => argparse.
|
26
|
+
const env = (key) => argparse.getEnvValue(key);
|
38
27
|
const get = (key, fallback) => {
|
39
28
|
const value = argv && Reflect.has(argv, key) ? argv[key] : env(key);
|
40
29
|
return value === undefined ? fallback : value;
|
@@ -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')),
|
@@ -91,7 +91,7 @@ function adaptLegacyRunnerConfig(globalConfig) {
|
|
91
91
|
return globalConfig.testRunner;
|
92
92
|
}
|
93
93
|
|
94
|
-
log.warn(`Please migrate your Detox config according to the guide:\nhttps://wix.github.io/Detox/docs/
|
94
|
+
log.warn(`Please migrate your Detox config according to the guide:\nhttps://wix.github.io/Detox/docs/guide/migration\n`);
|
95
95
|
const testRunner = globalConfig[testRunnerKey];
|
96
96
|
const runnerConfig = globalConfig[runnerConfigKey];
|
97
97
|
const specs = globalConfig.specs != null ? String(globalConfig.specs) : undefined;
|
@@ -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;
|
@@ -1,4 +1,6 @@
|
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
1
2
|
// @ts-nocheck
|
3
|
+
|
2
4
|
/**
|
3
5
|
* @typedef DeallocOptions
|
4
6
|
* @property shutdown { Boolean }
|
@@ -9,14 +11,14 @@ class AllocationDriverBase {
|
|
9
11
|
* @param deviceConfig { Object }
|
10
12
|
* @return {Promise<DeviceCookie>}
|
11
13
|
*/
|
12
|
-
async allocate(deviceConfig) {}
|
14
|
+
async allocate(deviceConfig) {}
|
13
15
|
|
14
16
|
/**
|
15
17
|
* @param cookie { DeviceCookie }
|
16
18
|
* @param options { DeallocOptions }
|
17
19
|
* @return {Promise<void>}
|
18
20
|
*/
|
19
|
-
async free(cookie, options) {}
|
21
|
+
async free(cookie, options) {}
|
20
22
|
}
|
21
23
|
|
22
24
|
module.exports = AllocationDriverBase;
|
@@ -36,7 +36,7 @@ class EmulatorLauncher extends DeviceLauncher {
|
|
36
36
|
retries: 2,
|
37
37
|
interval: 100,
|
38
38
|
conditionFn: isUnknownEmulatorError,
|
39
|
-
}, () => this._launchEmulator(avdName, launchCommand));
|
39
|
+
}, () => this._launchEmulator(avdName, launchCommand, adbName));
|
40
40
|
}
|
41
41
|
await this._awaitEmulatorBoot(adbName);
|
42
42
|
await this._notifyBootEvent(adbName, avdName, !isRunning);
|
@@ -60,8 +60,8 @@ class EmulatorLauncher extends DeviceLauncher {
|
|
60
60
|
await this._notifyShutdownCompleted(adbName);
|
61
61
|
}
|
62
62
|
|
63
|
-
_launchEmulator(emulatorName, launchCommand) {
|
64
|
-
return launchEmulatorProcess(emulatorName, this._emulatorExec, launchCommand);
|
63
|
+
_launchEmulator(emulatorName, launchCommand, adbName) {
|
64
|
+
return launchEmulatorProcess(emulatorName, this._emulatorExec, launchCommand, this._adb, adbName);
|
65
65
|
}
|
66
66
|
|
67
67
|
async _awaitEmulatorBoot(adbName) {
|
@@ -1,29 +1,15 @@
|
|
1
1
|
const fs = require('fs');
|
2
2
|
|
3
3
|
const _ = require('lodash');
|
4
|
-
const { Tail } = require('tail');
|
5
4
|
|
6
5
|
const unitLogger = require('../../../../../utils/logger').child({ cat: 'device' });
|
7
6
|
|
8
|
-
function launchEmulatorProcess(emulatorName, emulatorExec, emulatorLaunchCommand) {
|
7
|
+
function launchEmulatorProcess(emulatorName, emulatorExec, emulatorLaunchCommand, adb, adbName) {
|
9
8
|
let childProcessOutput;
|
10
|
-
|
11
9
|
const portName = emulatorLaunchCommand.port ? `-${emulatorLaunchCommand.port}` : '';
|
12
10
|
const tempLog = `./${emulatorName}${portName}.log`;
|
13
11
|
const stdout = fs.openSync(tempLog, 'a');
|
14
12
|
const stderr = fs.openSync(tempLog, 'a');
|
15
|
-
const tailOptions = {
|
16
|
-
useWatchFile: true,
|
17
|
-
fsWatchOptions: {
|
18
|
-
interval: 1500,
|
19
|
-
},
|
20
|
-
};
|
21
|
-
const tail = new Tail(tempLog, tailOptions)
|
22
|
-
.on('line', (line) => {
|
23
|
-
if (line.includes('Adb connected, start proxing data')) {
|
24
|
-
childProcessPromise._cpResolve();
|
25
|
-
}
|
26
|
-
});
|
27
13
|
|
28
14
|
function detach() {
|
29
15
|
if (childProcessOutput) {
|
@@ -32,7 +18,6 @@ function launchEmulatorProcess(emulatorName, emulatorExec, emulatorLaunchCommand
|
|
32
18
|
|
33
19
|
childProcessOutput = fs.readFileSync(tempLog, 'utf8');
|
34
20
|
|
35
|
-
tail.unwatch();
|
36
21
|
fs.closeSync(stdout);
|
37
22
|
fs.closeSync(stderr);
|
38
23
|
fs.unlink(tempLog, _.noop);
|
@@ -46,6 +31,8 @@ function launchEmulatorProcess(emulatorName, emulatorExec, emulatorLaunchCommand
|
|
46
31
|
|
47
32
|
log = log.child({ child_pid: childProcessPromise.childProcess.pid });
|
48
33
|
|
34
|
+
adb.waitForDevice(adbName).then(() => childProcessPromise._cpResolve());
|
35
|
+
|
49
36
|
return childProcessPromise.then(() => true).catch((err) => {
|
50
37
|
detach();
|
51
38
|
|
@@ -16,7 +16,7 @@ class DeviceAllocatorFactory {
|
|
16
16
|
* @returns { AllocationDriverBase }
|
17
17
|
* @private
|
18
18
|
*/
|
19
|
-
_createDriver(deps) {} // eslint-disable-line no-unused-vars
|
19
|
+
_createDriver(deps) {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
20
20
|
}
|
21
21
|
|
22
22
|
module.exports = DeviceAllocatorFactory;
|
@@ -189,6 +189,10 @@ class ADB {
|
|
189
189
|
}
|
190
190
|
}
|
191
191
|
|
192
|
+
async waitForDevice(deviceId) {
|
193
|
+
return await this.adbCmd(deviceId, 'wait-for-device');
|
194
|
+
}
|
195
|
+
|
192
196
|
async apiLevel(deviceId) {
|
193
197
|
if (this._cachedApiLevels.has(deviceId)) {
|
194
198
|
return this._cachedApiLevels.get(deviceId);
|
@@ -1,13 +1,13 @@
|
|
1
1
|
// TODO Tweak such that if apk's already exist on the device (need to store uniquely), they will not be resent (would optimize cloud, for example)
|
2
2
|
|
3
3
|
class AppInstallHelper {
|
4
|
-
constructor(adb,
|
4
|
+
constructor(adb, fileTransfer) {
|
5
5
|
this._adb = adb;
|
6
|
-
this.
|
6
|
+
this._fileTransfer = fileTransfer;
|
7
7
|
}
|
8
8
|
|
9
9
|
async install(deviceId, appBinaryPath, testBinaryPath) {
|
10
|
-
await this.
|
10
|
+
await this._fileTransfer.prepareDestinationDir(deviceId);
|
11
11
|
await this._pushAndInstallBinary(deviceId, appBinaryPath, 'Application.apk');
|
12
12
|
if (testBinaryPath) {
|
13
13
|
await this._pushAndInstallBinary(deviceId, testBinaryPath, 'Test.apk');
|
@@ -15,7 +15,7 @@ class AppInstallHelper {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
async _pushAndInstallBinary(deviceId, binaryPath, binaryFilenameOnTarget) {
|
18
|
-
const binaryPathOnTarget = await this.
|
18
|
+
const binaryPathOnTarget = await this._fileTransfer.send(deviceId, binaryPath, binaryFilenameOnTarget);
|
19
19
|
await this._adb.remoteInstall(deviceId, binaryPathOnTarget);
|
20
20
|
}
|
21
21
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const path = require('path');
|
2
2
|
|
3
|
-
class
|
3
|
+
class FileTransfer {
|
4
4
|
constructor(adb, destinationDir) {
|
5
5
|
this._adb = adb;
|
6
6
|
this._dir = destinationDir;
|
@@ -18,4 +18,4 @@ class FileXfer {
|
|
18
18
|
}
|
19
19
|
}
|
20
20
|
|
21
|
-
module.exports =
|
21
|
+
module.exports = FileTransfer;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
const FileTransfer = require('./FileTransfer');
|
2
|
+
|
3
|
+
const FILE_PATH = '/data/local/tmp/detox';
|
4
|
+
|
5
|
+
class TempFileTransfer extends FileTransfer {
|
6
|
+
constructor(adb) {
|
7
|
+
super(adb, FILE_PATH);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
module.exports = {
|
12
|
+
TempFileTransfer,
|
13
|
+
FILE_PATH
|
14
|
+
};
|
@@ -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/
|
96
|
+
`https://wix.github.io/Detox/docs/cli/test/#options).`
|
97
97
|
);
|
98
98
|
}
|
99
99
|
|
@@ -6,7 +6,9 @@ const cleanupLogData = {
|
|
6
6
|
|
7
7
|
class GenyGlobalLifecycleHandler {
|
8
8
|
constructor({ deviceCleanupRegistry, instanceLifecycleService }) {
|
9
|
+
/** @private */
|
9
10
|
this._deviceCleanupRegistry = deviceCleanupRegistry;
|
11
|
+
/** @private */
|
10
12
|
this._instanceLifecycleService = instanceLifecycleService;
|
11
13
|
}
|
12
14
|
|
@@ -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) {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
1
2
|
// @ts-nocheck
|
2
3
|
const path = require('path');
|
3
4
|
const URL = require('url').URL;
|
@@ -31,7 +32,7 @@ const log = logger.child({ cat: 'device' });
|
|
31
32
|
* @property adb { ADB }
|
32
33
|
* @property aapt { AAPT }
|
33
34
|
* @property apkValidator { ApkValidator }
|
34
|
-
* @property
|
35
|
+
* @property fileTransfer { FileTransfer }
|
35
36
|
* @property appInstallHelper { AppInstallHelper }
|
36
37
|
* @property appUninstallHelper { AppUninstallHelper }
|
37
38
|
* @property devicePathBuilder { AndroidDevicePathBuilder }
|
@@ -51,7 +52,7 @@ class AndroidDriver extends DeviceDriverBase {
|
|
51
52
|
this.aapt = deps.aapt;
|
52
53
|
this.apkValidator = deps.apkValidator;
|
53
54
|
this.invocationManager = deps.invocationManager;
|
54
|
-
this.
|
55
|
+
this.fileTransfer = deps.fileTransfer;
|
55
56
|
this.appInstallHelper = deps.appInstallHelper;
|
56
57
|
this.appUninstallHelper = deps.appUninstallHelper;
|
57
58
|
this.devicePathBuilder = deps.devicePathBuilder;
|
@@ -162,11 +163,11 @@ class AndroidDriver extends DeviceDriverBase {
|
|
162
163
|
}
|
163
164
|
}
|
164
165
|
|
165
|
-
async pressBack() {
|
166
|
+
async pressBack() {
|
166
167
|
await this.uiDevice.pressBack();
|
167
168
|
}
|
168
169
|
|
169
|
-
async sendToHome(params) {
|
170
|
+
async sendToHome(params) {
|
170
171
|
await this.uiDevice.pressHome();
|
171
172
|
}
|
172
173
|
|
@@ -331,8 +332,8 @@ class AndroidDriver extends DeviceDriverBase {
|
|
331
332
|
}
|
332
333
|
|
333
334
|
async _sendNotificationDataToDevice(dataFileLocalPath, adbName) {
|
334
|
-
await this.
|
335
|
-
return await this.
|
335
|
+
await this.fileTransfer.prepareDestinationDir(adbName);
|
336
|
+
return await this.fileTransfer.send(adbName, dataFileLocalPath, 'notification.json');
|
336
337
|
}
|
337
338
|
|
338
339
|
_startActivityWithUrl(url) {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
1
2
|
const RuntimeDeviceFactory = require('./base');
|
2
3
|
|
3
4
|
class RuntimeDriverFactoryAndroid extends RuntimeDeviceFactory {
|
@@ -6,7 +7,7 @@ class RuntimeDriverFactoryAndroid extends RuntimeDeviceFactory {
|
|
6
7
|
const adb = serviceLocator.adb;
|
7
8
|
const aapt = serviceLocator.aapt;
|
8
9
|
const apkValidator = serviceLocator.apkValidator;
|
9
|
-
const
|
10
|
+
const fileTransfer = serviceLocator.fileTransfer;
|
10
11
|
const devicePathBuilder = serviceLocator.devicePathBuilder;
|
11
12
|
|
12
13
|
const AppInstallHelper = require('../../common/drivers/android/tools/AppInstallHelper');
|
@@ -18,9 +19,9 @@ class RuntimeDriverFactoryAndroid extends RuntimeDeviceFactory {
|
|
18
19
|
adb,
|
19
20
|
aapt,
|
20
21
|
apkValidator,
|
21
|
-
|
22
|
+
fileTransfer,
|
22
23
|
devicePathBuilder,
|
23
|
-
appInstallHelper: new AppInstallHelper(adb,
|
24
|
+
appInstallHelper: new AppInstallHelper(adb, fileTransfer),
|
24
25
|
appUninstallHelper: new AppUninstallHelper(adb),
|
25
26
|
instrumentation: new MonitoredInstrumentation(adb),
|
26
27
|
};
|
@@ -41,7 +42,7 @@ class AndroidEmulator extends RuntimeDriverFactoryAndroid {
|
|
41
42
|
}
|
42
43
|
|
43
44
|
class AndroidAttached extends RuntimeDriverFactoryAndroid {
|
44
|
-
_createDriver(deviceCookie, deps, configs) {
|
45
|
+
_createDriver(deviceCookie, deps, configs) {
|
45
46
|
const props = {
|
46
47
|
adbName: deviceCookie.adbName,
|
47
48
|
};
|
@@ -52,7 +53,7 @@ class AndroidAttached extends RuntimeDriverFactoryAndroid {
|
|
52
53
|
}
|
53
54
|
|
54
55
|
class Genycloud extends RuntimeDriverFactoryAndroid {
|
55
|
-
_createDriver(deviceCookie, deps, configs) {
|
56
|
+
_createDriver(deviceCookie, deps, configs) {
|
56
57
|
const props = {
|
57
58
|
instance: deviceCookie.instance,
|
58
59
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
1
2
|
const RuntimeDevice = require('../RuntimeDevice');
|
2
3
|
|
3
4
|
class RuntimeDeviceFactory {
|
@@ -7,8 +8,8 @@ class RuntimeDeviceFactory {
|
|
7
8
|
return new RuntimeDevice({ ...commonDeps, ...configs }, runtimeDriver);
|
8
9
|
}
|
9
10
|
|
10
|
-
_createDriverDependencies(commonDeps) { }
|
11
|
-
_createDriver(deviceCookie, deps, configs) {}
|
11
|
+
_createDriverDependencies(commonDeps) { }
|
12
|
+
_createDriver(deviceCookie, deps, configs) {}
|
12
13
|
}
|
13
14
|
|
14
15
|
module.exports = RuntimeDeviceFactory;
|
@@ -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/errors/DetoxError.js
CHANGED
@@ -8,6 +8,10 @@ class DetoxError extends Error {
|
|
8
8
|
this.name = 'DetoxError';
|
9
9
|
}
|
10
10
|
|
11
|
+
format() {
|
12
|
+
return this.message;
|
13
|
+
}
|
14
|
+
|
11
15
|
static get reportIssue() {
|
12
16
|
return 'Please report this issue on our GitHub tracker:\nhttps://github.com/wix/Detox/issues';
|
13
17
|
}
|
@@ -32,7 +36,7 @@ class DetoxError extends Error {
|
|
32
36
|
*/
|
33
37
|
static format(err, inspectOptions = { depth: 1 }) {
|
34
38
|
if (err instanceof DetoxError) {
|
35
|
-
return err.
|
39
|
+
return err.format();
|
36
40
|
}
|
37
41
|
|
38
42
|
if (_.isError(err) && /^Command failed:/.test(err.message)) {
|