detox 19.9.0 → 21.0.0-breaking.new-global-lifecycle.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.9.0/detox-19.9.0-javadoc.jar → 21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.9.0/detox-19.9.0-sources.jar → 21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.9.0/detox-19.9.0.pom → 21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom} +2 -2
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.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/android/build.gradle +2 -2
- package/android/detox/build.gradle +2 -2
- package/android/detox/publish-pom.gradle +1 -5
- package/android/detox/publishing.gradle +7 -9
- 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/android/detox/src/full/java/com/wix/detox/adapters/server/WebSocketClient.java +1 -3
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +3 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/UiAutomatorHelper.java +1 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +23 -16
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeLoadingMonitor.kt +8 -54
- package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +1 -4
- package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +1 -2
- package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +36 -0
- package/android/detox/src/{full → main}/java/com/wix/detox/espresso/action/GetAttributesAction.kt +1 -13
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/utils/UiControllerUtils.kt +1 -1
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/AdjustSliderToPositionActionTest.kt +59 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +3 -15
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -2
- package/android/gradlew +107 -181
- package/index.d.ts +208 -186
- package/index.js +1 -0
- package/internals.d.ts +124 -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 +0 -1
- package/local-cli/init.js +20 -55
- package/local-cli/templates/jest.js +9 -34
- package/local-cli/test.js +18 -282
- package/local-cli/test.test.js +332 -673
- package/local-cli/testCommand/TestRunnerCommand.js +157 -0
- package/local-cli/{utils/testCommandArgs.js → testCommand/builder.js} +10 -35
- package/local-cli/testCommand/middlewares.js +75 -0
- package/local-cli/{utils → testCommand}/warnings.js +0 -10
- package/local-cli/utils/jestInternals.js +13 -2
- package/local-cli/utils/yargsUtils.js +67 -0
- package/package.json +28 -22
- package/runners/deprecation.js +47 -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/deprecation.js +25 -0
- package/runners/jest/globalSetup.js +1 -0
- package/runners/jest/globalTeardown.js +1 -0
- package/runners/jest/index.js +21 -0
- package/runners/jest/reporter.js +1 -0
- package/runners/jest/reporters/DetoxReporter.js +5 -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 +155 -0
- package/runners/{jest-circus → jest/testEnvironment}/listeners/DetoxCoreListener.js +35 -17
- 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 -7
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +34 -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 +56 -0
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +23 -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/{Detox.js → DetoxWorker.js} +131 -164
- package/src/artifacts/ArtifactsManager.js +51 -2
- package/src/artifacts/log/android/ADBLogcatRecording.js +28 -11
- package/src/artifacts/providers/index.js +0 -4
- package/src/artifacts/utils/buildDefaultArtifactsRootDirpath.js +2 -4
- package/src/artifacts/utils/temporaryPath.js +2 -0
- package/src/client/AsyncWebSocket.js +1 -1
- package/src/client/actions/actions.js +2 -2
- package/src/configuration/collectCliConfig.js +2 -4
- package/src/configuration/composeAppsConfig.js +9 -67
- package/src/configuration/composeArtifactsConfig.js +6 -32
- package/src/configuration/composeBehaviorConfig.js +3 -13
- package/src/configuration/composeDeviceConfig.js +37 -62
- package/src/configuration/composeLoggerConfig.js +50 -0
- package/src/configuration/composeRunnerConfig.js +74 -14
- package/src/configuration/composeSessionConfig.js +1 -3
- package/src/configuration/index.js +24 -23
- package/src/configuration/utils/deviceAppTypes.js +0 -1
- package/src/devices/allocation/DeviceAllocator.js +3 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +4 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +2 -6
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +0 -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/exec/ADB.js +0 -5
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +4 -9
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +34 -9
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +1 -1
- package/src/devices/runtime/RuntimeDevice.js +69 -81
- package/src/devices/runtime/drivers/index.js +0 -1
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +3 -2
- 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 +76 -29
- package/src/errors/DetoxError.js +4 -0
- package/src/errors/DetoxRuntimeError.js +5 -5
- package/src/errors/index.js +2 -0
- package/src/ipc/IPCClient.js +117 -0
- package/src/ipc/IPCServer.js +87 -0
- package/src/ipc/state.js +76 -0
- package/src/logger/DetoxLogger.js +244 -0
- package/src/logger/DetoxTraceEventBuilder.js +21 -0
- package/src/logger/DetoxTracer.js +133 -0
- package/src/logger/TraceThreadDispatcher.js +52 -0
- package/src/{utils → logger}/customConsoleLogger.js +1 -1
- package/src/realms/DetoxConstants.js +13 -0
- package/src/realms/DetoxContext.js +170 -0
- package/src/realms/DetoxInternalsFacade.js +35 -0
- package/src/realms/DetoxPrimaryContext.js +229 -0
- package/src/realms/DetoxSecondaryContext.js +94 -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 +1 -1
- package/src/symbols.js +56 -0
- package/src/utils/ChromeTracingExporter.js +5 -6
- package/src/utils/Timer.js +14 -6
- package/{local-cli/utils/misc.js → src/utils/envUtils.js} +0 -9
- package/src/utils/logger.js +2 -162
- package/src/utils/shellUtils.js +18 -0
- package/src/utils/streamUtils.js +214 -0
- package/src/utils/trace.js +9 -44
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar +0 -0
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -22
- package/android/detox/src/full/java/com/wix/detox/espresso/common/SliderHelper.kt +0 -75
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/ReflectUtils.kt +0 -10
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/SliderHelperTest.kt +0 -39
- 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/utils/assertJestCircus26.js +0 -39
- package/runners/jest-circus/utils/wrapErrorWithNoopLifecycle.js +0 -14
- package/src/DetoxConstants.js +0 -13
- package/src/DetoxExportWrapper.js +0 -140
- package/src/artifacts/timeline/TimelineArtifactPlugin.js +0 -95
- 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/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
@@ -7,18 +7,67 @@ const _ = require('lodash');
|
|
7
7
|
|
8
8
|
const DetoxRuntimeError = require('../errors/DetoxRuntimeError');
|
9
9
|
const log = require('../utils/logger').child({ __filename });
|
10
|
+
const resolveModuleFromPath = require('../utils/resolveModuleFromPath');
|
11
|
+
const { traceMethods } = require('../utils/trace');
|
10
12
|
|
11
13
|
const FileArtifact = require('./templates/artifact/FileArtifact');
|
14
|
+
const ArtifactPathBuilder = require('./utils/ArtifactPathBuilder');
|
12
15
|
|
13
16
|
class ArtifactsManager extends EventEmitter {
|
14
|
-
constructor({ pathBuilder, plugins }) {
|
17
|
+
constructor({ rootDir, pathBuilder, plugins }) {
|
15
18
|
super();
|
16
19
|
|
17
20
|
this._pluginConfigs = plugins;
|
18
21
|
this._idlePromise = Promise.resolve();
|
19
22
|
this._idleCallbackRequests = [];
|
20
23
|
this._artifactPlugins = {};
|
21
|
-
this._pathBuilder = pathBuilder;
|
24
|
+
this._pathBuilder = this._resolveArtifactsPathBuilder(pathBuilder, rootDir);
|
25
|
+
|
26
|
+
traceMethods(this, 'artifacts-manager,artifacts', [
|
27
|
+
'onAppReady',
|
28
|
+
'onBeforeCleanup',
|
29
|
+
'onBeforeLaunchApp',
|
30
|
+
'onBeforeShutdownDevice',
|
31
|
+
'onBeforeTerminateApp',
|
32
|
+
'onBeforeUninstallApp',
|
33
|
+
'onBootDevice',
|
34
|
+
'onCreateExternalArtifact',
|
35
|
+
'onHookFailure',
|
36
|
+
'onHookStart',
|
37
|
+
'onHookSuccess',
|
38
|
+
'onLaunchApp',
|
39
|
+
'onRunDescribeFinish',
|
40
|
+
'onRunDescribeStart',
|
41
|
+
'onRunFinish',
|
42
|
+
'onRunStart',
|
43
|
+
'onShutdownDevice',
|
44
|
+
'onTerminateApp',
|
45
|
+
'onTestDone',
|
46
|
+
'onTestFnFailure',
|
47
|
+
'onTestFnStart',
|
48
|
+
'onTestFnSuccess',
|
49
|
+
'onTestStart',
|
50
|
+
]);
|
51
|
+
}
|
52
|
+
|
53
|
+
_resolveArtifactsPathBuilder(pathBuilder, rootDir) {
|
54
|
+
if (typeof pathBuilder === 'string') {
|
55
|
+
pathBuilder = resolveModuleFromPath(pathBuilder);
|
56
|
+
|
57
|
+
if (typeof pathBuilder === 'function') {
|
58
|
+
try {
|
59
|
+
pathBuilder = pathBuilder({ rootDir });
|
60
|
+
} catch (e) {
|
61
|
+
pathBuilder = new pathBuilder({ rootDir });
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
if (!pathBuilder) {
|
67
|
+
pathBuilder = new ArtifactPathBuilder({ rootDir });
|
68
|
+
}
|
69
|
+
|
70
|
+
return pathBuilder;
|
22
71
|
}
|
23
72
|
|
24
73
|
_instantiateArtifactPlugin(pluginFactory, pluginUserConfig) {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
const DetoxRuntimeError = require('../../../errors/DetoxRuntimeError');
|
2
2
|
const { interruptProcess } = require('../../../utils/childProcess');
|
3
|
+
const log = require('../../../utils/logger').child({ __filename });
|
3
4
|
const retry = require('../../../utils/retry');
|
4
5
|
const sleep = require('../../../utils/sleep');
|
5
6
|
const Artifact = require('../../templates/artifact/Artifact');
|
@@ -25,18 +26,26 @@ class ADBLogcatRecording extends Artifact {
|
|
25
26
|
this._waitUntilLogFileIsCreated = null;
|
26
27
|
}
|
27
28
|
|
29
|
+
get hasRecordedFile() {
|
30
|
+
return !!this._waitUntilLogFileIsCreated;
|
31
|
+
}
|
32
|
+
|
28
33
|
async doStart() {
|
29
34
|
const pid = this.pid.get();
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
if (pid > 0) {
|
37
|
+
this.processPromise = this.adb.logcat(this.deviceId, {
|
38
|
+
file: this.pathToLogOnDevice,
|
39
|
+
time: this.since.get(),
|
40
|
+
pid,
|
41
|
+
});
|
36
42
|
|
37
|
-
|
38
|
-
|
39
|
-
|
43
|
+
this._waitUntilLogFileIsCreated = sleep(300).then(() => {
|
44
|
+
return retry(() => this._assertLogIsCreated());
|
45
|
+
});
|
46
|
+
} else {
|
47
|
+
log.debug('Ignoring a command to start recording, because PID of the app is missing');
|
48
|
+
}
|
40
49
|
}
|
41
50
|
|
42
51
|
async doStop() {
|
@@ -52,12 +61,20 @@ class ADBLogcatRecording extends Artifact {
|
|
52
61
|
}
|
53
62
|
|
54
63
|
async doSave(artifactPath) {
|
55
|
-
|
56
|
-
|
64
|
+
if (this.hasRecordedFile) {
|
65
|
+
await this.adb.pull(this.deviceId, this.pathToLogOnDevice, artifactPath);
|
66
|
+
await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
|
67
|
+
} else {
|
68
|
+
log.debug(`Skipping saving artifact because the recording has not started: ${artifactPath}`);
|
69
|
+
}
|
57
70
|
}
|
58
71
|
|
59
72
|
async doDiscard() {
|
60
|
-
|
73
|
+
if (this.hasRecordedFile) {
|
74
|
+
await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
|
75
|
+
} else {
|
76
|
+
log.debug(`Skipping discarding artifact due to a not started recording: ${this.pathToLogOnDevice}`);
|
77
|
+
}
|
61
78
|
}
|
62
79
|
|
63
80
|
async _assertLogIsCreated() {
|
@@ -12,25 +12,21 @@ class AndroidArtifactPluginsProvider extends ArtifactPluginsProvider {
|
|
12
12
|
const ADBLogcatPlugin = require('../log/android/ADBLogcatPlugin');
|
13
13
|
const ADBScreencapPlugin = require('../screenshot/ADBScreencapPlugin');
|
14
14
|
const ADBScreenrecorderPlugin = require('../video/ADBScreenrecorderPlugin');
|
15
|
-
const TimelineArtifactPlugin = require('../timeline/TimelineArtifactPlugin');
|
16
15
|
|
17
16
|
return {
|
18
17
|
instruments: (api) => new AndroidInstrumentsPlugin({ api, adb, client, devicePathBuilder }),
|
19
18
|
log: (api) => new ADBLogcatPlugin({ api, adb, devicePathBuilder }),
|
20
19
|
screenshot: (api) => new ADBScreencapPlugin({ api, adb, devicePathBuilder }),
|
21
20
|
video: (api) => new ADBScreenrecorderPlugin({ api, adb, devicePathBuilder }),
|
22
|
-
timeline: (api) => new TimelineArtifactPlugin({ api }),
|
23
21
|
};
|
24
22
|
}
|
25
23
|
}
|
26
24
|
|
27
25
|
class IosArtifactPluginsProvider extends ArtifactPluginsProvider {
|
28
26
|
declareArtifactPlugins({ client }) {
|
29
|
-
const TimelineArtifactPlugin = require('../timeline/TimelineArtifactPlugin');
|
30
27
|
const IosUIHierarchyPlugin = require('../uiHierarchy/IosUIHierarchyPlugin');
|
31
28
|
|
32
29
|
return {
|
33
|
-
timeline: (api) => new TimelineArtifactPlugin({ api }),
|
34
30
|
uiHierarchy: (api) => new IosUIHierarchyPlugin({ api, client }),
|
35
31
|
};
|
36
32
|
}
|
@@ -4,12 +4,10 @@ const getTimeStampString = require('./getTimeStampString');
|
|
4
4
|
|
5
5
|
function buildDefaultRootForArtifactsRootDirpath(configuration, rootDir) {
|
6
6
|
if (rootDir.endsWith('/') || rootDir.endsWith('\\')) {
|
7
|
-
return rootDir;
|
7
|
+
return rootDir.slice(0, -1);
|
8
8
|
}
|
9
9
|
|
10
|
-
|
11
|
-
const subdir = `${configuration}.${getTimeStampString(new Date(seed))}`;
|
12
|
-
return path.join(rootDir, subdir);
|
10
|
+
return path.join(rootDir, `${configuration}.${getTimeStampString(new Date())}`);
|
13
11
|
}
|
14
12
|
|
15
13
|
module.exports = buildDefaultRootForArtifactsRootDirpath;
|
@@ -5,7 +5,7 @@ const WebSocket = require('ws');
|
|
5
5
|
const DetoxInternalError = require('../errors/DetoxInternalError');
|
6
6
|
const DetoxRuntimeError = require('../errors/DetoxRuntimeError');
|
7
7
|
const Deferred = require('../utils/Deferred');
|
8
|
-
const log = require('../utils/logger').child({ __filename });
|
8
|
+
const log = require('../utils/logger').child({ __filename, cat: 'ws-client,ws' });
|
9
9
|
|
10
10
|
const InflightRequest = require('./InflightRequest');
|
11
11
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const { DetoxInternalError, DetoxRuntimeError } = require('../../errors');
|
3
|
-
const
|
3
|
+
const logger = require('../../utils/logger');
|
4
4
|
const formatJSONStatus = require('../actions/formatters/SyncStatusFormatter');
|
5
5
|
|
6
6
|
class Action {
|
@@ -201,7 +201,7 @@ class Invoke extends Action {
|
|
201
201
|
|
202
202
|
if (response.params.viewHierarchy) {
|
203
203
|
/* istanbul ignore next */
|
204
|
-
if (/^(debug|trace)$/.test(
|
204
|
+
if (/^(debug|trace)$/.test(logger.level)) {
|
205
205
|
debugInfo = 'View Hierarchy:\n' + response.params.viewHierarchy;
|
206
206
|
} else {
|
207
207
|
hint = 'To print view hierarchy on failed actions/matches, use log-level verbose or higher.';
|
@@ -36,7 +36,7 @@ const deprecateDeviceLaunchArgs = (value) => {
|
|
36
36
|
function collectCliConfig({ argv }) {
|
37
37
|
const env = (key) => argparse.getArgValue(key);
|
38
38
|
const get = (key, fallback) => {
|
39
|
-
const value = argv ? argv[key] : env(key);
|
39
|
+
const value = argv && Reflect.has(argv, key) ? argv[key] : env(key);
|
40
40
|
return value === undefined ? fallback : value;
|
41
41
|
};
|
42
42
|
|
@@ -47,7 +47,6 @@ function collectCliConfig({ argv }) {
|
|
47
47
|
takeScreenshots: get('take-screenshots'),
|
48
48
|
recordVideos: get('record-videos'),
|
49
49
|
recordPerformance: get('record-performance'),
|
50
|
-
recordTimeline: get('record-timeline'),
|
51
50
|
cleanup: asBoolean(get('cleanup')),
|
52
51
|
configPath: get('config-path'),
|
53
52
|
configuration: get('configuration'),
|
@@ -64,9 +63,8 @@ function collectCliConfig({ argv }) {
|
|
64
63
|
loglevel: get('loglevel'),
|
65
64
|
noColor: asBoolean(get('no-color')),
|
66
65
|
reuse: asBoolean(get('reuse')),
|
67
|
-
runnerConfig: get('runner-config'),
|
68
66
|
useCustomLogger: asBoolean(get('use-custom-logger')),
|
69
|
-
|
67
|
+
retries: asNumber(get('retries')),
|
70
68
|
inspectBrk: asBoolean(get('inspect-brk')),
|
71
69
|
}, _.isUndefined);
|
72
70
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const _ = require('lodash');
|
3
|
-
const parse = require('yargs
|
3
|
+
const parse = require('yargs/yargs').Parser;
|
4
4
|
|
5
5
|
const deviceAppTypes = require('./utils/deviceAppTypes');
|
6
6
|
|
@@ -19,12 +19,7 @@ const CLI_PARSER_OPTIONS = {
|
|
19
19
|
* @returns {Record<string, Detox.DetoxAppConfig>}
|
20
20
|
*/
|
21
21
|
function composeAppsConfig(opts) {
|
22
|
-
const
|
23
|
-
|
24
|
-
const appsConfig = localConfig.type
|
25
|
-
? composeAppsConfigFromPlain(opts)
|
26
|
-
: composeAppsConfigFromAliased(opts);
|
27
|
-
|
22
|
+
const appsConfig = composeAppsConfigFromAliased(opts);
|
28
23
|
overrideAppLaunchArgs(appsConfig, opts.cliConfig);
|
29
24
|
|
30
25
|
return appsConfig;
|
@@ -35,65 +30,7 @@ function composeAppsConfig(opts) {
|
|
35
30
|
* @param {string} opts.configurationName
|
36
31
|
* @param {Detox.DetoxDeviceConfig} opts.deviceConfig
|
37
32
|
* @param {Detox.DetoxConfig} opts.globalConfig
|
38
|
-
* @param {Detox.
|
39
|
-
* @returns {Record<string, Detox.DetoxAppConfig>}
|
40
|
-
*/
|
41
|
-
function composeAppsConfigFromPlain(opts) {
|
42
|
-
const { errorComposer, localConfig } = opts;
|
43
|
-
|
44
|
-
if (localConfig.app || localConfig.apps) {
|
45
|
-
throw errorComposer.oldSchemaHasAppAndApps();
|
46
|
-
}
|
47
|
-
|
48
|
-
/** @type {Detox.DetoxAppConfig} */
|
49
|
-
let appConfig;
|
50
|
-
|
51
|
-
switch (opts.deviceConfig.type) {
|
52
|
-
case 'android.attached':
|
53
|
-
case 'android.emulator':
|
54
|
-
case 'android.genycloud':
|
55
|
-
appConfig = {
|
56
|
-
type: 'android.apk',
|
57
|
-
binaryPath: localConfig.binaryPath,
|
58
|
-
bundleId: localConfig.bundleId,
|
59
|
-
build: localConfig.build,
|
60
|
-
testBinaryPath: localConfig.testBinaryPath,
|
61
|
-
launchArgs: localConfig.launchArgs,
|
62
|
-
}; break;
|
63
|
-
case 'ios.none':
|
64
|
-
case 'ios.simulator':
|
65
|
-
appConfig = {
|
66
|
-
type: 'ios.app',
|
67
|
-
binaryPath: localConfig.binaryPath,
|
68
|
-
bundleId: localConfig.bundleId,
|
69
|
-
build: localConfig.build,
|
70
|
-
launchArgs: localConfig.launchArgs,
|
71
|
-
};
|
72
|
-
break;
|
73
|
-
default:
|
74
|
-
appConfig = {
|
75
|
-
...localConfig,
|
76
|
-
};
|
77
|
-
}
|
78
|
-
|
79
|
-
validateAppConfig({
|
80
|
-
errorComposer,
|
81
|
-
appConfig,
|
82
|
-
deviceConfig: opts.deviceConfig,
|
83
|
-
appPath: ['configurations', opts.configurationName],
|
84
|
-
});
|
85
|
-
|
86
|
-
return {
|
87
|
-
default: _.omitBy(appConfig, _.isUndefined),
|
88
|
-
};
|
89
|
-
}
|
90
|
-
|
91
|
-
/**
|
92
|
-
* @param {DetoxConfigErrorComposer} opts.errorComposer
|
93
|
-
* @param {string} opts.configurationName
|
94
|
-
* @param {Detox.DetoxDeviceConfig} opts.deviceConfig
|
95
|
-
* @param {Detox.DetoxConfig} opts.globalConfig
|
96
|
-
* @param {Detox.DetoxAliasedConfiguration} opts.localConfig
|
33
|
+
* @param {Detox.DetoxConfiguration} opts.localConfig
|
97
34
|
* @returns {Record<string, Detox.DetoxAppConfig>}
|
98
35
|
*/
|
99
36
|
function composeAppsConfigFromAliased(opts) {
|
@@ -101,8 +38,13 @@ function composeAppsConfigFromAliased(opts) {
|
|
101
38
|
const result = {};
|
102
39
|
const { configurationName, errorComposer, deviceConfig, globalConfig, localConfig } = opts;
|
103
40
|
|
41
|
+
const isBuiltinDevice = Boolean(deviceAppTypes[deviceConfig.type]);
|
104
42
|
if (localConfig.app == null && localConfig.apps == null) {
|
105
|
-
|
43
|
+
if (isBuiltinDevice) {
|
44
|
+
throw errorComposer.noAppIsDefined(deviceConfig.type);
|
45
|
+
} else {
|
46
|
+
return result;
|
47
|
+
}
|
106
48
|
}
|
107
49
|
|
108
50
|
if (localConfig.app != null && localConfig.apps != null) {
|
@@ -4,18 +4,15 @@ const _ = require('lodash');
|
|
4
4
|
const InstrumentsArtifactPlugin = require('../artifacts/instruments/InstrumentsArtifactPlugin');
|
5
5
|
const LogArtifactPlugin = require('../artifacts/log/LogArtifactPlugin');
|
6
6
|
const ScreenshotArtifactPlugin = require('../artifacts/screenshot/ScreenshotArtifactPlugin');
|
7
|
-
const TimelineArtifactPlugin = require('../artifacts/timeline/TimelineArtifactPlugin');
|
8
7
|
const IosUIHierarchyPlugin = require('../artifacts/uiHierarchy/IosUIHierarchyPlugin');
|
9
|
-
const ArtifactPathBuilder = require('../artifacts/utils/ArtifactPathBuilder');
|
10
8
|
const buildDefaultArtifactsRootDirpath = require('../artifacts/utils/buildDefaultArtifactsRootDirpath');
|
11
9
|
const VideoArtifactPlugin = require('../artifacts/video/VideoArtifactPlugin');
|
12
|
-
const resolveModuleFromPath = require('../utils/resolveModuleFromPath');
|
13
10
|
|
14
11
|
/**
|
15
12
|
* @param {*} cliConfig
|
16
13
|
* @param {string} configurationName
|
17
14
|
* @param {Detox.DetoxConfig} globalConfig
|
18
|
-
* @param {Detox.
|
15
|
+
* @param {Detox.DetoxConfiguration} localConfig
|
19
16
|
*/
|
20
17
|
function composeArtifactsConfig({
|
21
18
|
cliConfig,
|
@@ -31,7 +28,6 @@ function composeArtifactsConfig({
|
|
31
28
|
screenshot: cliConfig.takeScreenshots,
|
32
29
|
video: cliConfig.recordVideos,
|
33
30
|
instruments: cliConfig.recordPerformance,
|
34
|
-
timeline: cliConfig.recordTimeline,
|
35
31
|
uiHierarchy: cliConfig.captureViewHierarchy,
|
36
32
|
},
|
37
33
|
}),
|
@@ -40,13 +36,15 @@ function composeArtifactsConfig({
|
|
40
36
|
extendArtifactsConfig(false),
|
41
37
|
);
|
42
38
|
|
39
|
+
if (!artifactsConfig.pathBuilder) {
|
40
|
+
artifactsConfig.pathBuilder = undefined;
|
41
|
+
}
|
42
|
+
|
43
43
|
artifactsConfig.rootDir = buildDefaultArtifactsRootDirpath(
|
44
44
|
configurationName,
|
45
45
|
artifactsConfig.rootDir
|
46
46
|
);
|
47
47
|
|
48
|
-
artifactsConfig.pathBuilder = resolveArtifactsPathBuilder(artifactsConfig);
|
49
|
-
|
50
48
|
return artifactsConfig;
|
51
49
|
}
|
52
50
|
|
@@ -54,13 +52,12 @@ function extendArtifactsConfig(config) {
|
|
54
52
|
if (config === false) {
|
55
53
|
return extendArtifactsConfig({
|
56
54
|
rootDir: 'artifacts',
|
57
|
-
pathBuilder:
|
55
|
+
pathBuilder: '',
|
58
56
|
plugins: {
|
59
57
|
log: 'none',
|
60
58
|
screenshot: 'manual',
|
61
59
|
video: 'none',
|
62
60
|
instruments: 'none',
|
63
|
-
timeline: 'none',
|
64
61
|
uiHierarchy: 'disabled',
|
65
62
|
},
|
66
63
|
});
|
@@ -79,34 +76,11 @@ function extendArtifactsConfig(config) {
|
|
79
76
|
screenshot: ifString(p.screenshot, ScreenshotArtifactPlugin.parseConfig),
|
80
77
|
video: ifString(p.video, VideoArtifactPlugin.parseConfig),
|
81
78
|
instruments: ifString(p.instruments, InstrumentsArtifactPlugin.parseConfig),
|
82
|
-
timeline: ifString(p.timeline, TimelineArtifactPlugin.parseConfig),
|
83
79
|
uiHierarchy: ifString(p.uiHierarchy, IosUIHierarchyPlugin.parseConfig),
|
84
80
|
},
|
85
81
|
};
|
86
82
|
}
|
87
83
|
|
88
|
-
function resolveArtifactsPathBuilder(artifactsConfig) {
|
89
|
-
let { rootDir, pathBuilder } = artifactsConfig;
|
90
|
-
|
91
|
-
if (typeof pathBuilder === 'string') {
|
92
|
-
pathBuilder = resolveModuleFromPath(pathBuilder);
|
93
|
-
}
|
94
|
-
|
95
|
-
if (typeof pathBuilder === 'function') {
|
96
|
-
try {
|
97
|
-
pathBuilder = pathBuilder({ rootDir });
|
98
|
-
} catch (e) {
|
99
|
-
pathBuilder = new pathBuilder({ rootDir });
|
100
|
-
}
|
101
|
-
}
|
102
|
-
|
103
|
-
if (!pathBuilder) {
|
104
|
-
pathBuilder = new ArtifactPathBuilder({ rootDir });
|
105
|
-
}
|
106
|
-
|
107
|
-
return pathBuilder;
|
108
|
-
}
|
109
|
-
|
110
84
|
function ifString(value, mapper) {
|
111
85
|
return typeof value === 'string' ? mapper(value) : value;
|
112
86
|
}
|
@@ -4,36 +4,30 @@ const _ = require('lodash');
|
|
4
4
|
/**
|
5
5
|
* @param {*} cliConfig
|
6
6
|
* @param {Detox.DetoxConfig} globalConfig
|
7
|
-
* @param {Detox.
|
8
|
-
* @param {Detox.DetoxInitOptions} userParams
|
7
|
+
* @param {Detox.DetoxConfiguration} localConfig
|
9
8
|
*/
|
10
9
|
function composeBehaviorConfig({
|
11
10
|
cliConfig,
|
12
11
|
globalConfig,
|
13
12
|
localConfig,
|
14
|
-
userParams
|
15
13
|
}) {
|
16
14
|
return _.chain({})
|
17
15
|
.defaultsDeep(
|
18
16
|
{
|
19
17
|
init: {
|
18
|
+
keepLockFile: cliConfig.keepLockFile ? true : undefined,
|
20
19
|
reinstallApp: cliConfig.reuse ? false : undefined,
|
21
20
|
},
|
22
21
|
cleanup: {
|
23
22
|
shutdownDevice: cliConfig.cleanup ? true : undefined,
|
24
23
|
},
|
25
24
|
},
|
26
|
-
userParams && {
|
27
|
-
init: {
|
28
|
-
exposeGlobals: userParams.initGlobals,
|
29
|
-
reinstallApp: negateDefined(userParams.reuse),
|
30
|
-
},
|
31
|
-
},
|
32
25
|
localConfig.behavior,
|
33
26
|
globalConfig.behavior,
|
34
27
|
{
|
35
28
|
init: {
|
36
29
|
exposeGlobals: true,
|
30
|
+
keepLockFile: false,
|
37
31
|
reinstallApp: undefined,
|
38
32
|
},
|
39
33
|
launchApp: 'auto',
|
@@ -50,8 +44,4 @@ function composeBehaviorConfig({
|
|
50
44
|
.value();
|
51
45
|
}
|
52
46
|
|
53
|
-
function negateDefined(x) {
|
54
|
-
return x !== undefined ? !x : undefined;
|
55
|
-
}
|
56
|
-
|
57
47
|
module.exports = composeBehaviorConfig;
|
@@ -12,13 +12,8 @@ const log = require('../utils/logger').child({ __filename });
|
|
12
12
|
* @returns {Detox.DetoxDeviceConfig}
|
13
13
|
*/
|
14
14
|
function composeDeviceConfig(opts) {
|
15
|
-
const
|
16
|
-
|
17
|
-
const deviceConfig = localConfig.type
|
18
|
-
? composeDeviceConfigFromPlain(opts)
|
19
|
-
: composeDeviceConfigFromAliased(opts);
|
20
|
-
|
21
|
-
applyCLIOverrides(deviceConfig, cliConfig);
|
15
|
+
const deviceConfig = composeDeviceConfigFromAliased(opts);
|
16
|
+
applyCLIOverrides(deviceConfig, opts.cliConfig);
|
22
17
|
deviceConfig.device = unpackDeviceQuery(deviceConfig);
|
23
18
|
|
24
19
|
return deviceConfig;
|
@@ -27,29 +22,7 @@ function composeDeviceConfig(opts) {
|
|
27
22
|
/**
|
28
23
|
* @param {DetoxConfigErrorComposer} opts.errorComposer
|
29
24
|
* @param {Detox.DetoxConfig} opts.globalConfig
|
30
|
-
* @param {Detox.
|
31
|
-
* @returns {Detox.DetoxDeviceConfig}
|
32
|
-
*/
|
33
|
-
function composeDeviceConfigFromPlain(opts) {
|
34
|
-
const { errorComposer, localConfig } = opts;
|
35
|
-
|
36
|
-
const type = localConfig.type;
|
37
|
-
const device = localConfig.device || localConfig.name;
|
38
|
-
const utilBinaryPaths = localConfig.utilBinaryPaths;
|
39
|
-
|
40
|
-
const deviceConfig = type in EXPECTED_DEVICE_MATCHER_PROPS
|
41
|
-
? _.omitBy({ type, device, utilBinaryPaths }, _.isUndefined)
|
42
|
-
: { ...localConfig };
|
43
|
-
|
44
|
-
validateDeviceConfig({ deviceConfig, errorComposer });
|
45
|
-
|
46
|
-
return deviceConfig;
|
47
|
-
}
|
48
|
-
|
49
|
-
/**
|
50
|
-
* @param {DetoxConfigErrorComposer} opts.errorComposer
|
51
|
-
* @param {Detox.DetoxConfig} opts.globalConfig
|
52
|
-
* @param {Detox.DetoxAliasedConfiguration} opts.localConfig
|
25
|
+
* @param {Detox.DetoxConfiguration} opts.localConfig
|
53
26
|
* @returns {Detox.DetoxDeviceConfig}
|
54
27
|
*/
|
55
28
|
function composeDeviceConfigFromAliased(opts) {
|
@@ -145,7 +118,7 @@ function validateDeviceConfig({ deviceConfig, errorComposer, deviceAlias }) {
|
|
145
118
|
throw errorComposer.malformedDeviceProperty(deviceAlias, 'gpuMode');
|
146
119
|
}
|
147
120
|
|
148
|
-
if (!deviceConfig.gpuMode.match(/^(auto|host|swiftshader_indirect|angle_indirect|guest)$/)) {
|
121
|
+
if (!deviceConfig.gpuMode.match(/^(auto|host|swiftshader_indirect|angle_indirect|guest|off)$/)) {
|
149
122
|
throw errorComposer.malformedDeviceProperty(deviceAlias, 'gpuMode');
|
150
123
|
}
|
151
124
|
|
@@ -159,7 +132,7 @@ function validateDeviceConfig({ deviceConfig, errorComposer, deviceAlias }) {
|
|
159
132
|
throw errorComposer.malformedDeviceProperty(deviceAlias, 'headless');
|
160
133
|
}
|
161
134
|
|
162
|
-
if (deviceConfig.type !== 'android.emulator') {
|
135
|
+
if (deviceConfig.type !== 'ios.simulator' && deviceConfig.type !== 'android.emulator') {
|
163
136
|
throw errorComposer.unsupportedDeviceProperty(deviceAlias, 'headless');
|
164
137
|
}
|
165
138
|
}
|
@@ -176,6 +149,7 @@ function validateDeviceConfig({ deviceConfig, errorComposer, deviceAlias }) {
|
|
176
149
|
|
177
150
|
if (_.isObject(deviceConfig.device)) {
|
178
151
|
const expectedProperties = EXPECTED_DEVICE_MATCHER_PROPS[deviceConfig.type];
|
152
|
+
/* istanbul ignore else */
|
179
153
|
if (!_.isEmpty(expectedProperties)) {
|
180
154
|
const minimalShape = _.pick(deviceConfig.device, expectedProperties);
|
181
155
|
|
@@ -187,41 +161,44 @@ function validateDeviceConfig({ deviceConfig, errorComposer, deviceAlias }) {
|
|
187
161
|
}
|
188
162
|
|
189
163
|
function applyCLIOverrides(deviceConfig, cliConfig) {
|
190
|
-
|
191
|
-
|
164
|
+
_assignCLIConfigIfSupported('device-name', cliConfig.deviceName, deviceConfig, 'device');
|
165
|
+
_assignCLIConfigIfSupported('device-boot-args', cliConfig.deviceBootArgs, deviceConfig, 'bootArgs');
|
166
|
+
_assignCLIConfigIfSupported('headless', cliConfig.headless, deviceConfig, 'headless');
|
167
|
+
_assignCLIConfigIfSupported('force-adb-install', cliConfig.forceAdbInstall, deviceConfig, 'forceAdbInstall');
|
168
|
+
_assignCLIConfigIfSupported('gpu', cliConfig.gpu, deviceConfig, 'gpuMode');
|
169
|
+
_assignCLIConfigIfSupported('readonly-emu', cliConfig.readonlyEmu, deviceConfig, 'readonly');
|
170
|
+
}
|
171
|
+
|
172
|
+
function _assignCLIConfigIfSupported(argName, argValue, deviceConfig, propertyName) {
|
173
|
+
if (argValue === undefined) {
|
174
|
+
return;
|
192
175
|
}
|
193
176
|
|
194
177
|
const deviceType = deviceConfig.type;
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
log.warn(`--device-boot-args CLI override is not supported by device type = "${deviceType}" and will be ignored`);
|
200
|
-
}
|
178
|
+
const supportedDeviceTypesPrefixes = _supportedDeviceTypesPrefixes(argName);
|
179
|
+
if (!supportedDeviceTypesPrefixes.some((prefix) => deviceType.startsWith(prefix))) {
|
180
|
+
log.warn(`--${argName} CLI override is not supported by device type = "${deviceType}" and will be ignored`);
|
181
|
+
return;
|
201
182
|
}
|
202
183
|
|
203
|
-
|
204
|
-
|
205
|
-
deviceConfig.forceAdbInstall = cliConfig.forceAdbInstall;
|
206
|
-
} else {
|
207
|
-
log.warn(`--force-adb-install CLI override is not supported by device type = "${deviceType}" and will be ignored`);
|
208
|
-
}
|
209
|
-
}
|
184
|
+
deviceConfig[propertyName] = argValue;
|
185
|
+
}
|
210
186
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
readonly: cliConfig.readonlyEmu,
|
216
|
-
}, _.isUndefined);
|
187
|
+
function _supportedDeviceTypesPrefixes(argName) {
|
188
|
+
switch (argName) {
|
189
|
+
case 'device-name':
|
190
|
+
return [''];
|
217
191
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
192
|
+
case 'force-adb-install':
|
193
|
+
return ['android.'];
|
194
|
+
|
195
|
+
case 'gpu':
|
196
|
+
case 'readonly-emu':
|
197
|
+
return ['android.emulator'];
|
198
|
+
|
199
|
+
case 'device-boot-args':
|
200
|
+
case 'headless':
|
201
|
+
return ['ios.simulator', 'android.emulator'];
|
225
202
|
}
|
226
203
|
}
|
227
204
|
|
@@ -232,7 +209,6 @@ function unpackDeviceQuery(deviceConfig) {
|
|
232
209
|
}
|
233
210
|
|
234
211
|
switch (deviceConfig.type) {
|
235
|
-
case 'ios.none':
|
236
212
|
case 'ios.simulator':
|
237
213
|
if (_.includes(query, ',')) {
|
238
214
|
const [type, os] = _.split(query, /\s*,\s*/);
|
@@ -252,7 +228,6 @@ function unpackDeviceQuery(deviceConfig) {
|
|
252
228
|
}
|
253
229
|
|
254
230
|
const EXPECTED_DEVICE_MATCHER_PROPS = {
|
255
|
-
'ios.none': null,
|
256
231
|
'ios.simulator': ['type', 'name', 'id'],
|
257
232
|
'android.attached': ['adbName'],
|
258
233
|
'android.emulator': ['avdName'],
|