detox 19.13.0 → 20.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{19.13.0/detox-19.13.0-javadoc.jar → 20.0.0/detox-20.0.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.13.0/detox-19.13.0-sources.jar → 20.0.0/detox-20.0.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.13.0/detox-19.13.0.pom → 20.0.0/detox-20.0.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.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/README.md +1 -1
- package/android/detox/src/full/java/com/wix/detox/Detox.java +2 -59
- package/android/detox/src/full/java/com/wix/detox/NotificationDataParser.kt +3 -3
- package/index.d.ts +354 -191
- package/index.js +1 -0
- package/internals.d.ts +298 -0
- package/internals.js +4 -0
- package/local-cli/build-framework-cache.js +2 -2
- package/local-cli/build.js +7 -8
- package/local-cli/build.test.js +46 -40
- package/local-cli/clean-framework-cache.js +3 -3
- package/local-cli/cli.js +8 -7
- package/local-cli/init.js +73 -68
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/templates/jest.js +14 -36
- package/local-cli/test.js +24 -282
- package/local-cli/test.test.js +394 -648
- package/local-cli/testCommand/TestRunnerCommand.js +163 -0
- package/local-cli/{utils/testCommandArgs.js → testCommand/builder.js} +10 -36
- package/local-cli/testCommand/middlewares.js +66 -0
- package/local-cli/{utils → testCommand}/warnings.js +0 -13
- package/local-cli/utils/jestInternals.js +13 -2
- package/local-cli/utils/yargsUtils.js +67 -0
- package/package.json +32 -19
- package/runners/deprecation.js +45 -0
- package/runners/jest/JestCircusEnvironment.js +3 -38
- package/runners/jest/adapter.d.ts +4 -10
- package/runners/jest/adapter.js +3 -6
- package/runners/jest/assignReporter.d.ts +4 -1
- package/runners/jest/assignReporter.js +3 -6
- package/runners/jest/globalSetup.js +1 -0
- package/runners/jest/globalTeardown.js +1 -0
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +16 -0
- package/runners/jest/index.test.js +13 -0
- package/runners/jest/reporter.js +1 -0
- package/runners/jest/reporters/DetoxReporter.js +36 -0
- package/runners/jest/specReporter.d.ts +4 -9
- package/runners/jest/specReporter.js +3 -10
- package/runners/jest/streamlineReporter.js +3 -22
- package/runners/jest/testEnvironment/index.js +205 -0
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +166 -0
- package/runners/{jest-circus → jest/testEnvironment}/listeners/DetoxInitErrorListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +27 -0
- package/runners/jest/{SpecReporterImpl.js → testEnvironment/listeners/SpecReporter.js} +61 -9
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +30 -0
- package/runners/jest/testEnvironment/listeners/index.js +13 -0
- package/runners/{jest-circus → jest/testEnvironment}/utils/assertExistingContext.js +2 -2
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +70 -0
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +22 -0
- package/runners/jest/{utils → testEnvironment/utils}/getFullTestName.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/hasTimedOut.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/index.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/stdout.js +0 -0
- package/runners/jest-circus/environment/index.js +6 -0
- package/runners/jest-circus/index.js +1 -10
- package/runners/jest-circus/reporter.js +1 -0
- package/runners/migration.js +37 -0
- package/runners/mocha/DetoxMochaAdapter.js +3 -35
- package/runners/mocha/adapter.d.ts +4 -7
- package/runners/mocha/adapter.js +3 -5
- package/src/DetoxWorker.js +327 -0
- package/src/android/interactions/native.js +2 -1
- package/src/artifacts/ArtifactsManager.js +51 -35
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- package/src/artifacts/providers/index.js +0 -4
- 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/utils/buildDefaultArtifactsRootDirpath.js +2 -4
- package/src/artifacts/utils/temporaryPath.js +18 -5
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +8 -17
- package/src/client/Client.js +1 -1
- package/src/client/actions/actions.js +2 -2
- package/src/configuration/collectCliConfig.js +3 -16
- package/src/configuration/composeAppsConfig.js +12 -66
- package/src/configuration/composeArtifactsConfig.js +6 -32
- package/src/configuration/composeBehaviorConfig.js +3 -13
- package/src/configuration/composeDeviceConfig.js +38 -63
- package/src/configuration/composeLoggerConfig.js +59 -0
- package/src/configuration/composeRunnerConfig.js +127 -14
- package/src/configuration/composeSessionConfig.js +1 -3
- package/src/configuration/index.js +36 -30
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/configuration/utils/deviceAppTypes.js +0 -1
- package/src/devices/allocation/DeviceAllocator.js +4 -2
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +5 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -5
- 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/allocation/drivers/ios/SimulatorAllocDriver.js +1 -1
- package/src/devices/allocation/drivers/ios/SimulatorLauncher.js +3 -3
- package/src/devices/allocation/factories/index.js +0 -1
- package/src/devices/common/drivers/DeviceLauncher.js +2 -2
- package/src/devices/common/drivers/android/emulator/exec/EmulatorExec.js +1 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +4 -9
- 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/ios/tools/AppleSimUtils.js +35 -10
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +85 -86
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +3 -3
- package/src/devices/runtime/drivers/index.js +0 -1
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +4 -3
- package/src/devices/runtime/factories/ios.js +1 -8
- package/src/devices/runtime/utils/LaunchArgsEditor.js +4 -59
- package/src/devices/runtime/utils/Storage.js +4 -0
- package/src/environmentFactory.js +0 -8
- package/src/errors/DetoxConfigErrorComposer.js +92 -30
- package/src/errors/DetoxError.js +4 -0
- package/src/errors/DetoxRuntimeError.js +5 -5
- package/src/errors/index.js +2 -0
- package/src/ios/expectTwo.js +2 -1
- package/src/ipc/IPCClient.js +117 -0
- package/src/ipc/IPCServer.js +98 -0
- package/src/ipc/SessionState.js +62 -0
- package/src/logger/DetoxLogger.js +348 -0
- 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/{utils → logger/utils}/customConsoleLogger.js +5 -4
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/logger/utils/streamUtils.js +248 -0
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxConstants.js +13 -0
- package/src/realms/DetoxContext.js +183 -0
- package/src/realms/DetoxInternalsFacade.js +31 -0
- package/src/realms/DetoxPrimaryContext.js +261 -0
- package/src/realms/DetoxSecondaryContext.js +91 -0
- package/src/realms/index.js +10 -0
- package/src/realms/primary.js +3 -0
- package/src/realms/secondary.js +3 -0
- 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 +50 -0
- package/src/utils/Timer.js +58 -33
- package/src/utils/argparse.js +11 -0
- package/src/utils/childProcess/exec.js +1 -1
- package/src/utils/childProcess/spawn.js +1 -1
- package/{local-cli/utils/misc.js → src/utils/envUtils.js} +0 -9
- package/src/utils/errorUtils.js +20 -0
- package/src/utils/logger.js +2 -162
- package/src/utils/shellUtils.js +18 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar +0 -0
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha512 +0 -1
- package/local-cli/templates/mocha.js +0 -32
- package/local-cli/utils/splitArgv.js +0 -107
- package/runners/integration.js +0 -16
- package/runners/jest/DetoxAdapterCircus.js +0 -60
- package/runners/jest/DetoxAdapterImpl.js +0 -81
- package/runners/jest/DetoxAdapterJasmine.js +0 -67
- package/runners/jest/DetoxStreamlineJestReporter.js +0 -98
- package/runners/jest/FailingTestsReporter.js +0 -16
- package/runners/jest/SpecReporterCircus.js +0 -51
- package/runners/jest/SpecReporterJasmine.js +0 -39
- package/runners/jest/WorkerAssignReporterCircus.js +0 -17
- package/runners/jest/WorkerAssignReporterImpl.js +0 -21
- package/runners/jest/WorkerAssignReporterJasmine.js +0 -15
- package/runners/jest/runnerInfo.js +0 -9
- package/runners/jest-circus/environment.js +0 -206
- package/runners/jest-circus/listeners/DetoxCoreListener.js +0 -113
- package/runners/jest-circus/utils/assertJestCircus26.js +0 -39
- package/runners/jest-circus/utils/wrapErrorWithNoopLifecycle.js +0 -14
- package/src/Detox.js +0 -317
- package/src/DetoxConstants.js +0 -13
- package/src/DetoxExportWrapper.js +0 -140
- package/src/artifacts/timeline/TimelineArtifactPlugin.js +0 -92
- package/src/configuration/utils/warnings.js +0 -12
- package/src/devices/allocation/drivers/NoneAllocDriver.js +0 -10
- package/src/devices/allocation/factories/none.js +0 -11
- package/src/index.js +0 -6
- package/src/utils/ChromeTracingExporter.js +0 -54
- package/src/utils/MissingDetox.js +0 -78
- package/src/utils/fakeTimestampsProvider.js +0 -9
- package/src/utils/getWorkerId.js +0 -5
- package/src/utils/lastFailedTests.js +0 -38
- package/src/utils/sh.js +0 -18
- package/src/utils/trace.js +0 -96
@@ -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');
|
@@ -14,12 +15,13 @@ class RuntimeDevice {
|
|
14
15
|
sessionConfig,
|
15
16
|
runtimeErrorComposer,
|
16
17
|
}, deviceDriver) {
|
17
|
-
|
18
|
+
const methodNames = [
|
18
19
|
'captureViewHierarchy',
|
19
20
|
'clearKeychain',
|
20
21
|
'disableSynchronization',
|
21
22
|
'enableSynchronization',
|
22
23
|
'installApp',
|
24
|
+
'installUtilBinaries',
|
23
25
|
'launchApp',
|
24
26
|
'matchFace',
|
25
27
|
'matchFinger',
|
@@ -46,7 +48,10 @@ class RuntimeDevice {
|
|
46
48
|
'unmatchFace',
|
47
49
|
'unmatchFinger',
|
48
50
|
'unreverseTcpPort',
|
49
|
-
]
|
51
|
+
];
|
52
|
+
|
53
|
+
traceMethods(log, this, methodNames);
|
54
|
+
wrapWithStackTraceCutter(this, methodNames);
|
50
55
|
|
51
56
|
this._appsConfig = appsConfig;
|
52
57
|
this._behaviorConfig = behaviorConfig;
|
@@ -80,13 +85,6 @@ class RuntimeDevice {
|
|
80
85
|
return this._currentAppLaunchArgs;
|
81
86
|
}
|
82
87
|
|
83
|
-
async _prepare() {
|
84
|
-
const appAliases = Object.keys(this._appsConfig);
|
85
|
-
if (appAliases.length === 1) {
|
86
|
-
await this.selectApp(appAliases[0]);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
88
|
async selectApp(name) {
|
91
89
|
if (name === undefined) {
|
92
90
|
throw this._errorComposer.cantSelectEmptyApp();
|
@@ -113,12 +111,71 @@ class RuntimeDevice {
|
|
113
111
|
}
|
114
112
|
|
115
113
|
async launchApp(params = {}, bundleId = this._bundleId) {
|
116
|
-
|
114
|
+
const payloadParams = ['url', 'userNotification', 'userActivity'];
|
115
|
+
const hasPayload = this._assertHasSingleParam(payloadParams, params);
|
116
|
+
const newInstance = params.newInstance !== undefined
|
117
|
+
? params.newInstance
|
118
|
+
: this._processes[bundleId] == null;
|
119
|
+
|
120
|
+
if (params.delete) {
|
121
|
+
await this.terminateApp(bundleId);
|
122
|
+
await this.uninstallApp();
|
123
|
+
await this.installApp();
|
124
|
+
} else if (newInstance) {
|
125
|
+
await this.terminateApp(bundleId);
|
126
|
+
}
|
127
|
+
|
128
|
+
const baseLaunchArgs = {
|
129
|
+
...this._currentAppLaunchArgs.get(),
|
130
|
+
...params.launchArgs,
|
131
|
+
};
|
132
|
+
|
133
|
+
if (params.url) {
|
134
|
+
baseLaunchArgs['detoxURLOverride'] = params.url;
|
135
|
+
if (params.sourceApp) {
|
136
|
+
baseLaunchArgs['detoxSourceAppOverride'] = params.sourceApp;
|
137
|
+
}
|
138
|
+
} else if (params.userNotification) {
|
139
|
+
this._createPayloadFileAndUpdatesParamsObject('userNotification', 'detoxUserNotificationDataURL', params, baseLaunchArgs);
|
140
|
+
} else if (params.userActivity) {
|
141
|
+
this._createPayloadFileAndUpdatesParamsObject('userActivity', 'detoxUserActivityDataURL', params, baseLaunchArgs);
|
142
|
+
}
|
143
|
+
|
144
|
+
if (params.permissions) {
|
145
|
+
await this.deviceDriver.setPermissions(bundleId, params.permissions);
|
146
|
+
}
|
147
|
+
|
148
|
+
if (params.disableTouchIndicators) {
|
149
|
+
baseLaunchArgs['detoxDisableTouchIndicators'] = true;
|
150
|
+
}
|
151
|
+
|
152
|
+
if (this._isAppRunning(bundleId) && hasPayload) {
|
153
|
+
await this.deviceDriver.deliverPayload({ ...(params), delayPayload: true });
|
154
|
+
}
|
155
|
+
|
156
|
+
if (this._behaviorConfig.launchApp === 'manual') {
|
157
|
+
this._processes[bundleId] = await this.deviceDriver.waitForAppLaunch(bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);
|
158
|
+
} else {
|
159
|
+
this._processes[bundleId] = await this.deviceDriver.launchApp(bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);
|
160
|
+
await this.deviceDriver.waitUntilReady();
|
161
|
+
await this.deviceDriver.waitForActive();
|
162
|
+
}
|
163
|
+
|
164
|
+
await this._emitter.emit('appReady', {
|
165
|
+
deviceId: this.deviceDriver.getExternalId(),
|
166
|
+
bundleId,
|
167
|
+
pid: this._processes[bundleId],
|
168
|
+
});
|
169
|
+
|
170
|
+
if (params.detoxUserNotificationDataURL) {
|
171
|
+
await this.deviceDriver.cleanupRandomDirectory(params.detoxUserNotificationDataURL);
|
172
|
+
}
|
173
|
+
|
174
|
+
if (params.detoxUserActivityDataURL) {
|
175
|
+
await this.deviceDriver.cleanupRandomDirectory(params.detoxUserActivityDataURL);
|
176
|
+
}
|
117
177
|
}
|
118
178
|
|
119
|
-
/**
|
120
|
-
* @deprecated
|
121
|
-
*/
|
122
179
|
async relaunchApp(params = {}, bundleId) {
|
123
180
|
if (params.newInstance === undefined) {
|
124
181
|
params['newInstance'] = true;
|
@@ -180,24 +237,33 @@ class RuntimeDevice {
|
|
180
237
|
|
181
238
|
async installApp(binaryPath, testBinaryPath) {
|
182
239
|
const currentApp = binaryPath ? { binaryPath, testBinaryPath } : this._getCurrentApp();
|
183
|
-
await
|
184
|
-
|
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
|
+
}
|
185
251
|
}
|
186
252
|
|
187
253
|
async uninstallApp(bundleId) {
|
188
254
|
const _bundleId = bundleId || this._bundleId;
|
189
|
-
await
|
255
|
+
await this.deviceDriver.uninstallApp(_bundleId);
|
190
256
|
}
|
191
257
|
|
192
258
|
async installUtilBinaries() {
|
193
259
|
const paths = this._deviceConfig.utilBinaryPaths;
|
194
260
|
if (paths) {
|
195
|
-
await
|
261
|
+
await this.deviceDriver.installUtilBinaries(paths);
|
196
262
|
}
|
197
263
|
}
|
198
264
|
|
199
265
|
async reloadReactNative() {
|
200
|
-
await
|
266
|
+
await this.deviceDriver.reloadReactNative();
|
201
267
|
}
|
202
268
|
|
203
269
|
async openURL(params) {
|
@@ -296,73 +362,6 @@ class RuntimeDevice {
|
|
296
362
|
}
|
297
363
|
return this._currentApp;
|
298
364
|
}
|
299
|
-
|
300
|
-
async _doLaunchApp(params, bundleId) {
|
301
|
-
const payloadParams = ['url', 'userNotification', 'userActivity'];
|
302
|
-
const hasPayload = this._assertHasSingleParam(payloadParams, params);
|
303
|
-
const newInstance = params.newInstance !== undefined
|
304
|
-
? params.newInstance
|
305
|
-
: this._processes[bundleId] == null;
|
306
|
-
|
307
|
-
if (params.delete) {
|
308
|
-
await this.terminateApp(bundleId);
|
309
|
-
await this.uninstallApp();
|
310
|
-
await this.installApp();
|
311
|
-
} else if (newInstance) {
|
312
|
-
await this.terminateApp(bundleId);
|
313
|
-
}
|
314
|
-
|
315
|
-
const baseLaunchArgs = {
|
316
|
-
...this._currentAppLaunchArgs.get(),
|
317
|
-
...params.launchArgs,
|
318
|
-
};
|
319
|
-
|
320
|
-
if (params.url) {
|
321
|
-
baseLaunchArgs['detoxURLOverride'] = params.url;
|
322
|
-
if (params.sourceApp) {
|
323
|
-
baseLaunchArgs['detoxSourceAppOverride'] = params.sourceApp;
|
324
|
-
}
|
325
|
-
} else if (params.userNotification) {
|
326
|
-
this._createPayloadFileAndUpdatesParamsObject('userNotification', 'detoxUserNotificationDataURL', params, baseLaunchArgs);
|
327
|
-
} else if (params.userActivity) {
|
328
|
-
this._createPayloadFileAndUpdatesParamsObject('userActivity', 'detoxUserActivityDataURL', params, baseLaunchArgs);
|
329
|
-
}
|
330
|
-
|
331
|
-
if (params.permissions) {
|
332
|
-
await this.deviceDriver.setPermissions(bundleId, params.permissions);
|
333
|
-
}
|
334
|
-
|
335
|
-
if (params.disableTouchIndicators) {
|
336
|
-
baseLaunchArgs['detoxDisableTouchIndicators'] = true;
|
337
|
-
}
|
338
|
-
|
339
|
-
if (this._isAppRunning(bundleId) && hasPayload) {
|
340
|
-
await this.deviceDriver.deliverPayload({ ...params, delayPayload: true });
|
341
|
-
}
|
342
|
-
|
343
|
-
if (this._behaviorConfig.launchApp === 'manual') {
|
344
|
-
this._processes[bundleId] = await this.deviceDriver.waitForAppLaunch(bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);
|
345
|
-
} else {
|
346
|
-
this._processes[bundleId] = await this.deviceDriver.launchApp(bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);
|
347
|
-
await this.deviceDriver.waitUntilReady();
|
348
|
-
await this.deviceDriver.waitForActive();
|
349
|
-
}
|
350
|
-
|
351
|
-
await this._emitter.emit('appReady', {
|
352
|
-
deviceId: this.deviceDriver.getExternalId(),
|
353
|
-
bundleId,
|
354
|
-
pid: this._processes[bundleId],
|
355
|
-
});
|
356
|
-
|
357
|
-
if(params.detoxUserNotificationDataURL) {
|
358
|
-
await this.deviceDriver.cleanupRandomDirectory(params.detoxUserNotificationDataURL);
|
359
|
-
}
|
360
|
-
|
361
|
-
if(params.detoxUserActivityDataURL) {
|
362
|
-
await this.deviceDriver.cleanupRandomDirectory(params.detoxUserActivityDataURL);
|
363
|
-
}
|
364
|
-
}
|
365
|
-
|
366
365
|
async _sendPayload(key, params) {
|
367
366
|
const payloadFilePath = this.deviceDriver.createPayloadFile(params);
|
368
367
|
const payload = {
|
@@ -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
|
@@ -153,9 +153,9 @@ class AndroidDriver extends DeviceDriverBase {
|
|
153
153
|
this.instrumentation.waitForCrash()
|
154
154
|
]);
|
155
155
|
} catch (e) {
|
156
|
-
|
156
|
+
log.warn({ error: e }, 'An error occurred while waiting for the app to become ready. Waiting for disconnection...');
|
157
157
|
await this.client.waitUntilDisconnected();
|
158
|
-
|
158
|
+
log.warn('The app disconnected.');
|
159
159
|
throw e;
|
160
160
|
} finally {
|
161
161
|
this.instrumentation.abortWaitForCrash();
|
@@ -2,6 +2,5 @@ module.exports = {
|
|
2
2
|
AndroidEmulatorRuntimeDriver: require('./android/emulator/EmulatorDriver'),
|
3
3
|
AttachedAndroidRuntimeDriver: require('./android/attached/AttachedAndroidDriver'),
|
4
4
|
GenycloudRuntimeDriver: require('./android/genycloud/GenyCloudDriver'),
|
5
|
-
IosRuntimeDriver: require('./ios/IosDriver'),
|
6
5
|
IosSimulatorRuntimeDriver: require('./ios/SimulatorDriver'),
|
7
6
|
};
|
@@ -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');
|
@@ -30,12 +30,13 @@ class SimulatorDriver extends IosDriver {
|
|
30
30
|
* @param deps { SimulatorDriverDeps }
|
31
31
|
* @param props { SimulatorDriverProps }
|
32
32
|
*/
|
33
|
-
constructor(deps, { udid, type, bootArgs }) {
|
33
|
+
constructor(deps, { udid, type, bootArgs, headless }) {
|
34
34
|
super(deps);
|
35
35
|
|
36
36
|
this.udid = udid;
|
37
37
|
this._type = type;
|
38
38
|
this._bootArgs = bootArgs;
|
39
|
+
this._headless = headless;
|
39
40
|
this._deviceName = `${udid} (${this._type})`;
|
40
41
|
this._simulatorLauncher = deps.simulatorLauncher;
|
41
42
|
this._applesimutils = deps.applesimutils;
|
@@ -151,7 +152,7 @@ class SimulatorDriver extends IosDriver {
|
|
151
152
|
async resetContentAndSettings() {
|
152
153
|
await this._simulatorLauncher.shutdown(this.udid);
|
153
154
|
await this._applesimutils.resetContentAndSettings(this.udid);
|
154
|
-
await this._simulatorLauncher.launch(this.udid, this._type, this._bootArgs);
|
155
|
+
await this._simulatorLauncher.launch(this.udid, this._type, this._bootArgs, this._headless);
|
155
156
|
}
|
156
157
|
|
157
158
|
getLogsPaths() {
|
@@ -15,19 +15,13 @@ class RuntimeDriverFactoryIos extends RuntimeDeviceFactory {
|
|
15
15
|
}
|
16
16
|
}
|
17
17
|
|
18
|
-
class Ios extends RuntimeDriverFactoryIos {
|
19
|
-
_createDriver(deviceCookie, deps, configs) { // eslint-disable-line no-unused-vars
|
20
|
-
const { IosRuntimeDriver } = require('../drivers');
|
21
|
-
return new IosRuntimeDriver(deps);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
18
|
class IosSimulator extends RuntimeDriverFactoryIos {
|
26
19
|
_createDriver(deviceCookie, deps, { deviceConfig }) {
|
27
20
|
const props = {
|
28
21
|
udid: deviceCookie.udid,
|
29
22
|
type: deviceConfig.device.type,
|
30
23
|
bootArgs: deviceConfig.bootArgs,
|
24
|
+
headless: deviceConfig.headless
|
31
25
|
};
|
32
26
|
|
33
27
|
const { IosSimulatorRuntimeDriver } = require('../drivers');
|
@@ -36,6 +30,5 @@ class IosSimulator extends RuntimeDriverFactoryIos {
|
|
36
30
|
}
|
37
31
|
|
38
32
|
module.exports = {
|
39
|
-
Ios,
|
40
33
|
IosSimulator,
|
41
34
|
};
|
@@ -1,14 +1,7 @@
|
|
1
1
|
const _ = require('lodash');
|
2
2
|
|
3
|
-
const log = require('../../../utils/logger');
|
4
|
-
|
5
3
|
const ScopedLaunchArgsEditor = require('./ScopedLaunchArgsEditor');
|
6
4
|
|
7
|
-
/**
|
8
|
-
* @typedef {Object} LaunchArgsEditorOptions
|
9
|
-
* @property {boolean} [permanent=false] - Indicates whether the operation should affect the permanent app launch args.
|
10
|
-
*/
|
11
|
-
|
12
5
|
class LaunchArgsEditor {
|
13
6
|
constructor() {
|
14
7
|
this._local = new ScopedLaunchArgsEditor();
|
@@ -19,67 +12,19 @@ class LaunchArgsEditor {
|
|
19
12
|
return this._shared;
|
20
13
|
}
|
21
14
|
|
22
|
-
|
23
|
-
|
24
|
-
*/
|
25
|
-
modify(launchArgs, options) {
|
26
|
-
this._assertNoDeprecatedOptions('modify', options);
|
27
|
-
|
28
|
-
if (!_.isEmpty(launchArgs)) {
|
29
|
-
if (options && options.permanent) {
|
30
|
-
this._shared.modify(launchArgs);
|
31
|
-
} else {
|
32
|
-
this._local.modify(launchArgs);
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
15
|
+
modify(launchArgs) {
|
16
|
+
this._local.modify(launchArgs);
|
36
17
|
return this;
|
37
18
|
}
|
38
19
|
|
39
|
-
|
40
|
-
* @param {LaunchArgsEditorOptions} [options] - deprecated
|
41
|
-
*/
|
42
|
-
reset(options) {
|
43
|
-
this._assertNoDeprecatedOptions('reset', options);
|
20
|
+
reset() {
|
44
21
|
this._local.reset();
|
45
|
-
|
46
|
-
if (options && options.permanent) {
|
47
|
-
this._shared.reset();
|
48
|
-
}
|
49
|
-
|
50
22
|
return this;
|
51
23
|
}
|
52
24
|
|
53
|
-
|
54
|
-
* @param {LaunchArgsEditorOptions} [options] - deprecated
|
55
|
-
*/
|
56
|
-
get(options) {
|
57
|
-
this._assertNoDeprecatedOptions('get', options);
|
58
|
-
const permanent = options && options.permanent;
|
59
|
-
|
60
|
-
if (permanent === true) {
|
61
|
-
return this._shared.get();
|
62
|
-
}
|
63
|
-
|
64
|
-
if (permanent === false) {
|
65
|
-
return this._local.get();
|
66
|
-
}
|
67
|
-
|
25
|
+
get() {
|
68
26
|
return _.merge(this._shared.get(), this._local.get());
|
69
27
|
}
|
70
|
-
|
71
|
-
_assertNoDeprecatedOptions(methodName, options) {
|
72
|
-
if (!options) {
|
73
|
-
return;
|
74
|
-
}
|
75
|
-
|
76
|
-
const target = options.permanent ? 'appLaunchArgs.shared' : 'appLaunchArgs';
|
77
|
-
log.warn({ event: 'DEPRECATION' }, [
|
78
|
-
`Detected an attempt to use device.launchArgs.${methodName}(...) with a deprecated 'options' parameter.`,
|
79
|
-
`Please use device.${target}.${methodName}(...) instead.`,
|
80
|
-
`For more details, see the reference at: https://wix.github.io/Detox/docs/api/device-object-api#deviceapplaunchargs\n`,
|
81
|
-
].join('\n'));
|
82
|
-
}
|
83
28
|
}
|
84
29
|
|
85
30
|
module.exports = LaunchArgsEditor;
|
@@ -85,14 +85,6 @@ function _getFactoryClasses(deviceConfig) {
|
|
85
85
|
runtimeDeviceFactoryClass = runtimeDeviceFactories.IosSimulator;
|
86
86
|
break;
|
87
87
|
|
88
|
-
case 'ios.none':
|
89
|
-
envValidatorFactoryClass = envValidationFactories.Noop;
|
90
|
-
deviceAllocatorFactoryClass = deviceAllocationFactories.None;
|
91
|
-
artifactsManagerFactoryClass = artifactsManagerFactories.Ios;
|
92
|
-
matchersFactoryClass = matchersFactories.Ios;
|
93
|
-
runtimeDeviceFactoryClass = runtimeDeviceFactories.Ios;
|
94
|
-
break;
|
95
|
-
|
96
88
|
default: {
|
97
89
|
return null;
|
98
90
|
}
|