detox 19.9.0 → 20.0.1-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 → 20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.9.0/detox-19.9.0-sources.jar → 20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.9.0/detox-19.9.0.pom → 20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.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/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/reactnative/idlingresources/uimodule/RN66Workaround.kt +13 -4
- 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 +26 -20
- 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/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 +8 -66
- 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/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/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 +77 -30
- 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/Timer.js +14 -6
- package/{local-cli/utils/misc.js → src/utils/envUtils.js} +0 -9
- package/src/utils/environment.js +30 -15
- 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/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
@@ -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
|
|
@@ -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
|
|
@@ -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);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
2
2
|
const debug = require('../../utils/debug'); // debug utils, leave here even if unused
|
3
|
-
const { traceCall } = require('../../utils/trace');
|
3
|
+
const { traceCall, traceMethods } = require('../../utils/trace');
|
4
4
|
const wrapWithStackTraceCutter = require('../../utils/wrapWithStackTraceCutter');
|
5
5
|
|
6
6
|
const LaunchArgsEditor = require('./utils/LaunchArgsEditor');
|
@@ -14,7 +14,7 @@ class RuntimeDevice {
|
|
14
14
|
sessionConfig,
|
15
15
|
runtimeErrorComposer,
|
16
16
|
}, deviceDriver) {
|
17
|
-
|
17
|
+
const methodNames = [
|
18
18
|
'captureViewHierarchy',
|
19
19
|
'clearKeychain',
|
20
20
|
'disableSynchronization',
|
@@ -46,7 +46,10 @@ class RuntimeDevice {
|
|
46
46
|
'unmatchFace',
|
47
47
|
'unmatchFinger',
|
48
48
|
'unreverseTcpPort',
|
49
|
-
]
|
49
|
+
];
|
50
|
+
|
51
|
+
traceMethods(this, 'device', methodNames);
|
52
|
+
wrapWithStackTraceCutter(this, methodNames);
|
50
53
|
|
51
54
|
this._appsConfig = appsConfig;
|
52
55
|
this._behaviorConfig = behaviorConfig;
|
@@ -80,13 +83,6 @@ class RuntimeDevice {
|
|
80
83
|
return this._currentAppLaunchArgs;
|
81
84
|
}
|
82
85
|
|
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
86
|
async selectApp(name) {
|
91
87
|
if (name === undefined) {
|
92
88
|
throw this._errorComposer.cantSelectEmptyApp();
|
@@ -113,12 +109,71 @@ class RuntimeDevice {
|
|
113
109
|
}
|
114
110
|
|
115
111
|
async launchApp(params = {}, bundleId = this._bundleId) {
|
116
|
-
|
112
|
+
const payloadParams = ['url', 'userNotification', 'userActivity'];
|
113
|
+
const hasPayload = this._assertHasSingleParam(payloadParams, params);
|
114
|
+
const newInstance = params.newInstance !== undefined
|
115
|
+
? params.newInstance
|
116
|
+
: this._processes[bundleId] == null;
|
117
|
+
|
118
|
+
if (params.delete) {
|
119
|
+
await this.terminateApp(bundleId);
|
120
|
+
await this.uninstallApp();
|
121
|
+
await this.installApp();
|
122
|
+
} else if (newInstance) {
|
123
|
+
await this.terminateApp(bundleId);
|
124
|
+
}
|
125
|
+
|
126
|
+
const baseLaunchArgs = {
|
127
|
+
...this._currentAppLaunchArgs.get(),
|
128
|
+
...params.launchArgs,
|
129
|
+
};
|
130
|
+
|
131
|
+
if (params.url) {
|
132
|
+
baseLaunchArgs['detoxURLOverride'] = params.url;
|
133
|
+
if (params.sourceApp) {
|
134
|
+
baseLaunchArgs['detoxSourceAppOverride'] = params.sourceApp;
|
135
|
+
}
|
136
|
+
} else if (params.userNotification) {
|
137
|
+
this._createPayloadFileAndUpdatesParamsObject('userNotification', 'detoxUserNotificationDataURL', params, baseLaunchArgs);
|
138
|
+
} else if (params.userActivity) {
|
139
|
+
this._createPayloadFileAndUpdatesParamsObject('userActivity', 'detoxUserActivityDataURL', params, baseLaunchArgs);
|
140
|
+
}
|
141
|
+
|
142
|
+
if (params.permissions) {
|
143
|
+
await this.deviceDriver.setPermissions(bundleId, params.permissions);
|
144
|
+
}
|
145
|
+
|
146
|
+
if (params.disableTouchIndicators) {
|
147
|
+
baseLaunchArgs['detoxDisableTouchIndicators'] = true;
|
148
|
+
}
|
149
|
+
|
150
|
+
if (this._isAppRunning(bundleId) && hasPayload) {
|
151
|
+
await this.deviceDriver.deliverPayload({ ...(params), delayPayload: true });
|
152
|
+
}
|
153
|
+
|
154
|
+
if (this._behaviorConfig.launchApp === 'manual') {
|
155
|
+
this._processes[bundleId] = await this.deviceDriver.waitForAppLaunch(bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);
|
156
|
+
} else {
|
157
|
+
this._processes[bundleId] = await this.deviceDriver.launchApp(bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);
|
158
|
+
await this.deviceDriver.waitUntilReady();
|
159
|
+
await this.deviceDriver.waitForActive();
|
160
|
+
}
|
161
|
+
|
162
|
+
await this._emitter.emit('appReady', {
|
163
|
+
deviceId: this.deviceDriver.getExternalId(),
|
164
|
+
bundleId,
|
165
|
+
pid: this._processes[bundleId],
|
166
|
+
});
|
167
|
+
|
168
|
+
if (params.detoxUserNotificationDataURL) {
|
169
|
+
await this.deviceDriver.cleanupRandomDirectory(params.detoxUserNotificationDataURL);
|
170
|
+
}
|
171
|
+
|
172
|
+
if (params.detoxUserActivityDataURL) {
|
173
|
+
await this.deviceDriver.cleanupRandomDirectory(params.detoxUserActivityDataURL);
|
174
|
+
}
|
117
175
|
}
|
118
176
|
|
119
|
-
/**
|
120
|
-
* @deprecated
|
121
|
-
*/
|
122
177
|
async relaunchApp(params = {}, bundleId) {
|
123
178
|
if (params.newInstance === undefined) {
|
124
179
|
params['newInstance'] = true;
|
@@ -300,73 +355,6 @@ class RuntimeDevice {
|
|
300
355
|
}
|
301
356
|
return this._currentApp;
|
302
357
|
}
|
303
|
-
|
304
|
-
async _doLaunchApp(params, bundleId) {
|
305
|
-
const payloadParams = ['url', 'userNotification', 'userActivity'];
|
306
|
-
const hasPayload = this._assertHasSingleParam(payloadParams, params);
|
307
|
-
const newInstance = params.newInstance !== undefined
|
308
|
-
? params.newInstance
|
309
|
-
: this._processes[bundleId] == null;
|
310
|
-
|
311
|
-
if (params.delete) {
|
312
|
-
await this.terminateApp(bundleId);
|
313
|
-
await this.uninstallApp();
|
314
|
-
await this.installApp();
|
315
|
-
} else if (newInstance) {
|
316
|
-
await this.terminateApp(bundleId);
|
317
|
-
}
|
318
|
-
|
319
|
-
const baseLaunchArgs = {
|
320
|
-
...this._currentAppLaunchArgs.get(),
|
321
|
-
...params.launchArgs,
|
322
|
-
};
|
323
|
-
|
324
|
-
if (params.url) {
|
325
|
-
baseLaunchArgs['detoxURLOverride'] = params.url;
|
326
|
-
if (params.sourceApp) {
|
327
|
-
baseLaunchArgs['detoxSourceAppOverride'] = params.sourceApp;
|
328
|
-
}
|
329
|
-
} else if (params.userNotification) {
|
330
|
-
this._createPayloadFileAndUpdatesParamsObject('userNotification', 'detoxUserNotificationDataURL', params, baseLaunchArgs);
|
331
|
-
} else if (params.userActivity) {
|
332
|
-
this._createPayloadFileAndUpdatesParamsObject('userActivity', 'detoxUserActivityDataURL', params, baseLaunchArgs);
|
333
|
-
}
|
334
|
-
|
335
|
-
if (params.permissions) {
|
336
|
-
await this.deviceDriver.setPermissions(bundleId, params.permissions);
|
337
|
-
}
|
338
|
-
|
339
|
-
if (params.disableTouchIndicators) {
|
340
|
-
baseLaunchArgs['detoxDisableTouchIndicators'] = true;
|
341
|
-
}
|
342
|
-
|
343
|
-
if (this._isAppRunning(bundleId) && hasPayload) {
|
344
|
-
await this.deviceDriver.deliverPayload({ ...params, delayPayload: true });
|
345
|
-
}
|
346
|
-
|
347
|
-
if (this._behaviorConfig.launchApp === 'manual') {
|
348
|
-
this._processes[bundleId] = await this.deviceDriver.waitForAppLaunch(bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);
|
349
|
-
} else {
|
350
|
-
this._processes[bundleId] = await this.deviceDriver.launchApp(bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.languageAndLocale);
|
351
|
-
await this.deviceDriver.waitUntilReady();
|
352
|
-
await this.deviceDriver.waitForActive();
|
353
|
-
}
|
354
|
-
|
355
|
-
await this._emitter.emit('appReady', {
|
356
|
-
deviceId: this.deviceDriver.getExternalId(),
|
357
|
-
bundleId,
|
358
|
-
pid: this._processes[bundleId],
|
359
|
-
});
|
360
|
-
|
361
|
-
if(params.detoxUserNotificationDataURL) {
|
362
|
-
await this.deviceDriver.cleanupRandomDirectory(params.detoxUserNotificationDataURL);
|
363
|
-
}
|
364
|
-
|
365
|
-
if(params.detoxUserActivityDataURL) {
|
366
|
-
await this.deviceDriver.cleanupRandomDirectory(params.detoxUserActivityDataURL);
|
367
|
-
}
|
368
|
-
}
|
369
|
-
|
370
358
|
async _sendPayload(key, params) {
|
371
359
|
const payloadFilePath = this.deviceDriver.createPayloadFile(params);
|
372
360
|
const payload = {
|
@@ -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
|
};
|
@@ -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() {
|