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
@@ -1,39 +0,0 @@
|
|
1
|
-
const SpecReporter = require('./SpecReporterImpl');
|
2
|
-
|
3
|
-
/***
|
4
|
-
* @see {@link https://jasmine.github.io/api/2.9/Reporter.html}
|
5
|
-
*/
|
6
|
-
class SpecReporterJasmine {
|
7
|
-
constructor() {
|
8
|
-
this._specReporter = new SpecReporter();
|
9
|
-
}
|
10
|
-
|
11
|
-
suiteStarted(suiteInfo) {
|
12
|
-
this._specReporter.onSuiteStart(suiteInfo);
|
13
|
-
}
|
14
|
-
|
15
|
-
suiteDone() {
|
16
|
-
this._specReporter.onSuiteEnd();
|
17
|
-
}
|
18
|
-
|
19
|
-
specStarted(specInfo) {
|
20
|
-
this._specReporter.onTestStart(specInfo);
|
21
|
-
}
|
22
|
-
|
23
|
-
specDone(specResult) {
|
24
|
-
let result;
|
25
|
-
if (specResult.status === 'disabled') {
|
26
|
-
result = 'skipped';
|
27
|
-
} else if (specResult.status === 'failed') {
|
28
|
-
result = 'failed';
|
29
|
-
} else if (specResult.pendingReason) {
|
30
|
-
result = 'pending';
|
31
|
-
} else {
|
32
|
-
result = 'success';
|
33
|
-
}
|
34
|
-
|
35
|
-
this._specReporter.onTestEnd(specResult, result);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
module.exports = SpecReporterJasmine;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
const WorkerAssignReporter = require('./WorkerAssignReporterImpl');
|
2
|
-
|
3
|
-
class WorkerAssignReporterCircus {
|
4
|
-
constructor({ detox }) {
|
5
|
-
this._reporter = new WorkerAssignReporter(detox);
|
6
|
-
}
|
7
|
-
|
8
|
-
run_describe_start(event) {
|
9
|
-
const { describeBlock } = event;
|
10
|
-
|
11
|
-
if (describeBlock.parent && describeBlock.parent.parent === undefined) {
|
12
|
-
this._reporter.report(describeBlock.name);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
module.exports = WorkerAssignReporterCircus;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
const chalk = require('chalk').default;
|
2
|
-
const _ = require('lodash');
|
3
|
-
|
4
|
-
const log = require('../../src/utils/logger').child();
|
5
|
-
|
6
|
-
class WorkerAssignReporterImpl {
|
7
|
-
constructor(detox) {
|
8
|
-
this.device = detox && detox.device;
|
9
|
-
}
|
10
|
-
|
11
|
-
report(workerName) {
|
12
|
-
const deviceName = _.attempt(() => this.device.name);
|
13
|
-
const formattedDeviceName = _.isError(deviceName)
|
14
|
-
? chalk.redBright('undefined')
|
15
|
-
: chalk.blueBright(deviceName);
|
16
|
-
|
17
|
-
log.info({ event: 'WORKER_ASSIGN' }, `${chalk.whiteBright(workerName)} is assigned to ${formattedDeviceName}`);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
module.exports = WorkerAssignReporterImpl;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
const path = require('path');
|
2
|
-
|
3
|
-
const WorkerAssignReporter = require('./WorkerAssignReporterImpl');
|
4
|
-
|
5
|
-
class WorkerAssignReporterJasmine {
|
6
|
-
constructor({ detox }) {
|
7
|
-
this._reporter = new WorkerAssignReporter(detox);
|
8
|
-
}
|
9
|
-
|
10
|
-
suiteStarted(suiteInfo) {
|
11
|
-
const workerName = path.basename(suiteInfo.testPath);
|
12
|
-
this._reporter.report(workerName);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
module.exports = WorkerAssignReporterJasmine;
|
@@ -1,206 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
const maybeNodeEnvironment = require('jest-environment-node'); // eslint-disable-line node/no-extraneous-require
|
3
|
-
const NodeEnvironment = maybeNodeEnvironment.default || maybeNodeEnvironment;
|
4
|
-
|
5
|
-
const DetoxError = require('../../src/errors/DetoxError');
|
6
|
-
const Timer = require('../../src/utils/Timer');
|
7
|
-
|
8
|
-
const DetoxCoreListener = require('./listeners/DetoxCoreListener');
|
9
|
-
const DetoxInitErrorListener = require('./listeners/DetoxInitErrorListener');
|
10
|
-
const assertExistingContext = require('./utils/assertExistingContext');
|
11
|
-
const assertJestCircus26 = require('./utils/assertJestCircus26');
|
12
|
-
const wrapErrorWithNoopLifecycle = require('./utils/wrapErrorWithNoopLifecycle');
|
13
|
-
|
14
|
-
const SYNC_CIRCUS_EVENTS = new Set([
|
15
|
-
'start_describe_definition',
|
16
|
-
'finish_describe_definition',
|
17
|
-
'add_hook',
|
18
|
-
'add_test',
|
19
|
-
'error',
|
20
|
-
]);
|
21
|
-
|
22
|
-
/**
|
23
|
-
* @see https://www.npmjs.com/package/jest-circus#overview
|
24
|
-
*/
|
25
|
-
class DetoxCircusEnvironment extends NodeEnvironment {
|
26
|
-
constructor(config, context) {
|
27
|
-
super(assertJestCircus26(config), assertExistingContext(context));
|
28
|
-
|
29
|
-
/** @private */
|
30
|
-
this._timer = null;
|
31
|
-
/** @private */
|
32
|
-
this._listenerFactories = {
|
33
|
-
DetoxInitErrorListener,
|
34
|
-
DetoxCoreListener,
|
35
|
-
};
|
36
|
-
/** @private */
|
37
|
-
this._calledDetoxInit = false;
|
38
|
-
/** @private */
|
39
|
-
this._calledDetoxCleanup = false;
|
40
|
-
/** @protected */
|
41
|
-
this.testPath = context.testPath;
|
42
|
-
/** @protected */
|
43
|
-
this.testEventListeners = [];
|
44
|
-
/** @protected */
|
45
|
-
this.initTimeout = 300000;
|
46
|
-
}
|
47
|
-
|
48
|
-
async setup() {
|
49
|
-
await super.setup();
|
50
|
-
|
51
|
-
this.global.detox = require('../../src')
|
52
|
-
._setGlobal(this.global)
|
53
|
-
._suppressLoggingInitErrors();
|
54
|
-
}
|
55
|
-
|
56
|
-
async teardown() {
|
57
|
-
try {
|
58
|
-
if (this._calledDetoxInit && !this._calledDetoxCleanup) {
|
59
|
-
await this._runEmergencyTeardown();
|
60
|
-
}
|
61
|
-
} finally {
|
62
|
-
await super.teardown();
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
get detox() {
|
67
|
-
return this.global.detox;
|
68
|
-
}
|
69
|
-
|
70
|
-
async handleTestEvent(event, state) {
|
71
|
-
const { name } = event;
|
72
|
-
|
73
|
-
if (SYNC_CIRCUS_EVENTS.has(name)) {
|
74
|
-
return this._handleTestEventSync(event, state);
|
75
|
-
}
|
76
|
-
|
77
|
-
this._timer = new Timer({
|
78
|
-
description: `handling jest-circus "${name}" event`,
|
79
|
-
timeout: name === 'setup' ? this.initTimeout : state.testTimeout,
|
80
|
-
});
|
81
|
-
|
82
|
-
try {
|
83
|
-
if (name === 'setup') {
|
84
|
-
await this._onSetup(state);
|
85
|
-
}
|
86
|
-
|
87
|
-
for (const listener of this.testEventListeners) {
|
88
|
-
if (typeof listener[name] === 'function') {
|
89
|
-
try {
|
90
|
-
await this._timer.run(() => listener[name](event, state));
|
91
|
-
} catch (listenerError) {
|
92
|
-
this._logError(listenerError);
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
if (name === 'teardown') {
|
98
|
-
await this._onTeardown(state);
|
99
|
-
}
|
100
|
-
} finally {
|
101
|
-
this._timer.dispose();
|
102
|
-
this._timer = null;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
_handleTestEventSync(event, state) {
|
107
|
-
const { name } = event;
|
108
|
-
|
109
|
-
for (const listener of this.testEventListeners) {
|
110
|
-
if (typeof listener[name] === 'function') {
|
111
|
-
listener[name](event, state);
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
async _onSetup(state) {
|
117
|
-
let detox;
|
118
|
-
|
119
|
-
try {
|
120
|
-
detox = await this._timer.run(async () => {
|
121
|
-
try {
|
122
|
-
this._calledDetoxInit = true;
|
123
|
-
return await this.initDetox();
|
124
|
-
} catch (actualError) {
|
125
|
-
state.unhandledErrors.push(actualError);
|
126
|
-
this._logError(actualError);
|
127
|
-
throw actualError;
|
128
|
-
}
|
129
|
-
});
|
130
|
-
} catch (maybeActualError) {
|
131
|
-
if (!state.unhandledErrors.includes(maybeActualError)) {
|
132
|
-
const timeoutError = maybeActualError;
|
133
|
-
state.unhandledErrors.push(timeoutError);
|
134
|
-
this._logError(timeoutError);
|
135
|
-
}
|
136
|
-
|
137
|
-
detox = wrapErrorWithNoopLifecycle(maybeActualError);
|
138
|
-
} finally {
|
139
|
-
this._timer.reset(state.testTimeout);
|
140
|
-
}
|
141
|
-
|
142
|
-
this._instantiateListeners(detox);
|
143
|
-
}
|
144
|
-
|
145
|
-
_instantiateListeners(detoxInstance) {
|
146
|
-
for (const Listener of Object.values(this._listenerFactories)) {
|
147
|
-
this.testEventListeners.push(new Listener({
|
148
|
-
detox: detoxInstance,
|
149
|
-
env: this,
|
150
|
-
}));
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
async _onTeardown(state) {
|
155
|
-
try {
|
156
|
-
this._calledDetoxCleanup = true;
|
157
|
-
await this._timer.run(() => this.cleanupDetox());
|
158
|
-
} catch (cleanupError) {
|
159
|
-
state.unhandledErrors.push(cleanupError);
|
160
|
-
this._logError(cleanupError);
|
161
|
-
}
|
162
|
-
}
|
163
|
-
|
164
|
-
async _runEmergencyTeardown() {
|
165
|
-
this._timer = new Timer({
|
166
|
-
description: `handling environment teardown`,
|
167
|
-
timeout: this.initTimeout,
|
168
|
-
});
|
169
|
-
|
170
|
-
try {
|
171
|
-
await this._timer.run(() => this.cleanupDetox());
|
172
|
-
} catch (cleanupError) {
|
173
|
-
this._logError(cleanupError);
|
174
|
-
} finally {
|
175
|
-
this._timer.dispose();
|
176
|
-
this._timer = null;
|
177
|
-
}
|
178
|
-
}
|
179
|
-
|
180
|
-
/** @private */
|
181
|
-
get _logger() {
|
182
|
-
return require('../../src/utils/logger');
|
183
|
-
}
|
184
|
-
|
185
|
-
/** @private */
|
186
|
-
_logError(e) {
|
187
|
-
this._logger.error(DetoxError.format(e));
|
188
|
-
}
|
189
|
-
|
190
|
-
/** @protected */
|
191
|
-
async initDetox() {
|
192
|
-
return this.detox.init();
|
193
|
-
}
|
194
|
-
|
195
|
-
/** @protected */
|
196
|
-
async cleanupDetox() {
|
197
|
-
return this.detox.cleanup();
|
198
|
-
}
|
199
|
-
|
200
|
-
/** @protected */
|
201
|
-
registerListeners(map) {
|
202
|
-
Object.assign(this._listenerFactories, map);
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
module.exports = DetoxCircusEnvironment;
|
@@ -1,39 +0,0 @@
|
|
1
|
-
const fs = require('fs');
|
2
|
-
const path = require('path');
|
3
|
-
|
4
|
-
const DetoxRuntimeError = require('../../../src/errors/DetoxRuntimeError');
|
5
|
-
|
6
|
-
function assertJestCircus26(maybeProjectConfig) {
|
7
|
-
const projectConfig = maybeProjectConfig.projectConfig || maybeProjectConfig;
|
8
|
-
|
9
|
-
if (!/jest-circus/.test(projectConfig.testRunner)) {
|
10
|
-
throw new DetoxRuntimeError('Cannot run tests without "jest-circus" npm package, exiting.');
|
11
|
-
}
|
12
|
-
|
13
|
-
const circusPackageJson = path.join(path.dirname(projectConfig.testRunner), 'package.json');
|
14
|
-
if (!fs.existsSync(circusPackageJson)) {
|
15
|
-
throw new DetoxRuntimeError('Check that you have an installed copy of "jest-circus" npm package, exiting.');
|
16
|
-
}
|
17
|
-
|
18
|
-
const circusVersion = require(circusPackageJson).version || '';
|
19
|
-
const [major, minor, patch] = circusVersion.split('.');
|
20
|
-
if (major < 26) {
|
21
|
-
throw new DetoxRuntimeError(
|
22
|
-
`Cannot use older versions of "jest-circus", exiting.\n` +
|
23
|
-
`You have jest-circus@${circusVersion}. Update to ^26.0.0 or newer.`
|
24
|
-
);
|
25
|
-
}
|
26
|
-
|
27
|
-
if (major == 26 && minor == 5 && patch < 2) {
|
28
|
-
throw new DetoxRuntimeError(
|
29
|
-
`You have jest-circus@${circusVersion} currently installed.\n` +
|
30
|
-
`Unfortunately, it is incompatible with Detox due to this critical issue:\n\n` +
|
31
|
-
`https://github.com/wix/Detox/issues/2390\n\n` +
|
32
|
-
`Please update to jest-circus@^26.5.2 (or newer) to proceed.`
|
33
|
-
);
|
34
|
-
}
|
35
|
-
|
36
|
-
return maybeProjectConfig;
|
37
|
-
}
|
38
|
-
|
39
|
-
module.exports = assertJestCircus26;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
const _ = require('lodash');
|
2
|
-
|
3
|
-
const lifecycleSymbols = require('../../integration').lifecycle;
|
4
|
-
|
5
|
-
function wrapErrorWithNoopLifecycle(error) {
|
6
|
-
const wrapper = { error };
|
7
|
-
for (const symbol of Object.values(lifecycleSymbols)) {
|
8
|
-
wrapper[symbol] = _.noop;
|
9
|
-
}
|
10
|
-
|
11
|
-
return wrapper;
|
12
|
-
}
|
13
|
-
|
14
|
-
module.exports = wrapErrorWithNoopLifecycle;
|
package/src/DetoxConstants.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module.exports = Object.freeze({
|
2
|
-
'userNotificationTriggers': {
|
3
|
-
'push': 'push',
|
4
|
-
'calendar': 'calendar',
|
5
|
-
'timeInterval': 'timeInterval',
|
6
|
-
'location': 'location'
|
7
|
-
},
|
8
|
-
'userActivityTypes': {
|
9
|
-
'searchableItem': 'com.apple.corespotlightitem',
|
10
|
-
'browsingWeb': 'NSUserActivityTypeBrowsingWeb',
|
11
|
-
},
|
12
|
-
'searchableItemActivityIdentifier': 'kCSSearchableItemActivityIdentifier'
|
13
|
-
});
|
@@ -1,140 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
const funpermaproxy = require('funpermaproxy');
|
3
|
-
|
4
|
-
const Detox = require('./Detox');
|
5
|
-
const DetoxConstants = require('./DetoxConstants');
|
6
|
-
const configuration = require('./configuration');
|
7
|
-
const logger = require('./utils/logger');
|
8
|
-
const log = logger.child({ __filename });
|
9
|
-
const { trace, traceCall } = require('./utils/trace');
|
10
|
-
|
11
|
-
const _detox = Symbol('detox');
|
12
|
-
const _shouldLogInitError = Symbol('shouldLogInitError');
|
13
|
-
|
14
|
-
class DetoxExportWrapper {
|
15
|
-
constructor() {
|
16
|
-
this[_detox] = Detox.none;
|
17
|
-
this[_shouldLogInitError] = true;
|
18
|
-
|
19
|
-
this.init = this.init.bind(this);
|
20
|
-
this.cleanup = this.cleanup.bind(this);
|
21
|
-
|
22
|
-
this.DetoxConstants = DetoxConstants;
|
23
|
-
|
24
|
-
this._definePassthroughMethod('beforeEach');
|
25
|
-
this._definePassthroughMethod('afterEach');
|
26
|
-
this._definePassthroughMethod('suiteStart');
|
27
|
-
this._definePassthroughMethod('suiteEnd');
|
28
|
-
|
29
|
-
this._definePassthroughMethod('element');
|
30
|
-
this._definePassthroughMethod('expect');
|
31
|
-
this._definePassthroughMethod('waitFor');
|
32
|
-
|
33
|
-
this._defineProxy('by');
|
34
|
-
this._defineProxy('device');
|
35
|
-
this._defineProxy('web');
|
36
|
-
|
37
|
-
this.trace = trace;
|
38
|
-
this.traceCall = traceCall;
|
39
|
-
}
|
40
|
-
|
41
|
-
async init(configOverride, userParams) {
|
42
|
-
let configError, exposeGlobals, resolvedConfig;
|
43
|
-
|
44
|
-
trace.init();
|
45
|
-
logger.reinitialize(Detox.global);
|
46
|
-
|
47
|
-
try {
|
48
|
-
resolvedConfig = await configuration.composeDetoxConfig({
|
49
|
-
override: configOverride,
|
50
|
-
userParams,
|
51
|
-
});
|
52
|
-
|
53
|
-
exposeGlobals = resolvedConfig.behaviorConfig.init.exposeGlobals;
|
54
|
-
} catch (err) {
|
55
|
-
configError = err;
|
56
|
-
exposeGlobals = true;
|
57
|
-
}
|
58
|
-
|
59
|
-
try {
|
60
|
-
if (exposeGlobals) {
|
61
|
-
Detox.none.initContext(Detox.global);
|
62
|
-
}
|
63
|
-
|
64
|
-
if (configError) {
|
65
|
-
throw configError;
|
66
|
-
}
|
67
|
-
|
68
|
-
this[_detox] = new Detox(resolvedConfig);
|
69
|
-
await traceCall('detoxInit', () => this[_detox].init());
|
70
|
-
Detox.none.setError(null);
|
71
|
-
|
72
|
-
return this[_detox];
|
73
|
-
} catch (err) {
|
74
|
-
if (this[_shouldLogInitError]) {
|
75
|
-
log.error({ event: 'DETOX_INIT_ERROR' }, '\n', err);
|
76
|
-
}
|
77
|
-
|
78
|
-
Detox.none.setError(err);
|
79
|
-
throw err;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
async cleanup() {
|
84
|
-
Detox.none.cleanupContext(Detox.global);
|
85
|
-
|
86
|
-
if (this[_detox] !== Detox.none) {
|
87
|
-
await this[_detox].cleanup();
|
88
|
-
this[_detox] = Detox.none;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
_definePassthroughMethod(name) {
|
93
|
-
this[name] = (...args) => {
|
94
|
-
return this[_detox][name](...args);
|
95
|
-
};
|
96
|
-
}
|
97
|
-
|
98
|
-
_defineProxy(name) {
|
99
|
-
this[name] = funpermaproxy(() => this[_detox][name]);
|
100
|
-
}
|
101
|
-
|
102
|
-
/** Use for test runners with sandboxed global */
|
103
|
-
_setGlobal(global) {
|
104
|
-
Detox.global = global;
|
105
|
-
return this;
|
106
|
-
}
|
107
|
-
|
108
|
-
/** @internal */
|
109
|
-
_suppressLoggingInitErrors() {
|
110
|
-
this[_shouldLogInitError] = false;
|
111
|
-
return this;
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
DetoxExportWrapper.prototype.hook = configuration.hook;
|
116
|
-
|
117
|
-
DetoxExportWrapper.prototype.globalInit = async function() {
|
118
|
-
try {
|
119
|
-
// TODO This can only work in Jest, where config info etc. is available globally through env vars rather
|
120
|
-
// than argv (e.g. in Mocha) -- which we don't have available here.
|
121
|
-
// We will resolve this, ultimately, in https://github.com/wix/Detox/issues/2894 (DAS project), where
|
122
|
-
// this whole hack would be removed altogether.
|
123
|
-
const configs = await configuration.composeDetoxConfig({});
|
124
|
-
await Detox.globalInit(configs);
|
125
|
-
} catch (error) {
|
126
|
-
log.warn({ event: 'GLOBAL_INIT' }, 'An error occurred!');
|
127
|
-
throw error;
|
128
|
-
}
|
129
|
-
};
|
130
|
-
|
131
|
-
DetoxExportWrapper.prototype.globalCleanup = async function() {
|
132
|
-
try {
|
133
|
-
const configs = await configuration.composeDetoxConfig({});
|
134
|
-
await Detox.globalCleanup(configs);
|
135
|
-
} catch (error) {
|
136
|
-
log.warn({ event: 'GLOBAL_CLEANUP' }, 'An error occurred!', error);
|
137
|
-
}
|
138
|
-
};
|
139
|
-
|
140
|
-
module.exports = DetoxExportWrapper;
|
@@ -1,95 +0,0 @@
|
|
1
|
-
const fs = require('fs-extra');
|
2
|
-
const _noop = require('lodash/noop');
|
3
|
-
|
4
|
-
const ChromeTracingExporter = require('../../utils/ChromeTracingExporter');
|
5
|
-
const fakeTimestampsProvider = require('../../utils/fakeTimestampsProvider');
|
6
|
-
const { trace } = require('../../utils/trace');
|
7
|
-
const FileArtifact = require('../templates/artifact/FileArtifact');
|
8
|
-
const ArtifactPlugin = require('../templates/plugin/ArtifactPlugin');
|
9
|
-
|
10
|
-
const traceNoop = {
|
11
|
-
startSection: _noop,
|
12
|
-
endSection: _noop,
|
13
|
-
};
|
14
|
-
|
15
|
-
const CONTEXT_TYPES = {
|
16
|
-
TEST: 'test',
|
17
|
-
DESCRIBE: 'describe'
|
18
|
-
};
|
19
|
-
|
20
|
-
class TimelineArtifactPlugin extends ArtifactPlugin {
|
21
|
-
constructor(config) {
|
22
|
-
super(config);
|
23
|
-
this._useFakeTimestamps = config.useFakeTimestamps;
|
24
|
-
|
25
|
-
const threadId = process.env.JEST_WORKER_ID || process.pid;
|
26
|
-
this._trace = this.enabled ? trace : traceNoop;
|
27
|
-
this._traceExporter = new ChromeTracingExporter({
|
28
|
-
process: { id: 0, name: 'detox' },
|
29
|
-
thread: { id: threadId, name: `Worker #${threadId}` },
|
30
|
-
});
|
31
|
-
}
|
32
|
-
|
33
|
-
async onBootDevice(event) {
|
34
|
-
this._deviceName = event.deviceId;
|
35
|
-
return super.onBootDevice(event);
|
36
|
-
}
|
37
|
-
|
38
|
-
async onRunDescribeStart(suite) {
|
39
|
-
const sectionName = (suite.name === 'ROOT_DESCRIBE_BLOCK' ? this._deviceName : suite.name);
|
40
|
-
this._trace.startSection(sectionName, { context: CONTEXT_TYPES.DESCRIBE });
|
41
|
-
await super.onRunDescribeStart(suite);
|
42
|
-
}
|
43
|
-
|
44
|
-
async onRunDescribeFinish(suite) {
|
45
|
-
const sectionName = (suite.name === 'ROOT_DESCRIBE_BLOCK' ? this._deviceName : suite.name);
|
46
|
-
this._trace.endSection(sectionName, { context: CONTEXT_TYPES.DESCRIBE });
|
47
|
-
await super.onRunDescribeFinish(suite);
|
48
|
-
}
|
49
|
-
|
50
|
-
async onTestStart(testSummary) {
|
51
|
-
this._trace.startSection(testSummary.title, { context: CONTEXT_TYPES.TEST });
|
52
|
-
await super.onTestStart(testSummary);
|
53
|
-
}
|
54
|
-
|
55
|
-
async onTestDone(testSummary) {
|
56
|
-
this._trace.endSection(testSummary.title, { status: testSummary.status, context: CONTEXT_TYPES.TEST });
|
57
|
-
await super.onTestDone(testSummary);
|
58
|
-
}
|
59
|
-
|
60
|
-
async onBeforeCleanup() {
|
61
|
-
this._deviceName = null;
|
62
|
-
|
63
|
-
if (!this.enabled) {
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
|
67
|
-
const traceLogPath = await this.api.preparePathForArtifact(`detox.trace.json`);
|
68
|
-
const append = await this._logFileExists(traceLogPath);
|
69
|
-
const events = this._useFakeTimestamps ? this._transformEventTimestamps(trace.events) : trace.events;
|
70
|
-
const data = this._traceExporter.export(events, append);
|
71
|
-
|
72
|
-
const fileArtifact = new FileArtifact({ temporaryData: data });
|
73
|
-
await fileArtifact.save(traceLogPath, { append });
|
74
|
-
}
|
75
|
-
|
76
|
-
async _logFileExists(traceLogPath) {
|
77
|
-
return fs.access(traceLogPath).then(() => true).catch(() => false);
|
78
|
-
}
|
79
|
-
|
80
|
-
_transformEventTimestamps(events) {
|
81
|
-
return events.map((event) => ({
|
82
|
-
...event,
|
83
|
-
ts: fakeTimestampsProvider(),
|
84
|
-
}));
|
85
|
-
}
|
86
|
-
|
87
|
-
/** @param {string} config */
|
88
|
-
static parseConfig(config) {
|
89
|
-
return {
|
90
|
-
enabled: config === 'all',
|
91
|
-
};
|
92
|
-
}
|
93
|
-
}
|
94
|
-
|
95
|
-
module.exports = TimelineArtifactPlugin;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
const AllocationDriverBase = require('./AllocationDriverBase');
|
2
|
-
|
3
|
-
class NoneAllocDriver extends AllocationDriverBase {
|
4
|
-
async allocate(deviceQuery) { // eslint-disable-line no-unused-vars
|
5
|
-
return null;
|
6
|
-
}
|
7
|
-
async free(cookie, options) {} // eslint-disable-line no-unused-vars
|
8
|
-
}
|
9
|
-
|
10
|
-
module.exports = NoneAllocDriver;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
const DeviceAllocatorFactory = require('./base');
|
3
|
-
|
4
|
-
class None extends DeviceAllocatorFactory {
|
5
|
-
_createDriver() {
|
6
|
-
const NoneAllocDriver = require('../drivers/NoneAllocDriver');
|
7
|
-
return new NoneAllocDriver();
|
8
|
-
}
|
9
|
-
}
|
10
|
-
|
11
|
-
module.exports = { None };
|