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
@@ -0,0 +1,50 @@
|
|
1
|
+
const _ = require('lodash');
|
2
|
+
|
3
|
+
const { castLevel, defaultOptions } = require('../logger/DetoxLogger');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @param {object} opts
|
7
|
+
* @param {Detox.DetoxConfig} opts.globalConfig
|
8
|
+
* @param {Detox.DetoxConfiguration} opts.localConfig
|
9
|
+
* @param {*} opts.cliConfig
|
10
|
+
* @returns {Detox.DetoxLoggerConfig}
|
11
|
+
*/
|
12
|
+
function composeLoggerConfig(opts) {
|
13
|
+
const { globalConfig, localConfig, cliConfig } = opts;
|
14
|
+
|
15
|
+
return _.merge(
|
16
|
+
{
|
17
|
+
level: 'info',
|
18
|
+
overrideConsole: 'sandbox',
|
19
|
+
options: {
|
20
|
+
...defaultOptions,
|
21
|
+
prefixers: {
|
22
|
+
...defaultOptions.prefixers,
|
23
|
+
},
|
24
|
+
},
|
25
|
+
},
|
26
|
+
globalConfig.logger,
|
27
|
+
localConfig.logger,
|
28
|
+
adaptCLI(cliConfig),
|
29
|
+
);
|
30
|
+
}
|
31
|
+
|
32
|
+
function adaptCLI(cliConfig) {
|
33
|
+
const result = {};
|
34
|
+
|
35
|
+
if (cliConfig.loglevel !== undefined) {
|
36
|
+
result.level = castLevel(cliConfig.loglevel);
|
37
|
+
}
|
38
|
+
|
39
|
+
if (cliConfig.useCustomLogger !== undefined) {
|
40
|
+
result.overrideConsole = cliConfig.useCustomLogger ? 'all' : 'none';
|
41
|
+
}
|
42
|
+
|
43
|
+
if (cliConfig.noColor) {
|
44
|
+
result.options = { colors: false };
|
45
|
+
}
|
46
|
+
|
47
|
+
return result;
|
48
|
+
}
|
49
|
+
|
50
|
+
module.exports = composeLoggerConfig;
|
@@ -1,19 +1,79 @@
|
|
1
|
-
|
1
|
+
const os = require('os');
|
2
|
+
|
3
|
+
const _ = require('lodash');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @param {object} opts
|
7
|
+
* @param {Detox.DetoxConfig} opts.globalConfig
|
8
|
+
* @param {Detox.DetoxConfiguration} opts.localConfig
|
9
|
+
* @param {DetoxInternals.DetoxCLIConfig} opts.cliConfig
|
10
|
+
* @param {Record<string, any>} opts.testRunnerArgv
|
11
|
+
* @param {import('../errors/DetoxConfigErrorComposer')} opts.errorComposer
|
12
|
+
* @returns {Detox.DetoxTestRunnerConfig} opts.testRunnerArgv
|
13
|
+
*/
|
14
|
+
function composeRunnerConfig(opts) {
|
15
|
+
const globalConfig = opts.globalConfig.testRunner;
|
16
|
+
if (globalConfig != null && typeof globalConfig !== 'object') {
|
17
|
+
throw opts.errorComposer.invalidTestRunnerProperty(true);
|
18
|
+
}
|
19
|
+
|
20
|
+
const localConfig = opts.localConfig.testRunner;
|
21
|
+
if (localConfig != null && typeof localConfig !== 'object') {
|
22
|
+
throw opts.errorComposer.invalidTestRunnerProperty(false);
|
23
|
+
}
|
24
|
+
|
25
|
+
const cliConfig = opts.cliConfig;
|
26
|
+
|
27
|
+
/** @type {Detox.DetoxTestRunnerConfig} */
|
28
|
+
const merged = _.merge(
|
29
|
+
{
|
30
|
+
retries: 0,
|
31
|
+
inspectBrk: inspectBrkHookDefault,
|
32
|
+
jest: {
|
33
|
+
initTimeout: 300000,
|
34
|
+
reportSpecs: undefined,
|
35
|
+
reportWorkerAssign: true,
|
36
|
+
},
|
37
|
+
args: {
|
38
|
+
$0: 'jest',
|
39
|
+
_: [],
|
40
|
+
},
|
41
|
+
},
|
42
|
+
globalConfig,
|
43
|
+
localConfig,
|
44
|
+
cliConfig.retries != null ? { retries: cliConfig.retries } : null,
|
45
|
+
cliConfig.jestReportSpecs != null ? { jest: { reportSpecs: cliConfig.jestReportSpecs } } : null,
|
46
|
+
{
|
47
|
+
args: _.omitBy(opts.testRunnerArgv, hasEmptyPositionalArgs)
|
48
|
+
}
|
49
|
+
);
|
50
|
+
|
51
|
+
if (typeof merged.inspectBrk === 'function') {
|
52
|
+
if (cliConfig.inspectBrk) {
|
53
|
+
merged.inspectBrk(merged);
|
54
|
+
merged.inspectBrk = true;
|
55
|
+
} else {
|
56
|
+
merged.inspectBrk = false;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
return merged;
|
61
|
+
}
|
62
|
+
|
63
|
+
function hasEmptyPositionalArgs(value, key) {
|
64
|
+
return key === '_' ? _.isEmpty(value) : false;
|
65
|
+
}
|
66
|
+
|
2
67
|
/**
|
3
|
-
* @param {Detox.
|
4
|
-
* @param {Detox.DetoxConfigurationOverrides} localConfig
|
68
|
+
* @param {Detox.DetoxTestRunnerConfig} config
|
5
69
|
*/
|
6
|
-
function
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
runnerConfig: customRunnerConfig || defaultRunnerConfig,
|
14
|
-
specs: globalConfig.specs || 'e2e',
|
15
|
-
skipLegacyWorkersInjection: Boolean(globalConfig.skipLegacyWorkersInjection),
|
16
|
-
};
|
70
|
+
function inspectBrkHookDefault(config) {
|
71
|
+
config.args.$0 = /* istanbul ignore if */ os.platform() === 'win32'
|
72
|
+
? `node --inspect-brk ./node_modules/jest/bin/jest.js`
|
73
|
+
: `node --inspect-brk ./node_modules/.bin/jest`;
|
74
|
+
config.args.runInBand = true;
|
75
|
+
delete config.args.w;
|
76
|
+
delete config.args.workers;
|
17
77
|
}
|
18
78
|
|
19
79
|
module.exports = composeRunnerConfig;
|
@@ -1,11 +1,10 @@
|
|
1
1
|
const isValidWebsocketURL = require('../utils/isValidWebsocketURL');
|
2
|
-
const uuid = require('../utils/uuid');
|
3
2
|
|
4
3
|
/**
|
5
4
|
* @param {{
|
6
5
|
* cliConfig: Record<string, any>;
|
7
6
|
* globalConfig: Detox.DetoxConfig;
|
8
|
-
* localConfig: Detox.
|
7
|
+
* localConfig: Detox.DetoxConfiguration;
|
9
8
|
* errorComposer: import('../errors/DetoxConfigErrorComposer');
|
10
9
|
* }} options
|
11
10
|
*/
|
@@ -44,7 +43,6 @@ async function composeSessionConfig(options) {
|
|
44
43
|
|
45
44
|
const result = {
|
46
45
|
autoStart: !session.server,
|
47
|
-
sessionId: uuid.UUID(),
|
48
46
|
debugSynchronization: 10000,
|
49
47
|
|
50
48
|
...session,
|
@@ -8,22 +8,19 @@ const composeAppsConfig = require('./composeAppsConfig');
|
|
8
8
|
const composeArtifactsConfig = require('./composeArtifactsConfig');
|
9
9
|
const composeBehaviorConfig = require('./composeBehaviorConfig');
|
10
10
|
const composeDeviceConfig = require('./composeDeviceConfig');
|
11
|
+
const composeLoggerConfig = require('./composeLoggerConfig');
|
11
12
|
const composeRunnerConfig = require('./composeRunnerConfig');
|
12
13
|
const composeSessionConfig = require('./composeSessionConfig');
|
13
14
|
const loadExternalConfig = require('./loadExternalConfig');
|
14
15
|
const selectConfiguration = require('./selectConfiguration');
|
15
16
|
|
16
|
-
const hooks = {
|
17
|
-
UNSAFE_configReady: [],
|
18
|
-
};
|
19
|
-
|
20
17
|
async function composeDetoxConfig({
|
21
18
|
cwd = process.cwd(),
|
22
|
-
argv,
|
23
|
-
|
24
|
-
|
19
|
+
argv = undefined,
|
20
|
+
testRunnerArgv = undefined,
|
21
|
+
errorComposer = new DetoxConfigErrorComposer(),
|
22
|
+
override = undefined,
|
25
23
|
}) {
|
26
|
-
const errorComposer = new DetoxConfigErrorComposer();
|
27
24
|
const cliConfig = collectCliConfig({ argv });
|
28
25
|
const findupResult = await loadExternalConfig({
|
29
26
|
errorComposer,
|
@@ -45,11 +42,6 @@ async function composeDetoxConfig({
|
|
45
42
|
|
46
43
|
const { configurations } = globalConfig;
|
47
44
|
|
48
|
-
const runnerConfig = composeRunnerConfig({
|
49
|
-
globalConfig,
|
50
|
-
cliConfig,
|
51
|
-
});
|
52
|
-
|
53
45
|
const configurationName = selectConfiguration({
|
54
46
|
errorComposer,
|
55
47
|
globalConfig,
|
@@ -58,6 +50,18 @@ async function composeDetoxConfig({
|
|
58
50
|
|
59
51
|
const localConfig = configurations[configurationName];
|
60
52
|
|
53
|
+
if (localConfig['type']) {
|
54
|
+
throw errorComposer.configurationShouldNotUseLegacyFormat();
|
55
|
+
}
|
56
|
+
|
57
|
+
const runnerConfig = composeRunnerConfig({
|
58
|
+
globalConfig,
|
59
|
+
localConfig,
|
60
|
+
cliConfig,
|
61
|
+
testRunnerArgv,
|
62
|
+
errorComposer,
|
63
|
+
});
|
64
|
+
|
61
65
|
const deviceConfig = composeDeviceConfig({
|
62
66
|
errorComposer,
|
63
67
|
globalConfig,
|
@@ -84,7 +88,12 @@ async function composeDetoxConfig({
|
|
84
88
|
const behaviorConfig = composeBehaviorConfig({
|
85
89
|
globalConfig,
|
86
90
|
localConfig,
|
87
|
-
|
91
|
+
cliConfig,
|
92
|
+
});
|
93
|
+
|
94
|
+
const loggerConfig = composeLoggerConfig({
|
95
|
+
globalConfig,
|
96
|
+
localConfig,
|
88
97
|
cliConfig,
|
89
98
|
});
|
90
99
|
|
@@ -103,22 +112,14 @@ async function composeDetoxConfig({
|
|
103
112
|
configurationName,
|
104
113
|
deviceConfig,
|
105
114
|
errorComposer,
|
115
|
+
loggerConfig,
|
106
116
|
runnerConfig,
|
107
117
|
sessionConfig,
|
108
118
|
};
|
109
119
|
|
110
|
-
for (const fn of hooks.UNSAFE_configReady) {
|
111
|
-
await fn({ ...result, argv });
|
112
|
-
}
|
113
|
-
|
114
120
|
return result;
|
115
121
|
}
|
116
122
|
|
117
|
-
function hook(event, listener) {
|
118
|
-
hooks[event].push(listener);
|
119
|
-
}
|
120
|
-
|
121
123
|
module.exports = {
|
122
124
|
composeDetoxConfig,
|
123
|
-
hook,
|
124
125
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// @ts-nocheck
|
2
|
-
const {
|
2
|
+
const { traceMethods } = require('../../utils/trace');
|
3
3
|
|
4
4
|
class DeviceAllocator {
|
5
5
|
/**
|
@@ -7,6 +7,7 @@ class DeviceAllocator {
|
|
7
7
|
*/
|
8
8
|
constructor(allocationDriver) {
|
9
9
|
this._driver = allocationDriver;
|
10
|
+
traceMethods(this, 'device', ['allocate', 'free']);
|
10
11
|
}
|
11
12
|
|
12
13
|
/**
|
@@ -14,8 +15,7 @@ class DeviceAllocator {
|
|
14
15
|
* @return {Promise<DeviceCookie>}
|
15
16
|
*/
|
16
17
|
allocate(deviceConfig) {
|
17
|
-
return
|
18
|
-
this._driver.allocate(deviceConfig));
|
18
|
+
return this._driver.allocate(deviceConfig);
|
19
19
|
}
|
20
20
|
|
21
21
|
/**
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const _ = require('lodash');
|
3
3
|
|
4
|
-
const {
|
4
|
+
const { traceMethods } = require('../../../../../utils/trace');
|
5
5
|
const AndroidEmulatorCookie = require('../../../../cookies/AndroidEmulatorCookie');
|
6
6
|
const AllocationDriverBase = require('../../AllocationDriverBase');
|
7
7
|
|
@@ -22,6 +22,8 @@ class EmulatorAllocDriver extends AllocationDriverBase {
|
|
22
22
|
this._emulatorVersionResolver = emulatorVersionResolver;
|
23
23
|
this._emulatorLauncher = emulatorLauncher;
|
24
24
|
this._allocationHelper = allocationHelper;
|
25
|
+
|
26
|
+
traceMethods(this, 'device', ['_launchEmulator']);
|
25
27
|
}
|
26
28
|
|
27
29
|
/**
|
@@ -73,8 +75,7 @@ class EmulatorAllocDriver extends AllocationDriverBase {
|
|
73
75
|
|
74
76
|
async _launchEmulator(avdName, adbName, isRunning, options) {
|
75
77
|
try {
|
76
|
-
await
|
77
|
-
this._emulatorLauncher.launch(avdName, adbName, isRunning, options));
|
78
|
+
await this._emulatorLauncher.launch(avdName, adbName, isRunning, options);
|
78
79
|
} catch (e) {
|
79
80
|
await this._allocationHelper.deallocateDevice(adbName);
|
80
81
|
throw e;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const { DetoxRuntimeError } = require('../../../../../errors');
|
3
3
|
const retry = require('../../../../../utils/retry');
|
4
|
-
const {
|
4
|
+
const { traceMethods } = require('../../../../../utils/trace');
|
5
5
|
const DeviceLauncher = require('../../../../common/drivers/DeviceLauncher');
|
6
6
|
const { LaunchCommand } = require('../../../../common/drivers/android/emulator/exec/EmulatorExec');
|
7
7
|
|
@@ -14,6 +14,7 @@ class EmulatorLauncher extends DeviceLauncher {
|
|
14
14
|
super(eventEmitter);
|
15
15
|
this._adb = adb;
|
16
16
|
this._emulatorExec = emulatorExec;
|
17
|
+
traceMethods(this, 'device', ['_awaitEmulatorBoot']);
|
17
18
|
}
|
18
19
|
|
19
20
|
/**
|
@@ -63,11 +64,6 @@ class EmulatorLauncher extends DeviceLauncher {
|
|
63
64
|
}
|
64
65
|
|
65
66
|
async _awaitEmulatorBoot(adbName) {
|
66
|
-
await traceCall('awaitBoot', () =>
|
67
|
-
this._waitForBootToComplete(adbName));
|
68
|
-
}
|
69
|
-
|
70
|
-
async _waitForBootToComplete(adbName) {
|
71
67
|
await retry({ retries: 240, interval: 2500, shouldUnref: true }, async () => {
|
72
68
|
const isBootComplete = await this._adb.isBootComplete(adbName);
|
73
69
|
|
@@ -40,7 +40,6 @@ class GenyAllocDriver extends AllocationDriverBase {
|
|
40
40
|
const { adbName } = instance;
|
41
41
|
|
42
42
|
await this._adb.disableAndroidAnimations(adbName);
|
43
|
-
await this._adb.setWiFiToggle(adbName, true);
|
44
43
|
await this._adb.apiLevel(adbName);
|
45
44
|
return new GenycloudEmulatorCookie(instance);
|
46
45
|
}
|
@@ -36,7 +36,7 @@ class SimulatorAllocDriver extends AllocationDriverBase {
|
|
36
36
|
}
|
37
37
|
|
38
38
|
try {
|
39
|
-
await this._simulatorLauncher.launch(udid, deviceConfig.type, deviceConfig.bootArgs);
|
39
|
+
await this._simulatorLauncher.launch(udid, deviceConfig.type, deviceConfig.bootArgs, deviceConfig.headless);
|
40
40
|
} catch (e) {
|
41
41
|
await this._deviceRegistry.disposeDevice(udid);
|
42
42
|
throw e;
|
@@ -6,9 +6,9 @@ class SimulatorLauncher extends DeviceLauncher {
|
|
6
6
|
this._applesimutils = applesimutils;
|
7
7
|
}
|
8
8
|
|
9
|
-
async launch(udid, type, bootArgs) {
|
10
|
-
const coldBoot = await this._applesimutils.boot(udid, bootArgs);
|
11
|
-
await this._notifyBootEvent(udid, type, coldBoot);
|
9
|
+
async launch(udid, type, bootArgs, headless) {
|
10
|
+
const coldBoot = await this._applesimutils.boot(udid, bootArgs, headless);
|
11
|
+
await this._notifyBootEvent(udid, type, coldBoot, headless);
|
12
12
|
}
|
13
13
|
|
14
14
|
async shutdown(udid) {
|
@@ -11,8 +11,8 @@ class DeviceLauncher {
|
|
11
11
|
return this._eventEmitter.emit('shutdownDevice', { deviceId });
|
12
12
|
}
|
13
13
|
|
14
|
-
async _notifyBootEvent(deviceId, type, coldBoot) {
|
15
|
-
return this._eventEmitter.emit('bootDevice', { deviceId, type, coldBoot });
|
14
|
+
async _notifyBootEvent(deviceId, type, coldBoot, headless) {
|
15
|
+
return this._eventEmitter.emit('bootDevice', { deviceId, type, coldBoot, headless });
|
16
16
|
}
|
17
17
|
}
|
18
18
|
|
@@ -206,11 +206,6 @@ class ADB {
|
|
206
206
|
await this.shell(deviceId, `settings put global transition_animation_scale 0`);
|
207
207
|
}
|
208
208
|
|
209
|
-
async setWiFiToggle(deviceId, state) {
|
210
|
-
const value = (state === true ? 'enable' : 'disable');
|
211
|
-
await this.shell(deviceId, `svc wifi ${value}`);
|
212
|
-
}
|
213
|
-
|
214
209
|
async screencap(deviceId, path) {
|
215
210
|
await this.shell(deviceId, `screencap ${path}`);
|
216
211
|
}
|
@@ -1,18 +1,13 @@
|
|
1
|
-
const
|
1
|
+
const session = () => require('../../../../../../../internals').session;
|
2
2
|
|
3
3
|
class GenyInstanceNaming {
|
4
|
-
constructor(nowProvider = () => Date.now()) {
|
5
|
-
this.uniqueSessionId = Number(process.env.DETOX_START_TIMESTAMP);
|
6
|
-
this.nowProvider = nowProvider;
|
7
|
-
this._workerId = getWorkerId() || (this.nowProvider() - this.uniqueSessionId);
|
8
|
-
}
|
9
|
-
|
10
4
|
generateName() {
|
11
|
-
|
5
|
+
const { id, workerId } = session();
|
6
|
+
return `Detox.${id}.${workerId}`;
|
12
7
|
}
|
13
8
|
|
14
9
|
isFamilial(name) {
|
15
|
-
return name.
|
10
|
+
return name === this.generateName();
|
16
11
|
}
|
17
12
|
}
|
18
13
|
|
@@ -42,20 +42,27 @@ class AppleSimUtils {
|
|
42
42
|
/***
|
43
43
|
* Boots the simulator if it is not booted already.
|
44
44
|
*
|
45
|
-
* @param {String} udid
|
46
|
-
* @
|
45
|
+
* @param {String} udid iOS Simulator UDID.
|
46
|
+
* @param {String} deviceBootArgs simctl boot command arguments.
|
47
|
+
* @param {Boolean} headless If false, opens the Simulator app after the Simulator has booted.
|
48
|
+
* @returns {Promise<boolean>} true, if device has been booted up from the shutdown state.
|
47
49
|
*/
|
48
|
-
async boot(udid, deviceBootArgs = '') {
|
50
|
+
async boot(udid, deviceBootArgs = '', headless = false) {
|
49
51
|
const isBooted = await this.isBooted(udid);
|
50
52
|
|
51
|
-
if (
|
52
|
-
|
53
|
-
await this._execSimctl({ cmd: `boot ${udid} ${deviceBootArgs}`, statusLogs, retries: 10 });
|
54
|
-
await this._execSimctl({ cmd: `bootstatus ${udid}`, retries: 1 });
|
55
|
-
return true;
|
53
|
+
if (isBooted) {
|
54
|
+
return false;
|
56
55
|
}
|
57
56
|
|
58
|
-
|
57
|
+
const statusLogs = { trying: `Booting device ${udid}...` };
|
58
|
+
await this._execSimctl({ cmd: `boot ${udid} ${deviceBootArgs}`, statusLogs, retries: 10 });
|
59
|
+
await this._execSimctl({ cmd: `bootstatus ${udid}`, retries: 1 });
|
60
|
+
|
61
|
+
if (!headless) {
|
62
|
+
await this._openSimulatorApp(udid);
|
63
|
+
}
|
64
|
+
|
65
|
+
return true;
|
59
66
|
}
|
60
67
|
|
61
68
|
async isBooted(udid) {
|
@@ -72,6 +79,24 @@ class AppleSimUtils {
|
|
72
79
|
return device;
|
73
80
|
}
|
74
81
|
|
82
|
+
async _openSimulatorApp(udid) {
|
83
|
+
try {
|
84
|
+
await childProcess.execWithRetriesAndLogs(`open -a Simulator --args -CurrentDeviceUDID ${udid}`, { retries: 0 });
|
85
|
+
} catch (error) {
|
86
|
+
this._logUnableToOpenSimulator();
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
_logUnableToOpenSimulator() {
|
91
|
+
log.warn(
|
92
|
+
`Unable to open the Simulator app. Please make sure you have Xcode and iOS Simulator installed ` +
|
93
|
+
`(https://developer.apple.com/xcode/). In case you already have the latest Xcode version installed, ` +
|
94
|
+
`try run the command: \`sudo xcode-select -s /Applications/Xcode.app\`. If you are running tests from CI, ` +
|
95
|
+
`we recommend running them with "--headless" device configuration (see: ` +
|
96
|
+
`https://wix.github.io/Detox/docs/next/api/configuration/#device-configurations).`
|
97
|
+
);
|
98
|
+
}
|
99
|
+
|
75
100
|
/***
|
76
101
|
* @param deviceInfo - an item in output of `applesimutils --list`
|
77
102
|
* @returns {Promise<string>} UDID of a new device
|
@@ -15,7 +15,7 @@ class GenyGlobalLifecycleHandler {
|
|
15
15
|
async globalInit() {
|
16
16
|
onSignalExit((code, signal) => {
|
17
17
|
if (signal) {
|
18
|
-
const { rawDevices
|
18
|
+
const { rawDevices } = this._deviceCleanupRegistry.readRegisteredDevicesUNSAFE();
|
19
19
|
const instanceHandles = rawDevicesToInstanceHandles(rawDevices);
|
20
20
|
if (instanceHandles.length) {
|
21
21
|
reportGlobalCleanupSummary(instanceHandles);
|