detox 19.13.0 → 20.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{19.13.0/detox-19.13.0-javadoc.jar → 20.0.0/detox-20.0.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.13.0/detox-19.13.0-sources.jar → 20.0.0/detox-20.0.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.13.0/detox-19.13.0.pom → 20.0.0/detox-20.0.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios.tbz +0 -0
- package/README.md +1 -1
- package/android/detox/src/full/java/com/wix/detox/Detox.java +2 -59
- package/android/detox/src/full/java/com/wix/detox/NotificationDataParser.kt +3 -3
- package/index.d.ts +354 -191
- package/index.js +1 -0
- package/internals.d.ts +298 -0
- package/internals.js +4 -0
- package/local-cli/build-framework-cache.js +2 -2
- package/local-cli/build.js +7 -8
- package/local-cli/build.test.js +46 -40
- package/local-cli/clean-framework-cache.js +3 -3
- package/local-cli/cli.js +8 -7
- package/local-cli/init.js +73 -68
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/templates/jest.js +14 -36
- package/local-cli/test.js +24 -282
- package/local-cli/test.test.js +394 -648
- package/local-cli/testCommand/TestRunnerCommand.js +163 -0
- package/local-cli/{utils/testCommandArgs.js → testCommand/builder.js} +10 -36
- package/local-cli/testCommand/middlewares.js +66 -0
- package/local-cli/{utils → testCommand}/warnings.js +0 -13
- package/local-cli/utils/jestInternals.js +13 -2
- package/local-cli/utils/yargsUtils.js +67 -0
- package/package.json +32 -19
- package/runners/deprecation.js +45 -0
- package/runners/jest/JestCircusEnvironment.js +3 -38
- package/runners/jest/adapter.d.ts +4 -10
- package/runners/jest/adapter.js +3 -6
- package/runners/jest/assignReporter.d.ts +4 -1
- package/runners/jest/assignReporter.js +3 -6
- package/runners/jest/globalSetup.js +1 -0
- package/runners/jest/globalTeardown.js +1 -0
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +16 -0
- package/runners/jest/index.test.js +13 -0
- package/runners/jest/reporter.js +1 -0
- package/runners/jest/reporters/DetoxReporter.js +36 -0
- package/runners/jest/specReporter.d.ts +4 -9
- package/runners/jest/specReporter.js +3 -10
- package/runners/jest/streamlineReporter.js +3 -22
- package/runners/jest/testEnvironment/index.js +205 -0
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +166 -0
- package/runners/{jest-circus → jest/testEnvironment}/listeners/DetoxInitErrorListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +27 -0
- package/runners/jest/{SpecReporterImpl.js → testEnvironment/listeners/SpecReporter.js} +61 -9
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +30 -0
- package/runners/jest/testEnvironment/listeners/index.js +13 -0
- package/runners/{jest-circus → jest/testEnvironment}/utils/assertExistingContext.js +2 -2
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +70 -0
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +22 -0
- package/runners/jest/{utils → testEnvironment/utils}/getFullTestName.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/hasTimedOut.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/index.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/stdout.js +0 -0
- package/runners/jest-circus/environment/index.js +6 -0
- package/runners/jest-circus/index.js +1 -10
- package/runners/jest-circus/reporter.js +1 -0
- package/runners/migration.js +37 -0
- package/runners/mocha/DetoxMochaAdapter.js +3 -35
- package/runners/mocha/adapter.d.ts +4 -7
- package/runners/mocha/adapter.js +3 -5
- package/src/DetoxWorker.js +327 -0
- package/src/android/interactions/native.js +2 -1
- package/src/artifacts/ArtifactsManager.js +51 -35
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- package/src/artifacts/providers/index.js +0 -4
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
- package/src/artifacts/templates/artifact/Artifact.js +1 -1
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
- package/src/artifacts/utils/buildDefaultArtifactsRootDirpath.js +2 -4
- package/src/artifacts/utils/temporaryPath.js +18 -5
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +8 -17
- package/src/client/Client.js +1 -1
- package/src/client/actions/actions.js +2 -2
- package/src/configuration/collectCliConfig.js +3 -16
- package/src/configuration/composeAppsConfig.js +12 -66
- package/src/configuration/composeArtifactsConfig.js +6 -32
- package/src/configuration/composeBehaviorConfig.js +3 -13
- package/src/configuration/composeDeviceConfig.js +38 -63
- package/src/configuration/composeLoggerConfig.js +59 -0
- package/src/configuration/composeRunnerConfig.js +127 -14
- package/src/configuration/composeSessionConfig.js +1 -3
- package/src/configuration/index.js +36 -30
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/configuration/utils/deviceAppTypes.js +0 -1
- package/src/devices/allocation/DeviceAllocator.js +4 -2
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +5 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +1 -1
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +1 -1
- package/src/devices/allocation/drivers/ios/SimulatorLauncher.js +3 -3
- package/src/devices/allocation/factories/index.js +0 -1
- package/src/devices/common/drivers/DeviceLauncher.js +2 -2
- package/src/devices/common/drivers/android/emulator/exec/EmulatorExec.js +1 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +4 -9
- package/src/devices/common/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
- package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +35 -10
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +85 -86
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +3 -3
- package/src/devices/runtime/drivers/index.js +0 -1
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +4 -3
- package/src/devices/runtime/factories/ios.js +1 -8
- package/src/devices/runtime/utils/LaunchArgsEditor.js +4 -59
- package/src/devices/runtime/utils/Storage.js +4 -0
- package/src/environmentFactory.js +0 -8
- package/src/errors/DetoxConfigErrorComposer.js +92 -30
- package/src/errors/DetoxError.js +4 -0
- package/src/errors/DetoxRuntimeError.js +5 -5
- package/src/errors/index.js +2 -0
- package/src/ios/expectTwo.js +2 -1
- package/src/ipc/IPCClient.js +117 -0
- package/src/ipc/IPCServer.js +98 -0
- package/src/ipc/SessionState.js +62 -0
- package/src/logger/DetoxLogger.js +348 -0
- package/src/logger/index.js +5 -0
- package/src/logger/utils/BunyanLogger.js +76 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +36 -0
- package/src/logger/utils/DetoxLogFinalizer.js +140 -0
- package/src/logger/utils/MessageStack.js +24 -0
- package/src/logger/utils/ThreadDispatcher.js +61 -0
- package/src/{utils → logger/utils}/customConsoleLogger.js +5 -4
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/logger/utils/streamUtils.js +248 -0
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxConstants.js +13 -0
- package/src/realms/DetoxContext.js +183 -0
- package/src/realms/DetoxInternalsFacade.js +31 -0
- package/src/realms/DetoxPrimaryContext.js +261 -0
- package/src/realms/DetoxSecondaryContext.js +91 -0
- package/src/realms/index.js +10 -0
- package/src/realms/primary.js +3 -0
- package/src/realms/secondary.js +3 -0
- package/src/server/DetoxConnection.js +18 -23
- package/src/server/DetoxServer.js +7 -10
- package/src/server/DetoxSession.js +6 -6
- package/src/server/DetoxSessionManager.js +1 -1
- package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
- package/src/symbols.js +50 -0
- package/src/utils/Timer.js +58 -33
- package/src/utils/argparse.js +11 -0
- package/src/utils/childProcess/exec.js +1 -1
- package/src/utils/childProcess/spawn.js +1 -1
- package/{local-cli/utils/misc.js → src/utils/envUtils.js} +0 -9
- package/src/utils/errorUtils.js +20 -0
- package/src/utils/logger.js +2 -162
- package/src/utils/shellUtils.js +18 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar +0 -0
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha512 +0 -1
- package/local-cli/templates/mocha.js +0 -32
- package/local-cli/utils/splitArgv.js +0 -107
- package/runners/integration.js +0 -16
- package/runners/jest/DetoxAdapterCircus.js +0 -60
- package/runners/jest/DetoxAdapterImpl.js +0 -81
- package/runners/jest/DetoxAdapterJasmine.js +0 -67
- package/runners/jest/DetoxStreamlineJestReporter.js +0 -98
- package/runners/jest/FailingTestsReporter.js +0 -16
- package/runners/jest/SpecReporterCircus.js +0 -51
- package/runners/jest/SpecReporterJasmine.js +0 -39
- package/runners/jest/WorkerAssignReporterCircus.js +0 -17
- package/runners/jest/WorkerAssignReporterImpl.js +0 -21
- package/runners/jest/WorkerAssignReporterJasmine.js +0 -15
- package/runners/jest/runnerInfo.js +0 -9
- package/runners/jest-circus/environment.js +0 -206
- package/runners/jest-circus/listeners/DetoxCoreListener.js +0 -113
- package/runners/jest-circus/utils/assertJestCircus26.js +0 -39
- package/runners/jest-circus/utils/wrapErrorWithNoopLifecycle.js +0 -14
- package/src/Detox.js +0 -317
- package/src/DetoxConstants.js +0 -13
- package/src/DetoxExportWrapper.js +0 -140
- package/src/artifacts/timeline/TimelineArtifactPlugin.js +0 -92
- package/src/configuration/utils/warnings.js +0 -12
- package/src/devices/allocation/drivers/NoneAllocDriver.js +0 -10
- package/src/devices/allocation/factories/none.js +0 -11
- package/src/index.js +0 -6
- package/src/utils/ChromeTracingExporter.js +0 -54
- package/src/utils/MissingDetox.js +0 -78
- package/src/utils/fakeTimestampsProvider.js +0 -9
- package/src/utils/getWorkerId.js +0 -5
- package/src/utils/lastFailedTests.js +0 -38
- package/src/utils/sh.js +0 -18
- package/src/utils/trace.js +0 -96
package/index.d.ts
CHANGED
@@ -8,66 +8,53 @@
|
|
8
8
|
// * Max Komarychev <https://github.com/maxkomarychev>
|
9
9
|
// * Dor Ben Baruch <https://github.com/Dor256>
|
10
10
|
|
11
|
+
import { BunyanDebugStreamOptions } from 'bunyan-debug-stream';
|
12
|
+
|
11
13
|
declare global {
|
14
|
+
const detox: Detox.DetoxExportWrapper;
|
12
15
|
const device: Detox.DetoxExportWrapper['device'];
|
13
16
|
const element: Detox.DetoxExportWrapper['element'];
|
14
17
|
const waitFor: Detox.DetoxExportWrapper['waitFor'];
|
15
18
|
const expect: Detox.DetoxExportWrapper['expect'];
|
16
19
|
const by: Detox.DetoxExportWrapper['by'];
|
17
20
|
const web: Detox.DetoxExportWrapper['web'];
|
18
|
-
const detoxCircus: Detox.DetoxCircus;
|
19
21
|
|
20
22
|
namespace NodeJS {
|
21
23
|
interface Global {
|
24
|
+
detox: Detox.DetoxExportWrapper;
|
22
25
|
device: Detox.DetoxExportWrapper['device'];
|
23
26
|
element: Detox.DetoxExportWrapper['element'];
|
24
27
|
waitFor: Detox.DetoxExportWrapper['waitFor'];
|
25
28
|
expect: Detox.DetoxExportWrapper['expect'];
|
26
29
|
by: Detox.DetoxExportWrapper['by'];
|
27
30
|
web: Detox.DetoxExportWrapper['web'];
|
28
|
-
detoxCircus: Detox.DetoxCircus;
|
29
31
|
}
|
30
32
|
}
|
31
33
|
|
32
34
|
namespace Detox {
|
33
|
-
|
35
|
+
//#region DetoxConfig
|
34
36
|
|
35
|
-
interface DetoxConfig {
|
37
|
+
interface DetoxConfig extends DetoxConfigurationCommon {
|
36
38
|
/**
|
37
39
|
* @example extends: './relative/detox.config'
|
38
40
|
* @example extends: '@my-org/detox-preset'
|
39
41
|
*/
|
40
42
|
extends?: string;
|
41
|
-
|
42
|
-
* @example testRunner: 'jest'
|
43
|
-
* @example testRunner: 'mocha'
|
44
|
-
*/
|
45
|
-
testRunner?: string;
|
46
|
-
/**
|
47
|
-
* Stops passing default `--maxWorkers 1` to the test runner,
|
48
|
-
* presuming that from now on you have that already configured
|
49
|
-
* in your test runner config as a default.
|
50
|
-
*/
|
51
|
-
skipLegacyWorkersInjection?: boolean;
|
52
|
-
/**
|
53
|
-
* @example runnerConfig: 'e2e/config.js'
|
54
|
-
*/
|
55
|
-
runnerConfig?: string;
|
56
|
-
/**
|
57
|
-
* Optional. A default glob pattern for a test runner to use when no test files are specified.
|
58
|
-
*
|
59
|
-
* @example specs: 'detoxE2E'
|
60
|
-
*/
|
61
|
-
specs?: string;
|
62
|
-
artifacts?: DetoxArtifactsConfig;
|
63
|
-
behavior?: DetoxBehaviorConfig;
|
64
|
-
session?: DetoxSessionConfig;
|
43
|
+
|
65
44
|
apps?: Record<string, DetoxAppConfig>;
|
66
45
|
devices?: Record<string, DetoxDeviceConfig>;
|
67
46
|
selectedConfiguration?: string;
|
68
47
|
configurations: Record<string, DetoxConfiguration>;
|
69
48
|
}
|
70
49
|
|
50
|
+
type DetoxConfigurationCommon = {
|
51
|
+
artifacts?: false | DetoxArtifactsConfig;
|
52
|
+
behavior?: DetoxBehaviorConfig;
|
53
|
+
logger?: DetoxLoggerConfig;
|
54
|
+
session?: DetoxSessionConfig;
|
55
|
+
testRunner?: DetoxTestRunnerConfig;
|
56
|
+
};
|
57
|
+
|
71
58
|
interface DetoxArtifactsConfig {
|
72
59
|
rootDir?: string;
|
73
60
|
pathBuilder?: string;
|
@@ -76,7 +63,6 @@ declare global {
|
|
76
63
|
screenshot?: 'none' | 'manual' | 'failing' | 'all' | DetoxScreenshotArtifactsPluginConfig;
|
77
64
|
video?: 'none' | 'failing' | 'all' | DetoxVideoArtifactsPluginConfig;
|
78
65
|
instruments?: 'none' | 'all' | DetoxInstrumentsArtifactsPluginConfig;
|
79
|
-
timeline?: 'none' | 'all' | DetoxTimelineArtifactsPluginConfig;
|
80
66
|
uiHierarchy?: 'disabled' | 'enabled' | DetoxUIHierarchyArtifactsPluginConfig;
|
81
67
|
|
82
68
|
[pluginId: string]: unknown;
|
@@ -96,11 +82,23 @@ declare global {
|
|
96
82
|
*/
|
97
83
|
exposeGlobals?: boolean;
|
98
84
|
/**
|
99
|
-
* By default,
|
85
|
+
* By default, Detox will uninstall and install the app upon initialization.
|
100
86
|
* If you wish to reuse the existing app for a faster run, set the property to
|
101
87
|
* `false`.
|
102
88
|
*/
|
103
89
|
reinstallApp?: boolean;
|
90
|
+
/**
|
91
|
+
* When false, `detox test` command always deletes the shared lock file on start,
|
92
|
+
* assuming it had been left from the previous, already finished test session.
|
93
|
+
* The lock file contains information about busy and free devices and ensures
|
94
|
+
* no device can be used simultaneously by multiple test workers.
|
95
|
+
*
|
96
|
+
* Setting it to **true** might be useful when if you need to run multiple
|
97
|
+
* `detox test` commands in parallel, e.g. test a few configurations at once.
|
98
|
+
*
|
99
|
+
* @default false
|
100
|
+
*/
|
101
|
+
keepLockFile?: boolean;
|
104
102
|
};
|
105
103
|
launchApp?: 'auto' | 'manual';
|
106
104
|
cleanup?: {
|
@@ -108,6 +106,45 @@ declare global {
|
|
108
106
|
};
|
109
107
|
}
|
110
108
|
|
109
|
+
type _DetoxLoggerOptions = Omit<BunyanDebugStreamOptions, 'out'>;
|
110
|
+
|
111
|
+
interface DetoxLoggerConfig {
|
112
|
+
/**
|
113
|
+
* Log level filters the messages printed to your terminal,
|
114
|
+
* and it does not affect the logs written to the artifacts.
|
115
|
+
*
|
116
|
+
* Use `info` by default.
|
117
|
+
* Use `error` or warn when you want to make the output as silent as possible.
|
118
|
+
* Use `debug` to control what generally is happening under the hood.
|
119
|
+
* Use `trace` when troubleshooting specific issues.
|
120
|
+
*
|
121
|
+
* @default 'info'
|
122
|
+
*/
|
123
|
+
level?: DetoxLogLevel;
|
124
|
+
/**
|
125
|
+
* When enabled, hijacks all the console methods (console.log, console.warn, etc)
|
126
|
+
* so that the messages printed via them are formatted and saved as Detox logs.
|
127
|
+
*
|
128
|
+
* @default true
|
129
|
+
*/
|
130
|
+
overrideConsole?: boolean;
|
131
|
+
/**
|
132
|
+
* Since Detox is using
|
133
|
+
* {@link https://www.npmjs.com/package/bunyan-debug-stream bunyan-debug-stream}
|
134
|
+
* for printing logs, all its options are exposed for sake of simplicity
|
135
|
+
* of customization.
|
136
|
+
*
|
137
|
+
* The only exception is {@link BunyanDebugStreamOptions#out} option,
|
138
|
+
* which is always set to `process.stdout`.
|
139
|
+
*
|
140
|
+
* You can also pass a callback function to override the logger config
|
141
|
+
* programmatically, e.g. depending on the selected log level.
|
142
|
+
*
|
143
|
+
* @see {@link BunyanDebugStreamOptions}
|
144
|
+
*/
|
145
|
+
options?: _DetoxLoggerOptions | ((config: Partial<DetoxLoggerConfig>) => _DetoxLoggerOptions);
|
146
|
+
}
|
147
|
+
|
111
148
|
interface DetoxSessionConfig {
|
112
149
|
autoStart?: boolean;
|
113
150
|
debugSynchronization?: number;
|
@@ -115,7 +152,128 @@ declare global {
|
|
115
152
|
sessionId?: string;
|
116
153
|
}
|
117
154
|
|
118
|
-
|
155
|
+
interface DetoxTestRunnerConfig {
|
156
|
+
args?: {
|
157
|
+
/**
|
158
|
+
* The command to use for runner: 'jest', 'nyc jest',
|
159
|
+
*/
|
160
|
+
$0: string;
|
161
|
+
/**
|
162
|
+
* The positional arguments to pass to the runner.
|
163
|
+
*/
|
164
|
+
_?: string[];
|
165
|
+
/**
|
166
|
+
* Any other properties recognized by test runner
|
167
|
+
*/
|
168
|
+
[prop: string]: unknown;
|
169
|
+
};
|
170
|
+
|
171
|
+
/**
|
172
|
+
* This is an add-on section used by our Jest integration code (but not Detox core itself).
|
173
|
+
* In other words, if you’re implementing (or using) a custom integration with some other test runner, feel free to define a section for yourself (e.g. `testRunner.mocha`)
|
174
|
+
*/
|
175
|
+
jest?: {
|
176
|
+
/**
|
177
|
+
* Environment setup timeout
|
178
|
+
*
|
179
|
+
* As a part of the environment setup, Detox boots the device and installs the apps.
|
180
|
+
* If that takes longer than the specified value, the entire test suite will be considered as failed, e.g.:
|
181
|
+
* ```plain text
|
182
|
+
* FAIL e2e/starter.test.js
|
183
|
+
* ● Test suite failed to run
|
184
|
+
*
|
185
|
+
* Exceeded timeout of 300000ms while setting up Detox environment
|
186
|
+
* ```
|
187
|
+
*
|
188
|
+
* The default value is 5 minutes.
|
189
|
+
*
|
190
|
+
* @default 300000
|
191
|
+
* @see {@link https://jestjs.io/docs/configuration/#testenvironment-string}
|
192
|
+
*/
|
193
|
+
setupTimeout?: number | undefined;
|
194
|
+
/**
|
195
|
+
* Environemnt teardown timeout
|
196
|
+
*
|
197
|
+
* If the environment teardown takes longer than the specified value, Detox will throw a timeout error.
|
198
|
+
* The default value is half a minute.
|
199
|
+
*
|
200
|
+
* @default 30000 (30 seconds)
|
201
|
+
* @see {@link https://jestjs.io/docs/configuration/#testenvironment-string}
|
202
|
+
*/
|
203
|
+
teardownTimeout?: number | undefined;
|
204
|
+
/**
|
205
|
+
* Jest provides an API to re-run individual failed tests: `jest.retryTimes(count)`.
|
206
|
+
* When Detox detects the use of this API, it suppresses its own CLI retry mechanism controlled via `detox test … --retries <N>` or {@link DetoxTestRunnerConfig#retries}.
|
207
|
+
* The motivation is simple – activating the both mechanisms is apt to increase your test duration dramatically, if your tests are flaky.
|
208
|
+
* If you wish nevertheless to use both the mechanisms simultaneously, set it to `true`.
|
209
|
+
*
|
210
|
+
* @default false
|
211
|
+
* @see {@link https://jestjs.io/docs/29.0/jest-object#jestretrytimesnumretries-options}
|
212
|
+
*/
|
213
|
+
retryAfterCircusRetries?: boolean;
|
214
|
+
/**
|
215
|
+
* By default, Jest prints the test names and their status (_passed_ or _failed_) at the very end of the test session.
|
216
|
+
* When enabled, it makes Detox to print messages like these each time the new test starts and ends:
|
217
|
+
* ```plain text
|
218
|
+
* 18:03:36.258 detox[40125] i Sanity: should have welcome screen
|
219
|
+
* 18:03:37.495 detox[40125] i Sanity: should have welcome screen [OK]
|
220
|
+
* 18:03:37.496 detox[40125] i Sanity: should show hello screen after tap
|
221
|
+
* 18:03:38.928 detox[40125] i Sanity: should show hello screen after tap [OK]
|
222
|
+
* 18:03:38.929 detox[40125] i Sanity: should show world screen after tap
|
223
|
+
* 18:03:40.351 detox[40125] i Sanity: should show world screen after tap [OK]
|
224
|
+
* ```
|
225
|
+
* By default, it is enabled automatically in test sessions with a single worker.
|
226
|
+
* And vice versa, if multiple tests are executed concurrently, Detox turns it off to avoid confusion in the log.
|
227
|
+
* Use boolean values, `true` or `false`, to turn off the automatic choice.
|
228
|
+
*
|
229
|
+
* @default undefined
|
230
|
+
*/
|
231
|
+
reportSpecs?: boolean | undefined;
|
232
|
+
/**
|
233
|
+
* In the environment setup phase, Detox boots the device and installs the apps.
|
234
|
+
* This flag tells Detox to print messages like these every time the device gets assigned to a specific suite:
|
235
|
+
*
|
236
|
+
* ```plain text
|
237
|
+
* 18:03:29.869 detox[40125] i starter.test.js is assigned to 4EC84833-C7EA-4CA3-A6E9-5C30A29EA596 (iPhone 12 Pro Max)
|
238
|
+
* ```
|
239
|
+
*
|
240
|
+
* @default true
|
241
|
+
*/
|
242
|
+
reportWorkerAssign?: boolean | undefined;
|
243
|
+
};
|
244
|
+
/**
|
245
|
+
* Retries count. Zero means a single attempt to run tests.
|
246
|
+
*/
|
247
|
+
retries?: number;
|
248
|
+
/**
|
249
|
+
* When true, tells Detox CLI to cancel next retrying if it gets
|
250
|
+
* at least one report about a permanent test suite failure.
|
251
|
+
* Has no effect, if {@link DetoxTestRunnerConfig#retries} is
|
252
|
+
* undefined or set to zero.
|
253
|
+
*
|
254
|
+
* @default false
|
255
|
+
* @see {DetoxInternals.DetoxTestFileReport#isPermanentFailure}
|
256
|
+
*/
|
257
|
+
bail?: boolean;
|
258
|
+
/**
|
259
|
+
* Custom handler to process --inspect-brk CLI flag.
|
260
|
+
* Use it when you rely on another test runner than Jest to mutate the config.
|
261
|
+
*/
|
262
|
+
inspectBrk?: (config: DetoxTestRunnerConfig) => void;
|
263
|
+
/**
|
264
|
+
* Forward environment variables to the spawned test runner
|
265
|
+
* accordingly to the given CLI argument overrides.
|
266
|
+
*
|
267
|
+
* If false, Detox CLI will be only printing a hint message on
|
268
|
+
* how to start the test runner using environment variables,
|
269
|
+
* in case when a user wants to avoid using Detox CLI.
|
270
|
+
*
|
271
|
+
* @default false
|
272
|
+
*/
|
273
|
+
forwardEnv?: boolean;
|
274
|
+
}
|
275
|
+
|
276
|
+
type DetoxAppConfig = (DetoxBuiltInAppConfig | DetoxCustomAppConfig) & {
|
119
277
|
/**
|
120
278
|
* App name to use with device.selectApp(appName) calls.
|
121
279
|
* Can be omitted if you have a single app under the test.
|
@@ -127,8 +285,6 @@ declare global {
|
|
127
285
|
|
128
286
|
type DetoxDeviceConfig = DetoxBuiltInDeviceConfig | DetoxCustomDriverConfig;
|
129
287
|
|
130
|
-
type DetoxConfiguration = DetoxPlainConfiguration | DetoxAliasedConfiguration;
|
131
|
-
|
132
288
|
interface DetoxLogArtifactsPluginConfig {
|
133
289
|
enabled?: boolean;
|
134
290
|
keepOnlyFailedTestsArtifacts?: boolean;
|
@@ -168,9 +324,7 @@ declare global {
|
|
168
324
|
enabled?: boolean;
|
169
325
|
}
|
170
326
|
|
171
|
-
|
172
|
-
enabled?: boolean;
|
173
|
-
}
|
327
|
+
type DetoxBuiltInAppConfig = (DetoxIosAppConfig | DetoxAndroidAppConfig);
|
174
328
|
|
175
329
|
interface DetoxIosAppConfig {
|
176
330
|
type: 'ios.app';
|
@@ -187,31 +341,26 @@ declare global {
|
|
187
341
|
build?: string;
|
188
342
|
testBinaryPath?: string;
|
189
343
|
launchArgs?: Record<string, any>;
|
344
|
+
/**
|
345
|
+
* TCP ports to `adb reverse` upon the installation.
|
346
|
+
* E.g. 8081 - to be able to access React Native packager in Debug mode.
|
347
|
+
*
|
348
|
+
* @example [8081]
|
349
|
+
*/
|
350
|
+
reversePorts?: number[];
|
190
351
|
}
|
191
352
|
|
192
|
-
interface
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
testBinaryPath?: string;
|
197
|
-
launchArgs?: Record<string, any>;
|
353
|
+
interface DetoxCustomAppConfig {
|
354
|
+
type: string;
|
355
|
+
|
356
|
+
[prop: string]: unknown;
|
198
357
|
}
|
199
358
|
|
200
359
|
type DetoxBuiltInDeviceConfig =
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
| DetoxGenymotionCloudDriverConfig;
|
206
|
-
|
207
|
-
type DetoxPlainConfiguration = DetoxConfigurationOverrides & (
|
208
|
-
| (DetoxIosSimulatorDriverConfig & _DetoxAppConfigFragment)
|
209
|
-
| (DetoxIosNoneDriverConfig & _DetoxAppConfigFragment)
|
210
|
-
| (DetoxAttachedAndroidDriverConfig & _DetoxAppConfigFragment)
|
211
|
-
| (DetoxAndroidEmulatorDriverConfig & _DetoxAppConfigFragment)
|
212
|
-
| (DetoxGenymotionCloudDriverConfig & _DetoxAppConfigFragment)
|
213
|
-
| (DetoxCustomDriverConfig)
|
214
|
-
);
|
360
|
+
| DetoxIosSimulatorDriverConfig
|
361
|
+
| DetoxAttachedAndroidDriverConfig
|
362
|
+
| DetoxAndroidEmulatorDriverConfig
|
363
|
+
| DetoxGenymotionCloudDriverConfig;
|
215
364
|
|
216
365
|
interface DetoxIosSimulatorDriverConfig {
|
217
366
|
type: 'ios.simulator';
|
@@ -219,12 +368,6 @@ declare global {
|
|
219
368
|
bootArgs?: string;
|
220
369
|
}
|
221
370
|
|
222
|
-
interface DetoxIosNoneDriverConfig {
|
223
|
-
type: 'ios.none';
|
224
|
-
// TODO: check if we need it at all?
|
225
|
-
device?: string | Partial<IosSimulatorQuery>;
|
226
|
-
}
|
227
|
-
|
228
371
|
interface DetoxSharedAndroidDriverConfig {
|
229
372
|
forceAdbInstall?: boolean;
|
230
373
|
utilBinaryPaths?: string[];
|
@@ -239,8 +382,11 @@ declare global {
|
|
239
382
|
type: 'android.emulator';
|
240
383
|
device: string | { avdName: string };
|
241
384
|
bootArgs?: string;
|
242
|
-
gpuMode?: 'auto' | 'host' | 'swiftshader_indirect' | 'angle_indirect' | 'guest';
|
385
|
+
gpuMode?: 'auto' | 'host' | 'swiftshader_indirect' | 'angle_indirect' | 'guest' | 'off';
|
243
386
|
headless?: boolean;
|
387
|
+
/**
|
388
|
+
* @default true
|
389
|
+
*/
|
244
390
|
readonly?: boolean;
|
245
391
|
}
|
246
392
|
|
@@ -262,111 +408,144 @@ declare global {
|
|
262
408
|
os: string;
|
263
409
|
}
|
264
410
|
|
265
|
-
type
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
behavior?: DetoxBehaviorConfig;
|
270
|
-
session?: DetoxSessionConfig;
|
271
|
-
};
|
411
|
+
type DetoxConfiguration = DetoxConfigurationCommon & (
|
412
|
+
| DetoxConfigurationSingleApp
|
413
|
+
| DetoxConfigurationMultiApps
|
414
|
+
);
|
272
415
|
|
273
|
-
|
274
|
-
| DetoxAliasedConfigurationSingleApp
|
275
|
-
| DetoxAliasedConfigurationMultiApps;
|
276
|
-
|
277
|
-
interface DetoxAliasedConfigurationSingleApp {
|
278
|
-
type?: never;
|
416
|
+
interface DetoxConfigurationSingleApp {
|
279
417
|
device: DetoxAliasedDevice;
|
280
|
-
app:
|
418
|
+
app: DetoxAliasedApp;
|
281
419
|
}
|
282
420
|
|
283
|
-
interface
|
284
|
-
type?: never;
|
421
|
+
interface DetoxConfigurationMultiApps {
|
285
422
|
device: DetoxAliasedDevice;
|
286
|
-
apps:
|
423
|
+
apps: DetoxAliasedApp[];
|
287
424
|
}
|
288
425
|
|
289
426
|
type DetoxAliasedDevice = string | DetoxDeviceConfig;
|
290
427
|
|
291
|
-
|
428
|
+
type DetoxAliasedApp = string | DetoxAppConfig;
|
292
429
|
|
293
|
-
|
294
|
-
interface DetoxInstance {
|
295
|
-
device: Device;
|
296
|
-
element: ElementFacade;
|
297
|
-
waitFor: WaitForFacade;
|
298
|
-
expect: ExpectFacade;
|
299
|
-
by: ByFacade;
|
300
|
-
web: WebFacade;
|
301
|
-
}
|
430
|
+
//#endregion
|
302
431
|
|
303
|
-
interface DetoxExportWrapper
|
304
|
-
|
305
|
-
* The setup phase happens inside detox.init(). This is the phase where detox reads its configuration, starts a server, loads its expection library and starts a simulator
|
306
|
-
*
|
307
|
-
* @param configOverride - this object is deep-merged with the selected Detox configuration from .detoxrc
|
308
|
-
* @example
|
309
|
-
* beforeAll(async () => {
|
310
|
-
* await detox.init();
|
311
|
-
* });
|
312
|
-
*/
|
313
|
-
init(configOverride?: Partial<DetoxConfig>, options?: DetoxInitOptions): Promise<void>;
|
432
|
+
interface DetoxExportWrapper {
|
433
|
+
readonly device: Device;
|
314
434
|
|
315
|
-
|
435
|
+
readonly element: ElementFacade;
|
316
436
|
|
317
|
-
|
437
|
+
readonly waitFor: WaitForFacade;
|
318
438
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
439
|
+
readonly expect: ExpectFacade;
|
440
|
+
|
441
|
+
readonly by: ByFacade;
|
442
|
+
|
443
|
+
readonly web: WebFacade;
|
444
|
+
|
445
|
+
readonly DetoxConstants: {
|
446
|
+
userNotificationTriggers: {
|
447
|
+
push: 'push';
|
448
|
+
calendar: 'calendar';
|
449
|
+
timeInterval: 'timeInterval';
|
450
|
+
location: 'location';
|
451
|
+
};
|
452
|
+
userActivityTypes: {
|
453
|
+
searchableItem: string;
|
454
|
+
browsingWeb: string;
|
455
|
+
},
|
456
|
+
searchableItemActivityIdentifier: string;
|
457
|
+
};
|
329
458
|
|
330
459
|
/**
|
331
|
-
*
|
332
|
-
* or detox.init(). Use it only if you don't have another option.
|
333
|
-
* @internal
|
460
|
+
* Detox logger instance. Can be used for saving user logs to the general log file.
|
334
461
|
*/
|
335
|
-
|
336
|
-
}
|
462
|
+
readonly log: Logger;
|
337
463
|
|
338
|
-
interface DetoxInitOptions {
|
339
464
|
/**
|
340
|
-
*
|
341
|
-
* as global variables. If you want to control their initialization manually,
|
342
|
-
* set this property to `false`.
|
465
|
+
* @deprecated
|
343
466
|
*
|
344
|
-
*
|
345
|
-
*
|
346
|
-
|
347
|
-
|
348
|
-
|
467
|
+
* Deprecated - use {@link Detox.Logger#trace}
|
468
|
+
* Detox tracer instance. Can be used for building timelines in Google Event Tracing format.
|
469
|
+
*/
|
470
|
+
readonly trace: {
|
471
|
+
/** @deprecated */
|
472
|
+
readonly startSection: (name: string) => void;
|
473
|
+
/** @deprecated */
|
474
|
+
readonly endSection: (name: string) => void;
|
475
|
+
};
|
476
|
+
|
349
477
|
/**
|
350
|
-
*
|
351
|
-
*
|
352
|
-
*
|
353
|
-
|
354
|
-
|
478
|
+
* Trace a single call, with a given name and arguments.
|
479
|
+
*
|
480
|
+
* @deprecated
|
481
|
+
* @param sectionName The name of the section to trace.
|
482
|
+
* @param promiseOrFunction Promise or a function that provides a promise.
|
483
|
+
* @param args Optional arguments to pass to the trace.
|
484
|
+
* @returns The returned value of the traced call.
|
485
|
+
* @see https://wix.github.io/Detox/docs/19.x/api/detox-object-api/#detoxtracecall
|
486
|
+
*/
|
487
|
+
readonly traceCall: <T>(event: string, action: () => Promise<T>, args?: Record<string, unknown>) => Promise<T>;
|
488
|
+
}
|
489
|
+
|
490
|
+
interface Logger {
|
491
|
+
readonly level: DetoxLogLevel;
|
492
|
+
|
493
|
+
readonly fatal: _LogMethod;
|
494
|
+
readonly error: _LogMethod;
|
495
|
+
readonly warn: _LogMethod;
|
496
|
+
readonly info: _LogMethod;
|
497
|
+
readonly debug: _LogMethod;
|
498
|
+
readonly trace: _LogMethod;
|
499
|
+
|
500
|
+
child(context?: Partial<LogEvent>): Logger;
|
355
501
|
}
|
356
502
|
|
503
|
+
/** @internal */
|
504
|
+
interface _LogMethod extends _LogMethodSignature {
|
505
|
+
readonly begin: _LogMethodSignature;
|
506
|
+
readonly complete: _CompleteMethodSignature;
|
507
|
+
readonly end: _LogMethodSignature;
|
508
|
+
}
|
509
|
+
|
510
|
+
/** @internal */
|
511
|
+
interface _LogMethodSignature {
|
512
|
+
(...args: unknown[]): void
|
513
|
+
(event: LogEvent, ...args: unknown[]): void;
|
514
|
+
}
|
515
|
+
|
516
|
+
/** @internal */
|
517
|
+
interface _CompleteMethodSignature {
|
518
|
+
<T>(message: string, action: T | (() => T)): T;
|
519
|
+
<T>(event: LogEvent, message: string, action: T | (() => T)): T;
|
520
|
+
}
|
521
|
+
|
522
|
+
type LogEvent = {
|
523
|
+
/** Use when there's a risk of logging several parallel duration events. */
|
524
|
+
id?: string | number;
|
525
|
+
/** Optional. Event categories (tags) to facilitate filtering. */
|
526
|
+
cat?: string | string[];
|
527
|
+
/** Optional. Color name (applicable in Google Chrome Trace Format) */
|
528
|
+
cname?: string;
|
529
|
+
|
530
|
+
/** Reserved property. Process ID. */
|
531
|
+
pid?: never;
|
532
|
+
/** Reserved property. Thread ID. */
|
533
|
+
tid?: never;
|
534
|
+
/** Reserved property. Timestamp. */
|
535
|
+
ts?: never;
|
536
|
+
/** Reserved property. Event phase. */
|
537
|
+
ph?: never;
|
538
|
+
|
539
|
+
[customProperty: string]: unknown;
|
540
|
+
};
|
541
|
+
|
542
|
+
type DetoxLogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
543
|
+
|
357
544
|
type Point2D = {
|
358
545
|
x: number,
|
359
546
|
y: number,
|
360
547
|
}
|
361
548
|
|
362
|
-
/**
|
363
|
-
* @deprecated
|
364
|
-
*/
|
365
|
-
type AppLaunchArgsOperationOptions = Partial<{
|
366
|
-
/** Changes the scope of the operation: transient or permanent app launch args */
|
367
|
-
permanent: boolean;
|
368
|
-
}>;
|
369
|
-
|
370
549
|
/**
|
371
550
|
* A construct allowing for the querying and modification of user arguments passed to an app upon launch by Detox.
|
372
551
|
*
|
@@ -414,20 +593,12 @@ declare global {
|
|
414
593
|
* // }
|
415
594
|
*/
|
416
595
|
modify(modifier: object): this;
|
417
|
-
/**
|
418
|
-
* @deprecated Use {@link AppLaunchArgs#shared} instead.
|
419
|
-
*/
|
420
|
-
modify(modifier: object, options: AppLaunchArgsOperationOptions): this;
|
421
596
|
|
422
597
|
/**
|
423
598
|
* Reset all app-specific launch arguments (back to an empty object).
|
424
599
|
* If you need to reset the shared launch args, use {@link AppLaunchArgs#shared}.
|
425
600
|
*/
|
426
601
|
reset(): this;
|
427
|
-
/**
|
428
|
-
* @deprecated Use {@link AppLaunchArgs#shared} instead.
|
429
|
-
*/
|
430
|
-
reset(options: AppLaunchArgsOperationOptions): this;
|
431
602
|
|
432
603
|
/**
|
433
604
|
* Get all currently set launch arguments (including shared ones).
|
@@ -435,10 +606,6 @@ declare global {
|
|
435
606
|
* Note: mutating the values inside the result object is pointless, as it is immutable.
|
436
607
|
*/
|
437
608
|
get(): object;
|
438
|
-
/**
|
439
|
-
* @deprecated Use {@link AppLaunchArgs#shared} instead.
|
440
|
-
*/
|
441
|
-
get(options: AppLaunchArgsOperationOptions): object;
|
442
609
|
}
|
443
610
|
|
444
611
|
/**
|
@@ -460,12 +627,10 @@ declare global {
|
|
460
627
|
* Holds the environment-unique ID of the device - namely, the adb ID on Android (e.g. emulator-5554) and the Mac-global simulator UDID on iOS,
|
461
628
|
* as used by simctl (e.g. AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE).
|
462
629
|
*
|
463
|
-
* The value will be undefined until the device is properly prepared (i.e. in detox.init())
|
464
630
|
*/
|
465
631
|
id: string;
|
466
632
|
/**
|
467
633
|
* Holds a descriptive name of the device. Example: emulator-5554 (Pixel_API_29)
|
468
|
-
* The value will be undefined until the device is properly prepared (i.e. in detox.init()).
|
469
634
|
*/
|
470
635
|
name: string;
|
471
636
|
|
@@ -510,6 +675,16 @@ declare global {
|
|
510
675
|
*/
|
511
676
|
launchApp(config?: DeviceLaunchAppConfig): Promise<void>;
|
512
677
|
|
678
|
+
/**
|
679
|
+
* Relaunch the app. Convenience method that calls {@link Device#launchApp}
|
680
|
+
* with { newInstance: true } override.
|
681
|
+
*
|
682
|
+
* @deprecated
|
683
|
+
* @param config
|
684
|
+
* @see Device#launchApp
|
685
|
+
*/
|
686
|
+
relaunchApp(config?: DeviceLaunchAppConfig): Promise<void>;
|
687
|
+
|
513
688
|
/**
|
514
689
|
* Access the user-defined launch-arguments predefined through static scopes such as the Detox configuration file and
|
515
690
|
* command-line arguments. This access allows - through dedicated methods, for both value-querying and
|
@@ -535,6 +710,7 @@ declare global {
|
|
535
710
|
* @see AppLaunchArgs
|
536
711
|
*/
|
537
712
|
appLaunchArgs: AppLaunchArgs;
|
713
|
+
|
538
714
|
/**
|
539
715
|
* Terminate the app.
|
540
716
|
*
|
@@ -899,11 +1075,13 @@ declare global {
|
|
899
1075
|
* @example await element(by.text('Product').and(by.id('product_name'));
|
900
1076
|
*/
|
901
1077
|
and(by: NativeMatcher): NativeMatcher;
|
1078
|
+
|
902
1079
|
/**
|
903
1080
|
* Find an element by a matcher with a parent matcher
|
904
1081
|
* @example await element(by.id('Grandson883').withAncestor(by.id('Son883')));
|
905
1082
|
*/
|
906
1083
|
withAncestor(parentBy: NativeMatcher): NativeMatcher;
|
1084
|
+
|
907
1085
|
/**
|
908
1086
|
* Find an element by a matcher with a child matcher
|
909
1087
|
* @example await element(by.id('Son883').withDescendant(by.id('Grandson883')));
|
@@ -917,6 +1095,7 @@ declare global {
|
|
917
1095
|
|
918
1096
|
interface ExpectFacade {
|
919
1097
|
(element: NativeElement): Expect;
|
1098
|
+
|
920
1099
|
(webElement: WebElement): WebExpect;
|
921
1100
|
}
|
922
1101
|
|
@@ -1011,6 +1190,7 @@ declare global {
|
|
1011
1190
|
* @example await expect(element(by.id('switch'))).toHaveToggleValue(true);
|
1012
1191
|
*/
|
1013
1192
|
toHaveToggleValue(value: boolean): R;
|
1193
|
+
|
1014
1194
|
/**
|
1015
1195
|
* Expect components like a Switch to have a value ('0' for off, '1' for on).
|
1016
1196
|
* @example await expect(element(by.id('UniqueId533'))).toHaveValue('0');
|
@@ -1047,6 +1227,7 @@ declare global {
|
|
1047
1227
|
* @example await waitFor(element(by.text('Text5'))).toBeVisible().whileElement(by.id('ScrollView630')).scroll(50, 'down');
|
1048
1228
|
*/
|
1049
1229
|
whileElement(by: NativeMatcher): NativeElement & WaitFor;
|
1230
|
+
|
1050
1231
|
// TODO: not sure about & WaitFor - check if we can chain whileElement multiple times
|
1051
1232
|
}
|
1052
1233
|
|
@@ -1072,6 +1253,7 @@ declare global {
|
|
1072
1253
|
*/
|
1073
1254
|
longPressAndDrag(duration: number, normalizedPositionX: number, normalizedPositionY: number, targetElement: NativeElement,
|
1074
1255
|
normalizedTargetPositionX: number, normalizedTargetPositionY: number, speed: Speed, holdDuration: number): Promise<void>;
|
1256
|
+
|
1075
1257
|
/**
|
1076
1258
|
* Simulate multiple taps on an element.
|
1077
1259
|
* @param times number of times to tap
|
@@ -1127,10 +1309,10 @@ declare global {
|
|
1127
1309
|
* @example await element(by.id('scrollView')).scroll(100, 'up');
|
1128
1310
|
*/
|
1129
1311
|
scroll(
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1312
|
+
pixels: number,
|
1313
|
+
direction: Direction,
|
1314
|
+
startPositionX?: number,
|
1315
|
+
startPositionY?: number
|
1134
1316
|
): Promise<void>;
|
1135
1317
|
|
1136
1318
|
/**
|
@@ -1138,7 +1320,7 @@ declare global {
|
|
1138
1320
|
* @example await element(by.id('scrollView')).scrollToIndex(10);
|
1139
1321
|
*/
|
1140
1322
|
scrollToIndex(
|
1141
|
-
|
1323
|
+
index: Number
|
1142
1324
|
): Promise<void>;
|
1143
1325
|
|
1144
1326
|
/**
|
@@ -1227,7 +1409,7 @@ declare global {
|
|
1227
1409
|
* // * on failure, to: <artifacts-location>/✗ Menu items should have Logout/tap on menu.png
|
1228
1410
|
* });
|
1229
1411
|
*/
|
1230
|
-
|
1412
|
+
takeScreenshot(name: string): Promise<string>;
|
1231
1413
|
|
1232
1414
|
/**
|
1233
1415
|
* Gets the native (OS-dependent) attributes of the element.
|
@@ -1245,7 +1427,7 @@ declare global {
|
|
1245
1427
|
* jestExpect(attributes.width).toHaveValue(100);
|
1246
1428
|
* })
|
1247
1429
|
*/
|
1248
|
-
|
1430
|
+
getAttributes(): Promise<IosElementAttributes | AndroidElementAttributes | { elements: IosElementAttributes[]; }>;
|
1249
1431
|
}
|
1250
1432
|
|
1251
1433
|
interface WebExpect<R = Promise<void>> {
|
@@ -1261,7 +1443,7 @@ declare global {
|
|
1261
1443
|
* @example
|
1262
1444
|
* await expect(web.element(by.web.id('UniqueId205'))).toHaveText('ExactText');
|
1263
1445
|
*/
|
1264
|
-
toHaveText(text: string): R
|
1446
|
+
toHaveText(text: string): R;
|
1265
1447
|
|
1266
1448
|
/**
|
1267
1449
|
* Expect the view to exist in the webview DOM tree.
|
@@ -1282,56 +1464,56 @@ declare global {
|
|
1282
1464
|
}
|
1283
1465
|
|
1284
1466
|
interface WebElementActions {
|
1285
|
-
tap(): Promise<void
|
1467
|
+
tap(): Promise<void>;
|
1286
1468
|
|
1287
1469
|
/**
|
1288
1470
|
* @param text to type
|
1289
1471
|
* @param isContentEditable whether its a ContentEditable element, default is false.
|
1290
1472
|
*/
|
1291
|
-
typeText(text: string, isContentEditable: boolean): Promise<void
|
1473
|
+
typeText(text: string, isContentEditable: boolean): Promise<void>;
|
1292
1474
|
|
1293
1475
|
/**
|
1294
1476
|
* At the moment not working on content-editable
|
1295
1477
|
* @param text to replace with the old content.
|
1296
1478
|
*/
|
1297
|
-
replaceText(text: string): Promise<void
|
1479
|
+
replaceText(text: string): Promise<void>;
|
1298
1480
|
|
1299
1481
|
/**
|
1300
1482
|
* At the moment not working on content-editable
|
1301
1483
|
*/
|
1302
|
-
clearText(): Promise<void
|
1484
|
+
clearText(): Promise<void>;
|
1303
1485
|
|
1304
1486
|
/**
|
1305
1487
|
* scrolling to the view, the element top position will be at the top of the screen.
|
1306
1488
|
*/
|
1307
|
-
scrollToView(): Promise<void
|
1489
|
+
scrollToView(): Promise<void>;
|
1308
1490
|
|
1309
1491
|
/**
|
1310
1492
|
* Gets the input content
|
1311
1493
|
*/
|
1312
|
-
getText(): Promise<string
|
1494
|
+
getText(): Promise<string>;
|
1313
1495
|
|
1314
1496
|
/**
|
1315
1497
|
* Calls the focus function on the element
|
1316
1498
|
*/
|
1317
|
-
focus(): Promise<void
|
1499
|
+
focus(): Promise<void>;
|
1318
1500
|
|
1319
1501
|
/**
|
1320
1502
|
* Selects all the input content, works on ContentEditable at the moment.
|
1321
1503
|
*/
|
1322
|
-
selectAllText(): Promise<void
|
1504
|
+
selectAllText(): Promise<void>;
|
1323
1505
|
|
1324
1506
|
/**
|
1325
1507
|
* Moves the input cursor / caret to the end of the content, works on ContentEditable at the moment.
|
1326
1508
|
*/
|
1327
|
-
moveCursorToEnd(): Promise<void
|
1509
|
+
moveCursorToEnd(): Promise<void>;
|
1328
1510
|
|
1329
1511
|
/**
|
1330
1512
|
* Running a script on the element
|
1331
1513
|
* @param script a method that accept the element as its first arg
|
1332
1514
|
* @example function foo(element) { console.log(element); }
|
1333
1515
|
*/
|
1334
|
-
runScript(script: string): Promise<any
|
1516
|
+
runScript(script: string): Promise<any>;
|
1335
1517
|
|
1336
1518
|
/**
|
1337
1519
|
* Running a script on the element that accept args
|
@@ -1445,25 +1627,6 @@ declare global {
|
|
1445
1627
|
languageAndLocale?: LanguageAndLocale;
|
1446
1628
|
}
|
1447
1629
|
|
1448
|
-
interface CircusTestEventListenerBase {
|
1449
|
-
handleTestEvent(event: any, state: any): Promise<void>;
|
1450
|
-
}
|
1451
|
-
|
1452
|
-
interface DetoxCircus {
|
1453
|
-
/**
|
1454
|
-
* A get function that Enables access to this instance (single in each worker's scope)
|
1455
|
-
*/
|
1456
|
-
getEnv(): {
|
1457
|
-
/**
|
1458
|
-
* Registers a listener such as an adapter or reporter
|
1459
|
-
* @example
|
1460
|
-
* detoxCircus.getEnv().addEventsListener(adapter)
|
1461
|
-
* detoxCircus.getEnv().addEventsListener(assignReporter)
|
1462
|
-
*/
|
1463
|
-
addEventsListener(listener: CircusTestEventListenerBase): void
|
1464
|
-
};
|
1465
|
-
}
|
1466
|
-
|
1467
1630
|
// Element Attributes Shared Among iOS and Android
|
1468
1631
|
interface ElementAttributes {
|
1469
1632
|
/**
|