detox 20.0.1-breaking.new-global-lifecycle.0 → 20.0.1
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.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar → 20.0.1/detox-20.0.1-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar → 20.0.1/detox-20.0.1-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom → 20.0.1/detox-20.0.1.pom} +1 -7
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.1.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1/detox-20.0.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/README.md +1 -1
- package/android/build.gradle +12 -7
- package/android/detox/build.gradle +13 -9
- package/android/detox/proguard-rules-app.pro +6 -0
- package/android/detox/proguard-rules.pro +3 -0
- package/android/detox/publishing.gradle +27 -27
- package/android/detox/src/full/java/com/wix/detox/DetoxCrashHandler.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/LaunchArgs.java +9 -0
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeExtension.kt +15 -2
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeIdlingResources.kt +43 -38
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/IdlingResourceDescription.kt +19 -13
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +33 -30
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt +7 -27
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/IdleInterrogationStrategy.kt +1 -11
- package/android/detox/src/main/java/com/wix/detox/common/TextFileReader.kt +1 -1
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/DetoxMultiTapSpec.kt +4 -3
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategySpec.kt +3 -11
- package/index.d.ts +198 -57
- package/internals.d.ts +219 -45
- package/local-cli/build.js +2 -2
- package/local-cli/build.test.js +14 -14
- package/local-cli/cli.js +8 -6
- package/local-cli/init.js +61 -21
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/templates/jest.js +13 -10
- package/local-cli/test.js +14 -8
- package/local-cli/test.test.js +148 -61
- package/local-cli/testCommand/TestRunnerCommand.js +78 -72
- 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/local-cli/utils/jestInternals.js +4 -1
- package/package.json +23 -16
- package/runners/deprecation.js +42 -44
- package/runners/jest/globalSetup.js +1 -1
- package/runners/jest/globalTeardown.js +1 -1
- 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 +33 -2
- package/runners/jest/testEnvironment/index.js +119 -69
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +94 -51
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +14 -16
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +2 -6
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
- package/src/DetoxWorker.js +105 -62
- package/src/android/core/NativeElement.js +56 -20
- package/src/android/core/NativeExpect.js +28 -9
- package/src/android/interactions/native.js +25 -18
- package/src/artifacts/ArtifactsManager.js +14 -47
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
- package/src/artifacts/templates/artifact/Artifact.js +1 -1
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
- package/src/artifacts/timeline/TimelineContextTypes.js +7 -0
- package/src/artifacts/utils/temporaryPath.js +18 -7
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +8 -17
- package/src/client/Client.js +19 -2
- package/src/client/actions/formatters/sync-resources/NetworkFormatter.js +1 -1
- package/src/configuration/collectCliConfig.js +1 -12
- package/src/configuration/composeAppsConfig.js +4 -0
- package/src/configuration/composeDeviceConfig.js +1 -1
- package/src/configuration/composeLoggerConfig.js +19 -10
- package/src/configuration/composeRunnerConfig.js +62 -9
- package/src/configuration/index.js +14 -9
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/devices/allocation/DeviceAllocator.js +3 -2
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +5 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +4 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -2
- package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +1 -1
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +3 -3
- package/src/devices/common/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
- package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
- package/src/devices/common/drivers/android/tools/MonitoredInstrumentation.js +1 -1
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +29 -3
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +19 -12
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +10 -2
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +1 -1
- package/src/errors/DetoxConfigErrorComposer.js +17 -2
- package/src/ios/expectTwo.js +153 -67
- package/src/ipc/IPCClient.js +12 -12
- package/src/ipc/IPCServer.js +29 -18
- package/src/ipc/{state.js → SessionState.js} +26 -40
- package/src/logger/DetoxLogger.js +261 -157
- package/src/logger/index.js +5 -0
- package/src/logger/utils/BunyanLogger.js +76 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +36 -0
- package/src/logger/utils/DetoxLogFinalizer.js +140 -0
- package/src/logger/utils/MessageStack.js +24 -0
- package/src/logger/utils/ThreadDispatcher.js +61 -0
- package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +5 -4
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/{utils → logger/utils}/streamUtils.js +51 -17
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxContext.js +78 -65
- package/src/realms/DetoxInternalsFacade.js +8 -12
- package/src/realms/DetoxPrimaryContext.js +104 -72
- package/src/realms/DetoxSecondaryContext.js +29 -32
- package/src/server/DetoxConnection.js +18 -23
- package/src/server/DetoxServer.js +7 -10
- package/src/server/DetoxSession.js +6 -6
- package/src/server/DetoxSessionManager.js +1 -1
- package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
- package/src/symbols.js +16 -22
- package/src/utils/Timer.js +55 -38
- package/src/utils/argparse.js +11 -0
- package/src/utils/childProcess/exec.js +1 -1
- package/src/utils/childProcess/spawn.js +1 -1
- package/src/utils/errorUtils.js +24 -3
- package/src/utils/invocationTraceDescriptions.js +43 -0
- package/src/utils/logger.js +1 -1
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategy.kt +0 -84
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategySpec.kt +0 -115
- package/runners/jest/deprecation.js +0 -25
- package/src/configuration/utils/warnings.js +0 -12
- package/src/logger/DetoxTraceEventBuilder.js +0 -21
- package/src/logger/DetoxTracer.js +0 -133
- package/src/logger/TraceThreadDispatcher.js +0 -52
- package/src/utils/ChromeTracingExporter.js +0 -54
- package/src/utils/trace.js +0 -19
@@ -105,18 +105,23 @@ async function composeDetoxConfig({
|
|
105
105
|
});
|
106
106
|
|
107
107
|
const result = {
|
108
|
-
appsConfig,
|
109
|
-
artifactsConfig,
|
110
|
-
behaviorConfig,
|
111
|
-
cliConfig,
|
112
108
|
configurationName,
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
109
|
+
|
110
|
+
apps: appsConfig,
|
111
|
+
artifacts: artifactsConfig,
|
112
|
+
behavior: behaviorConfig,
|
113
|
+
cli: cliConfig,
|
114
|
+
device: deviceConfig,
|
115
|
+
logger: loggerConfig,
|
116
|
+
testRunner: runnerConfig,
|
117
|
+
session: sessionConfig,
|
118
118
|
};
|
119
119
|
|
120
|
+
Object.defineProperty(result, 'errorComposer', {
|
121
|
+
enumerable: false,
|
122
|
+
value: errorComposer,
|
123
|
+
});
|
124
|
+
|
120
125
|
return result;
|
121
126
|
}
|
122
127
|
|
@@ -6,7 +6,7 @@ const fs = require('fs-extra');
|
|
6
6
|
const _ = require('lodash');
|
7
7
|
const resolveFrom = require('resolve-from');
|
8
8
|
|
9
|
-
const log = require('../utils/logger').child({
|
9
|
+
const log = require('../utils/logger').child({ cat: 'config' });
|
10
10
|
|
11
11
|
async function locateExternalConfig(cwd) {
|
12
12
|
return findUp([
|
@@ -1,5 +1,6 @@
|
|
1
1
|
// @ts-nocheck
|
2
|
-
const
|
2
|
+
const log = require('../../utils/logger').child({ cat: 'device' });
|
3
|
+
const traceMethods = require('../../utils/traceMethods');
|
3
4
|
|
4
5
|
class DeviceAllocator {
|
5
6
|
/**
|
@@ -7,7 +8,7 @@ class DeviceAllocator {
|
|
7
8
|
*/
|
8
9
|
constructor(allocationDriver) {
|
9
10
|
this._driver = allocationDriver;
|
10
|
-
traceMethods(
|
11
|
+
traceMethods(log, this, ['allocate', 'free']);
|
11
12
|
}
|
12
13
|
|
13
14
|
/**
|
@@ -2,7 +2,7 @@ const _ = require('lodash');
|
|
2
2
|
|
3
3
|
const DetoxRuntimeError = require('../../../../../errors/DetoxRuntimeError');
|
4
4
|
const environment = require('../../../../../utils/environment');
|
5
|
-
const logger = require('../../../../../utils/logger').child({
|
5
|
+
const logger = require('../../../../../utils/logger').child({ cat: 'device' });
|
6
6
|
|
7
7
|
const REQUIRED_EMULATOR_MAJOR = 29;
|
8
8
|
|
@@ -12,11 +12,11 @@ class AVDValidator {
|
|
12
12
|
this._emulatorVersionResolver = emulatorVersionResolver;
|
13
13
|
}
|
14
14
|
|
15
|
-
async validate(avdName) {
|
15
|
+
async validate(avdName, isHeadless) {
|
16
16
|
const avds = await this._avdsResolver.resolve(avdName);
|
17
17
|
this._assertAVDs(avds);
|
18
18
|
await this._assertAVDMatch(avds, avdName);
|
19
|
-
await this._validateEmulatorVer();
|
19
|
+
await this._validateEmulatorVer(isHeadless);
|
20
20
|
}
|
21
21
|
|
22
22
|
_assertAVDs(avds) {
|
@@ -37,8 +37,8 @@ class AVDValidator {
|
|
37
37
|
}
|
38
38
|
}
|
39
39
|
|
40
|
-
async _validateEmulatorVer() {
|
41
|
-
const emulatorVersion = await this._emulatorVersionResolver.resolve();
|
40
|
+
async _validateEmulatorVer(isHeadless) {
|
41
|
+
const emulatorVersion = await this._emulatorVersionResolver.resolve(isHeadless);
|
42
42
|
if (!emulatorVersion) {
|
43
43
|
logger.warn({ event: 'AVD_VALIDATION' }, 'Emulator version detection failed (See previous logs)');
|
44
44
|
return;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const _ = require('lodash');
|
3
3
|
|
4
|
-
const
|
4
|
+
const log = require('../../../../../utils/logger').child({ cat: 'device' });
|
5
|
+
const traceMethods = require('../../../../../utils/traceMethods');
|
5
6
|
const AndroidEmulatorCookie = require('../../../../cookies/AndroidEmulatorCookie');
|
6
7
|
const AllocationDriverBase = require('../../AllocationDriverBase');
|
7
8
|
|
@@ -23,7 +24,7 @@ class EmulatorAllocDriver extends AllocationDriverBase {
|
|
23
24
|
this._emulatorLauncher = emulatorLauncher;
|
24
25
|
this._allocationHelper = allocationHelper;
|
25
26
|
|
26
|
-
traceMethods(
|
27
|
+
traceMethods(log, this, ['_launchEmulator']);
|
27
28
|
}
|
28
29
|
|
29
30
|
/**
|
@@ -33,7 +34,7 @@ class EmulatorAllocDriver extends AllocationDriverBase {
|
|
33
34
|
async allocate(deviceConfig) {
|
34
35
|
const avdName = deviceConfig.device.avdName;
|
35
36
|
|
36
|
-
await this._avdValidator.validate(avdName);
|
37
|
+
await this._avdValidator.validate(avdName, deviceConfig.headless);
|
37
38
|
await this._fixAvdConfigIniSkinNameIfNeeded(avdName, deviceConfig.headless);
|
38
39
|
|
39
40
|
const allocResult = await this._allocationHelper.allocateDevice(avdName);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const logger = require('../../../../../utils/logger').child({
|
1
|
+
const logger = require('../../../../../utils/logger').child({ cat: 'device' });
|
2
2
|
const DeviceAllocationHelper = require('../../../../common/drivers/DeviceAllocationHelper');
|
3
3
|
|
4
4
|
const DetoxEmulatorsPortRange = {
|
@@ -1,7 +1,8 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const { DetoxRuntimeError } = require('../../../../../errors');
|
3
|
+
const log = require('../../../../../utils/logger').child({ cat: 'device' });
|
3
4
|
const retry = require('../../../../../utils/retry');
|
4
|
-
const
|
5
|
+
const traceMethods = require('../../../../../utils/traceMethods');
|
5
6
|
const DeviceLauncher = require('../../../../common/drivers/DeviceLauncher');
|
6
7
|
const { LaunchCommand } = require('../../../../common/drivers/android/emulator/exec/EmulatorExec');
|
7
8
|
|
@@ -14,7 +15,7 @@ class EmulatorLauncher extends DeviceLauncher {
|
|
14
15
|
super(eventEmitter);
|
15
16
|
this._adb = adb;
|
16
17
|
this._emulatorExec = emulatorExec;
|
17
|
-
traceMethods(
|
18
|
+
traceMethods(log, this, ['_awaitEmulatorBoot']);
|
18
19
|
}
|
19
20
|
|
20
21
|
/**
|
@@ -1,8 +1,6 @@
|
|
1
|
-
const log = require('../../../../../utils/logger').child({
|
1
|
+
const log = require('../../../../../utils/logger').child({ cat: 'device' });
|
2
2
|
const { QueryVersionCommand } = require('../../../../common/drivers/android/emulator/exec/EmulatorExec');
|
3
3
|
|
4
|
-
const EMU_BIN_VERSION_DETECT_EV = 'EMU_BIN_VERSION_DETECT';
|
5
|
-
|
6
4
|
class EmulatorVersionResolver {
|
7
5
|
constructor(emulatorExec) {
|
8
6
|
this._emulatorExec = emulatorExec;
|
@@ -21,18 +19,18 @@ class EmulatorVersionResolver {
|
|
21
19
|
try {
|
22
20
|
rawOutput = await this._emulatorExec.exec(new QueryVersionCommand({ headless })) || '';
|
23
21
|
} catch (error) {
|
24
|
-
log.error({
|
22
|
+
log.error({ success: false, error }, 'Could not detect emulator binary version', error);
|
25
23
|
return null;
|
26
24
|
}
|
27
25
|
|
28
26
|
const matches = rawOutput.match(/Android emulator version ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]*)/);
|
29
27
|
if (!matches) {
|
30
|
-
log.warn({
|
28
|
+
log.warn({ success: false }, 'Could not detect emulator binary version, got:', rawOutput);
|
31
29
|
return null;
|
32
30
|
}
|
33
31
|
|
34
32
|
const version = this._parseVersionString(matches[1]);
|
35
|
-
log.debug({
|
33
|
+
log.debug({ success: true }, 'Detected emulator binary version', version);
|
36
34
|
return version;
|
37
35
|
}
|
38
36
|
|
@@ -3,7 +3,7 @@ const fs = require('fs');
|
|
3
3
|
const _ = require('lodash');
|
4
4
|
const { Tail } = require('tail');
|
5
5
|
|
6
|
-
const unitLogger = require('../../../../../utils/logger').child({
|
6
|
+
const unitLogger = require('../../../../../utils/logger').child({ cat: 'device' });
|
7
7
|
|
8
8
|
function launchEmulatorProcess(emulatorName, emulatorExec, emulatorLaunchCommand) {
|
9
9
|
let childProcessOutput;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// @ts-nocheck
|
2
|
-
const logger = require('../../../../../utils/logger').child({
|
2
|
+
const logger = require('../../../../../utils/logger').child({ cat: 'device' });
|
3
3
|
const DeviceAllocationHelper = require('../../../../common/drivers/DeviceAllocationHelper');
|
4
4
|
|
5
5
|
const { ALLOCATE_DEVICE_LOG_EVT } = DeviceAllocationHelper;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
const
|
1
|
+
const internals = () => require('../../../../../../../internals');
|
2
2
|
|
3
3
|
class GenyInstanceNaming {
|
4
4
|
generateName() {
|
5
|
-
const {
|
6
|
-
return `Detox.${id}.${
|
5
|
+
const { session, worker } = internals();
|
6
|
+
return `Detox.${session.id}.${worker.id}`;
|
7
7
|
}
|
8
8
|
|
9
9
|
isFamilial(name) {
|
@@ -5,7 +5,7 @@ const path = require('path');
|
|
5
5
|
const fs = require('fs-extra');
|
6
6
|
const Telnet = require('telnet-client');
|
7
7
|
|
8
|
-
const log = require('../../../../../utils/logger').child({
|
8
|
+
const log = require('../../../../../utils/logger').child({ cat: 'device' });
|
9
9
|
|
10
10
|
class EmulatorTelnet {
|
11
11
|
constructor() {
|
@@ -77,7 +77,7 @@ class MonitoredInstrumentation {
|
|
77
77
|
'while it was waiting for "ready" message (over WebSocket) ' +
|
78
78
|
'from the instrumentation process.',
|
79
79
|
debugInfo: this.instrumentationStackTrace
|
80
|
-
? `Native stacktrace dump
|
80
|
+
? `Native stacktrace dump:\n${this.instrumentationStackTrace}`
|
81
81
|
: '',
|
82
82
|
});
|
83
83
|
}
|
@@ -7,7 +7,7 @@ const DetoxRuntimeError = require('../../../../../errors/DetoxRuntimeError');
|
|
7
7
|
const { joinArgs } = require('../../../../../utils/argparse');
|
8
8
|
const childProcess = require('../../../../../utils/childProcess');
|
9
9
|
const environment = require('../../../../../utils/environment');
|
10
|
-
const log = require('../../../../../utils/logger').child({
|
10
|
+
const log = require('../../../../../utils/logger').child({ cat: 'device' });
|
11
11
|
const { quote } = require('../../../../../utils/shellQuote');
|
12
12
|
|
13
13
|
class AppleSimUtils {
|
@@ -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
|
|
@@ -157,6 +157,30 @@ class AppleSimUtils {
|
|
157
157
|
}
|
158
158
|
|
159
159
|
async sendToHome(udid) {
|
160
|
+
if (await this._isSpringBoardInaccessible(udid)) {
|
161
|
+
// SpringBoard is not directly accessible by Simctl on iOS 16.0 and above, therefore we launch and terminate the
|
162
|
+
// Settings app instead. This sends the currently open app to the background and brings the home screen to the
|
163
|
+
// foreground.
|
164
|
+
await this._launchAndTerminateSettings(udid);
|
165
|
+
return;
|
166
|
+
}
|
167
|
+
|
168
|
+
await this._launchSpringBoard(udid);
|
169
|
+
}
|
170
|
+
|
171
|
+
async _isSpringBoardInaccessible(udid) {
|
172
|
+
const device = await this._findDeviceByUDID(udid);
|
173
|
+
const majorIOSVersion = parseInt(device.os.version.split('.')[0]);
|
174
|
+
return majorIOSVersion >= 16;
|
175
|
+
}
|
176
|
+
|
177
|
+
async _launchAndTerminateSettings(udid) {
|
178
|
+
const bundleId = 'com.apple.Preferences';
|
179
|
+
await this._execSimctl({ cmd: `launch ${udid} ${bundleId}`, retries: 10 });
|
180
|
+
await this._execSimctl({ cmd: `terminate ${udid} ${bundleId}`, retries: 10 });
|
181
|
+
}
|
182
|
+
|
183
|
+
async _launchSpringBoard(udid) {
|
160
184
|
await this._execSimctl({ cmd: `launch ${udid} com.apple.springboard`, retries: 10 });
|
161
185
|
}
|
162
186
|
|
@@ -271,7 +295,9 @@ class AppleSimUtils {
|
|
271
295
|
// ```
|
272
296
|
// This workaround is done to ignore the error above, as we do not care if the app was running before, we just
|
273
297
|
// want to make sure it isn't now.
|
274
|
-
if (err.code === 3 &&
|
298
|
+
if (err.code === 3 &&
|
299
|
+
(err.stderr.includes(`the app is not currently running`) ||
|
300
|
+
err.stderr.includes(`The operation couldn’t be completed. found nothing to terminate`))) {
|
275
301
|
return;
|
276
302
|
}
|
277
303
|
|
@@ -1,6 +1,4 @@
|
|
1
|
-
const
|
2
|
-
|
3
|
-
const logger = require('../../utils/logger').child({ __filename });
|
1
|
+
const logger = require('../../utils/logger').child({ cat: 'device' });
|
4
2
|
|
5
3
|
const cleanupLogData = {
|
6
4
|
event: 'GENYCLOUD_TEARDOWN',
|
@@ -12,16 +10,16 @@ class GenyGlobalLifecycleHandler {
|
|
12
10
|
this._instanceLifecycleService = instanceLifecycleService;
|
13
11
|
}
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
13
|
+
// TODO: remove this ignore as soon as DetoxPrimaryContext is covered with tests
|
14
|
+
/* istanbul ignore next */
|
15
|
+
async globalInit() {}
|
16
|
+
|
17
|
+
emergencyCleanup() {
|
18
|
+
const { rawDevices } = this._deviceCleanupRegistry.readRegisteredDevicesUNSAFE();
|
19
|
+
const instanceHandles = rawDevicesToInstanceHandles(rawDevices);
|
20
|
+
if (instanceHandles.length) {
|
21
|
+
reportGlobalCleanupSummary(instanceHandles);
|
22
|
+
}
|
25
23
|
}
|
26
24
|
|
27
25
|
async globalCleanup() {
|
@@ -34,7 +32,7 @@ class GenyGlobalLifecycleHandler {
|
|
34
32
|
}
|
35
33
|
|
36
34
|
async function doSafeCleanup(instanceLifecycleService, instanceHandles) {
|
37
|
-
logger.info(cleanupLogData, 'Initiating Genymotion
|
35
|
+
logger.info(cleanupLogData, 'Initiating Genymotion SaaS instances teardown...');
|
38
36
|
|
39
37
|
const deletionLeaks = [];
|
40
38
|
const killPromises = instanceHandles.map((instanceHandle) =>
|
@@ -47,7 +45,7 @@ async function doSafeCleanup(instanceLifecycleService, instanceHandles) {
|
|
47
45
|
|
48
46
|
function reportGlobalCleanupSummary(deletionLeaks) {
|
49
47
|
if (deletionLeaks.length) {
|
50
|
-
logger.warn(cleanupLogData, 'WARNING! Detected a Genymotion
|
48
|
+
logger.warn(cleanupLogData, 'WARNING! Detected a Genymotion SaaS instance leakage, for the following instances:');
|
51
49
|
|
52
50
|
deletionLeaks.forEach(({ uuid, name, error }) => {
|
53
51
|
logger.warn(cleanupLogData, [
|
@@ -1,6 +1,7 @@
|
|
1
1
|
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
2
2
|
const debug = require('../../utils/debug'); // debug utils, leave here even if unused
|
3
|
-
const
|
3
|
+
const log = require('../../utils/logger').child({ cat: 'device' });
|
4
|
+
const traceMethods = require('../../utils/traceMethods');
|
4
5
|
const wrapWithStackTraceCutter = require('../../utils/wrapWithStackTraceCutter');
|
5
6
|
|
6
7
|
const LaunchArgsEditor = require('./utils/LaunchArgsEditor');
|
@@ -20,6 +21,7 @@ class RuntimeDevice {
|
|
20
21
|
'disableSynchronization',
|
21
22
|
'enableSynchronization',
|
22
23
|
'installApp',
|
24
|
+
'installUtilBinaries',
|
23
25
|
'launchApp',
|
24
26
|
'matchFace',
|
25
27
|
'matchFinger',
|
@@ -48,7 +50,7 @@ class RuntimeDevice {
|
|
48
50
|
'unreverseTcpPort',
|
49
51
|
];
|
50
52
|
|
51
|
-
traceMethods(
|
53
|
+
traceMethods(log, this, methodNames);
|
52
54
|
wrapWithStackTraceCutter(this, methodNames);
|
53
55
|
|
54
56
|
this._appsConfig = appsConfig;
|
@@ -234,29 +236,34 @@ class RuntimeDevice {
|
|
234
236
|
}
|
235
237
|
|
236
238
|
async installApp(binaryPath, testBinaryPath) {
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
239
|
+
const currentApp = binaryPath ? { binaryPath, testBinaryPath } : this._getCurrentApp();
|
240
|
+
await this.deviceDriver.installApp(currentApp.binaryPath, currentApp.testBinaryPath);
|
241
|
+
|
242
|
+
// This abstraction leaks because our drivers themselves leak,
|
243
|
+
// so don't blame me - DeviceBaseDriver itself has `reverseTcpPort`,
|
244
|
+
// setting a vicious downward spiral. I can't refactor everything
|
245
|
+
// in a single pull request, so let's bear with it for now.
|
246
|
+
if (Array.isArray(currentApp.reversePorts)) {
|
247
|
+
for (const port of currentApp.reversePorts) {
|
248
|
+
await this.reverseTcpPort(port);
|
249
|
+
}
|
250
|
+
}
|
241
251
|
}
|
242
252
|
|
243
253
|
async uninstallApp(bundleId) {
|
244
254
|
const _bundleId = bundleId || this._bundleId;
|
245
|
-
await
|
246
|
-
this.deviceDriver.uninstallApp(_bundleId));
|
255
|
+
await this.deviceDriver.uninstallApp(_bundleId);
|
247
256
|
}
|
248
257
|
|
249
258
|
async installUtilBinaries() {
|
250
259
|
const paths = this._deviceConfig.utilBinaryPaths;
|
251
260
|
if (paths) {
|
252
|
-
await
|
253
|
-
this.deviceDriver.installUtilBinaries(paths));
|
261
|
+
await this.deviceDriver.installUtilBinaries(paths);
|
254
262
|
}
|
255
263
|
}
|
256
264
|
|
257
265
|
async reloadReactNative() {
|
258
|
-
await
|
259
|
-
this.deviceDriver.reloadReactNative());
|
266
|
+
await this.deviceDriver.reloadReactNative();
|
260
267
|
}
|
261
268
|
|
262
269
|
async openURL(params) {
|
@@ -18,7 +18,7 @@ const sleep = require('../../../../utils/sleep');
|
|
18
18
|
const apkUtils = require('../../../common/drivers/android/tools/apk');
|
19
19
|
const DeviceDriverBase = require('../DeviceDriverBase');
|
20
20
|
|
21
|
-
const log = logger.child({
|
21
|
+
const log = logger.child({ cat: 'device' });
|
22
22
|
|
23
23
|
/**
|
24
24
|
* @typedef AndroidDriverProps
|
@@ -148,7 +148,15 @@ class AndroidDriver extends DeviceDriverBase {
|
|
148
148
|
|
149
149
|
async waitUntilReady() {
|
150
150
|
try {
|
151
|
-
await Promise.race([
|
151
|
+
await Promise.race([
|
152
|
+
super.waitUntilReady(),
|
153
|
+
this.instrumentation.waitForCrash()
|
154
|
+
]);
|
155
|
+
} catch (e) {
|
156
|
+
log.warn({ error: e }, 'An error occurred while waiting for the app to become ready. Waiting for disconnection...');
|
157
|
+
await this.client.waitUntilDisconnected();
|
158
|
+
log.warn('The app disconnected.');
|
159
|
+
throw e;
|
152
160
|
} finally {
|
153
161
|
this.instrumentation.abortWaitForCrash();
|
154
162
|
}
|
@@ -7,7 +7,7 @@ const _ = require('lodash');
|
|
7
7
|
const temporaryPath = require('../../../../artifacts/utils/temporaryPath');
|
8
8
|
const DetoxRuntimeError = require('../../../../errors/DetoxRuntimeError');
|
9
9
|
const getAbsoluteBinaryPath = require('../../../../utils/getAbsoluteBinaryPath');
|
10
|
-
const log = require('../../../../utils/logger').child({
|
10
|
+
const log = require('../../../../utils/logger').child({ cat: 'device' });
|
11
11
|
const pressAnyKey = require('../../../../utils/pressAnyKey');
|
12
12
|
|
13
13
|
const IosDriver = require('./IosDriver');
|
@@ -507,6 +507,14 @@ Examine your Detox config${this._atPath()}`,
|
|
507
507
|
});
|
508
508
|
}
|
509
509
|
|
510
|
+
unsupportedReversePorts(appPath) {
|
511
|
+
return new DetoxConfigError({
|
512
|
+
message: `Non-Android app configs cannot have "reversePorts" property:`,
|
513
|
+
debugInfo: this._focusOnAppConfig(appPath),
|
514
|
+
inspectOptions: { depth: 4 },
|
515
|
+
});
|
516
|
+
}
|
517
|
+
|
510
518
|
missingAppBinaryPath(appPath) {
|
511
519
|
return new DetoxConfigError({
|
512
520
|
message: `Missing "binaryPath" property in the app config.\nExpected a string:`,
|
@@ -656,12 +664,19 @@ Examine your Detox config${this._atPath()}`,
|
|
656
664
|
}
|
657
665
|
|
658
666
|
invalidTestRunnerProperty(isGlobal) {
|
667
|
+
const testRunner = _.get(
|
668
|
+
isGlobal
|
669
|
+
? this.contents
|
670
|
+
: this._getSelectedConfiguration(),
|
671
|
+
['testRunner']
|
672
|
+
);
|
673
|
+
|
659
674
|
return new DetoxConfigError({
|
660
|
-
message: `testRunner should be an object, not a
|
675
|
+
message: `testRunner should be an object, not a ${typeof testRunner}`,
|
661
676
|
hint: `Check that in your Detox config${this._atPath()}`,
|
662
677
|
inspectOptions: { depth: isGlobal ? 0 : 3 },
|
663
678
|
debugInfo: isGlobal ? {
|
664
|
-
testRunner
|
679
|
+
testRunner,
|
665
680
|
...this.contents,
|
666
681
|
} : {
|
667
682
|
...this._focusOnConfiguration(c => _.pick(c, ['testRunner'])),
|