detox 21.0.0-rc.5 → 21.0.0-rc.7
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +1 -0
- package/Detox-android/com/wix/detox/{21.0.0-rc.5/detox-21.0.0-rc.5-javadoc.jar → 21.0.0-rc.7/detox-21.0.0-rc.7-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{21.0.0-rc.5/detox-21.0.0-rc.5-sources.jar → 21.0.0-rc.7/detox-21.0.0-rc.7-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.aar +0 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{21.0.0-rc.5/detox-21.0.0-rc.5.pom → 21.0.0-rc.7/detox-21.0.0-rc.7.pom} +1 -7
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.7/detox-21.0.0-rc.7.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-framework.tbz +0 -0
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios-xcuitest.tbz +0 -0
- package/android/build.gradle +1 -1
- package/android/detox/build.gradle +13 -8
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAssertion.java +44 -25
- package/android/detox/src/full/java/com/wix/detox/espresso/EspressoDetox.java +6 -7
- package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +2 -2
- package/android/detox/src/full/java/com/wix/detox/espresso/action/GetAttributesAction.kt +34 -35
- package/android/detox/src/full/java/com/wix/detox/espresso/common/MaterialSliderHelper.kt +21 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/common/{SliderHelper.kt → ReactSliderHelper.kt} +6 -5
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +2 -2
- package/android/detox/src/full/java/com/wix/detox/espresso/performer/MultipleViewsActionPerformer.kt +43 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/performer/SingleViewActionPerformer.kt +19 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/performer/ViewActionPerformer.kt +24 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/web/WebElement.java +4 -4
- package/android/detox/src/full/java/com/wix/invoke/types/Invocation.java +7 -6
- package/android/detox/src/main/java/com/wix/detox/espresso/MultipleViewsAction.kt +4 -0
- package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +0 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/ViewActionWithResult.kt +2 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/MotionEvents.kt +60 -4
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +6 -5
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/MaterialSliderHelperTest.kt +33 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/{SliderHelperTest.kt → ReactSliderHelperTest.kt} +3 -3
- package/android/detox/src/testFull/java/com/wix/detox/espresso/performer/ViewActionPerformerSpec.kt +37 -0
- package/android/detox/src/testFull/java/com/wix/invoke/JsonParserTest.java +23 -7
- package/android/detox/src/testFull/resources/targetInvocationEspressoWebDetoxScript.json +47 -0
- package/android/rninfo.gradle +3 -3
- package/detox.d.ts +1830 -0
- package/globals.d.ts +23 -0
- package/index.d.ts +2 -1823
- package/internals.d.ts +11 -1
- package/jest.config.js +108 -0
- package/local-cli/reset-lock-file.js +5 -9
- package/local-cli/testCommand/TestRunnerCommand.js +26 -3
- package/local-cli/utils/interruptListeners.js +15 -0
- package/package.json +2 -100
- package/runners/jest/reporter.js +21 -1
- package/runners/jest/reporters/DetoxIPCReporter.js +34 -0
- package/runners/jest/reporters/DetoxReporterDispatcher.js +144 -0
- package/runners/jest/reporters/DetoxSummaryReporter.js +16 -0
- package/runners/jest/reporters/DetoxVerboseReporter.js +16 -0
- package/runners/jest/reporters/index.js +6 -0
- package/runners/jest/testEnvironment/index.js +11 -0
- package/src/DetoxWorker.js +5 -11
- package/src/android/core/NativeElement.js +26 -29
- package/src/android/core/WebElement.js +24 -6
- package/src/android/espressoapi/DetoxAssertion.js +16 -14
- package/src/android/espressoapi/EspressoDetox.js +9 -2
- package/src/android/espressoapi/web/WebElement.js +1 -4
- package/src/android/interactions/native.js +2 -3
- package/src/artifacts/providers/index.js +3 -3
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +0 -17
- package/src/configuration/composeLoggerConfig.js +1 -0
- package/src/configuration/composeRunnerConfig.js +3 -1
- package/src/devices/allocation/DeviceAllocator.js +66 -20
- package/src/devices/allocation/DeviceList.js +44 -0
- package/src/devices/allocation/DeviceRegistry.js +189 -0
- package/src/devices/allocation/drivers/AllocationDriverBase.d.ts +15 -0
- package/src/devices/{common/drivers/android/tools → allocation/drivers/android}/FreeDeviceFinder.js +11 -10
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidAllocDriver.js +22 -17
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +97 -38
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +32 -45
- package/src/devices/allocation/drivers/android/emulator/FreeEmulatorFinder.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/FreePortFinder.js +37 -0
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +3 -3
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +104 -32
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceLauncher.js +40 -31
- package/src/devices/allocation/drivers/android/genycloud/GenyRegistry.js +121 -0
- package/src/devices/allocation/drivers/android/genycloud/services/GenyInstanceLifecycleService.js +24 -0
- package/src/devices/{common → allocation}/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/allocation/drivers/android/genycloud/services/dto/GenyInstance.js +83 -0
- package/src/devices/allocation/drivers/android/genycloud/services/dto/GenyRecipe.js +25 -0
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +95 -54
- package/src/devices/allocation/drivers/ios/SimulatorQuery.js +24 -0
- package/src/devices/allocation/factories/android.js +29 -35
- package/src/devices/allocation/factories/ios.js +6 -7
- package/src/devices/common/drivers/DeviceCookie.d.ts +12 -0
- package/src/devices/common/drivers/android/cookies.d.ts +11 -0
- package/src/devices/common/drivers/android/emulator/exec/EmulatorExec.js +17 -5
- package/src/devices/common/drivers/android/exec/ADB.js +1 -0
- package/src/devices/common/drivers/android/tools/instrumentationArgs.js +7 -1
- package/src/devices/common/drivers/ios/cookies.d.ts +9 -0
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +3 -1
- package/src/devices/cookies/index.js +0 -6
- package/src/devices/runtime/drivers/android/genycloud/GenyCloudDriver.js +7 -6
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +5 -4
- package/src/devices/runtime/drivers/ios/XCUITestUtils.js +18 -7
- package/src/devices/runtime/factories/android.js +3 -11
- package/src/devices/runtime/factories/ios.js +3 -4
- package/src/{servicelocator → devices/servicelocator}/android/emulatorServiceLocator.js +1 -1
- package/src/devices/servicelocator/android/genycloudServiceLocator.js +17 -0
- package/src/devices/servicelocator/android/index.js +23 -0
- package/src/{validation → devices/validation}/EnvironmentValidatorBase.js +1 -0
- package/src/{validation → devices/validation}/android/GenycloudEnvValidator.js +2 -2
- package/src/{validation → devices/validation}/factories/index.js +1 -1
- package/src/{validation → devices/validation}/ios/IosSimulatorEnvValidator.js +2 -2
- package/src/environmentFactory.js +1 -11
- package/src/ios/web.js +21 -5
- package/src/ipc/IPCClient.js +22 -1
- package/src/ipc/IPCServer.js +42 -1
- package/src/ipc/SessionState.js +1 -0
- package/src/logger/DetoxLogger.js +2 -2
- package/src/realms/DetoxContext.js +8 -0
- package/src/realms/DetoxInternalsFacade.js +1 -0
- package/src/realms/DetoxPrimaryContext.js +48 -42
- package/src/realms/DetoxSecondaryContext.js +27 -0
- package/src/realms/symbols.js +6 -0
- package/src/utils/PIDService.js +27 -0
- package/src/utils/assertIsFunction.js +35 -0
- package/src/utils/environment.js +8 -15
- package/src/utils/errorUtils.js +3 -3
- package/src/utils/isArrowFunction.js +24 -0
- package/tsconfig.json +8 -3
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.aar +0 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.5/detox-21.0.0-rc.5.pom.sha512 +0 -1
- package/runners/jest/reporters/DetoxReporter.js +0 -36
- package/src/devices/DeviceRegistry.js +0 -176
- package/src/devices/allocation/drivers/AllocationDriverBase.js +0 -30
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidLauncher.js +0 -13
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +0 -72
- package/src/devices/allocation/drivers/android/genycloud/GenyDeviceRegistryFactory.js +0 -16
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +0 -65
- package/src/devices/allocation/drivers/ios/SimulatorLauncher.js +0 -21
- package/src/devices/common/drivers/DeviceAllocationHelper.js +0 -20
- package/src/devices/common/drivers/DeviceLauncher.js +0 -19
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceLifecycleService.js +0 -25
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceLookupService.js +0 -38
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +0 -14
- package/src/devices/common/drivers/android/genycloud/services/dto/GenyInstance.js +0 -66
- package/src/devices/common/drivers/android/genycloud/services/dto/GenyRecipe.js +0 -13
- package/src/devices/cookies/AndroidDeviceCookie.js +0 -13
- package/src/devices/cookies/AndroidEmulatorCookie.js +0 -6
- package/src/devices/cookies/AttachedAndroidDeviceCookie.js +0 -12
- package/src/devices/cookies/DeviceCookie.js +0 -4
- package/src/devices/cookies/GenycloudEmulatorCookie.js +0 -20
- package/src/devices/cookies/IosCookie.js +0 -6
- package/src/devices/cookies/IosSimulatorCookie.js +0 -10
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +0 -71
- package/src/devices/lifecycle/factories/GenyGlobalLifecycleHandlerFactory.js +0 -18
- package/src/servicelocator/android/genycloudServiceLocator.js +0 -21
- package/src/servicelocator/android/index.js +0 -25
- package/src/servicelocator/ios.js +0 -7
- /package/src/devices/{common → allocation}/drivers/android/genycloud/exec/GenyCloudExec.js +0 -0
- /package/src/devices/{common → allocation}/drivers/android/genycloud/services/GenyAuthService.js +0 -0
package/index.d.ts
CHANGED
@@ -1,1826 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
// * Jane Smith <jsmith@example.com>
|
4
|
-
// * Tareq El-Masri <https://github.com/TareqElMasri>
|
5
|
-
// * Steve Chun <https://github.com/stevechun>
|
6
|
-
// * Hammad Jutt <https://github.com/hammadj>
|
7
|
-
// * pera <https://github.com/santiagofm>
|
8
|
-
// * Max Komarychev <https://github.com/maxkomarychev>
|
9
|
-
// * Dor Ben Baruch <https://github.com/Dor256>
|
10
|
-
|
11
|
-
import { BunyanDebugStreamOptions } from 'bunyan-debug-stream';
|
12
|
-
|
13
|
-
declare global {
|
14
|
-
const detox: Detox.DetoxExportWrapper;
|
15
|
-
const device: Detox.DetoxExportWrapper['device'];
|
16
|
-
const element: Detox.DetoxExportWrapper['element'];
|
17
|
-
const waitFor: Detox.DetoxExportWrapper['waitFor'];
|
18
|
-
const expect: Detox.DetoxExportWrapper['expect'];
|
19
|
-
const by: Detox.DetoxExportWrapper['by'];
|
20
|
-
const web: Detox.DetoxExportWrapper['web'];
|
21
|
-
|
22
|
-
namespace NodeJS {
|
23
|
-
interface Global {
|
24
|
-
detox: Detox.DetoxExportWrapper;
|
25
|
-
device: Detox.DetoxExportWrapper['device'];
|
26
|
-
element: Detox.DetoxExportWrapper['element'];
|
27
|
-
waitFor: Detox.DetoxExportWrapper['waitFor'];
|
28
|
-
expect: Detox.DetoxExportWrapper['expect'];
|
29
|
-
by: Detox.DetoxExportWrapper['by'];
|
30
|
-
web: Detox.DetoxExportWrapper['web'];
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
namespace Detox {
|
35
|
-
//#region DetoxConfig
|
36
|
-
|
37
|
-
interface DetoxConfig extends DetoxConfigurationCommon {
|
38
|
-
/**
|
39
|
-
* @example extends: './relative/detox.config'
|
40
|
-
* @example extends: '@my-org/detox-preset'
|
41
|
-
*/
|
42
|
-
extends?: string;
|
43
|
-
|
44
|
-
apps?: Record<string, DetoxAppConfig>;
|
45
|
-
devices?: Record<string, DetoxDeviceConfig>;
|
46
|
-
selectedConfiguration?: string;
|
47
|
-
configurations: Record<string, DetoxConfiguration>;
|
48
|
-
}
|
49
|
-
|
50
|
-
type DetoxConfigurationCommon = {
|
51
|
-
artifacts?: false | DetoxArtifactsConfig;
|
52
|
-
behavior?: DetoxBehaviorConfig;
|
53
|
-
logger?: DetoxLoggerConfig;
|
54
|
-
session?: DetoxSessionConfig;
|
55
|
-
testRunner?: DetoxTestRunnerConfig;
|
56
|
-
};
|
57
|
-
|
58
|
-
interface DetoxArtifactsConfig {
|
59
|
-
rootDir?: string;
|
60
|
-
pathBuilder?: string;
|
61
|
-
plugins?: {
|
62
|
-
log?: 'none' | 'failing' | 'all' | DetoxLogArtifactsPluginConfig;
|
63
|
-
screenshot?: 'none' | 'manual' | 'failing' | 'all' | DetoxScreenshotArtifactsPluginConfig;
|
64
|
-
video?: 'none' | 'failing' | 'all' | DetoxVideoArtifactsPluginConfig;
|
65
|
-
instruments?: 'none' | 'all' | DetoxInstrumentsArtifactsPluginConfig;
|
66
|
-
uiHierarchy?: 'disabled' | 'enabled' | DetoxUIHierarchyArtifactsPluginConfig;
|
67
|
-
|
68
|
-
[pluginId: string]: unknown;
|
69
|
-
};
|
70
|
-
}
|
71
|
-
|
72
|
-
interface DetoxBehaviorConfig {
|
73
|
-
init?: {
|
74
|
-
/**
|
75
|
-
* By default, Detox exports `device`, `expect`, `element`, `by` and `waitFor`
|
76
|
-
* as global variables. If you want to control their initialization manually,
|
77
|
-
* set this property to `false`.
|
78
|
-
*
|
79
|
-
* This is useful when during E2E tests you also need to run regular expectations
|
80
|
-
* in Node.js. Jest's `expect` for instance, will not be overridden by Detox when
|
81
|
-
* this option is used.
|
82
|
-
*/
|
83
|
-
exposeGlobals?: boolean;
|
84
|
-
/**
|
85
|
-
* By default, Detox will uninstall and install the app upon initialization.
|
86
|
-
* If you wish to reuse the existing app for a faster run, set the property to
|
87
|
-
* `false`.
|
88
|
-
*/
|
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;
|
102
|
-
};
|
103
|
-
launchApp?: 'auto' | 'manual';
|
104
|
-
cleanup?: {
|
105
|
-
shutdownDevice?: boolean;
|
106
|
-
};
|
107
|
-
}
|
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
|
-
|
148
|
-
interface DetoxSessionConfig {
|
149
|
-
autoStart?: boolean;
|
150
|
-
debugSynchronization?: number;
|
151
|
-
server?: string;
|
152
|
-
sessionId?: string;
|
153
|
-
}
|
154
|
-
|
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) & {
|
277
|
-
/**
|
278
|
-
* App name to use with device.selectApp(appName) calls.
|
279
|
-
* Can be omitted if you have a single app under the test.
|
280
|
-
*
|
281
|
-
* @see Device#selectApp
|
282
|
-
*/
|
283
|
-
name?: string;
|
284
|
-
};
|
285
|
-
|
286
|
-
type DetoxDeviceConfig = DetoxBuiltInDeviceConfig | DetoxCustomDriverConfig;
|
287
|
-
|
288
|
-
interface DetoxLogArtifactsPluginConfig {
|
289
|
-
enabled?: boolean;
|
290
|
-
keepOnlyFailedTestsArtifacts?: boolean;
|
291
|
-
}
|
292
|
-
|
293
|
-
interface DetoxScreenshotArtifactsPluginConfig {
|
294
|
-
enabled?: boolean;
|
295
|
-
keepOnlyFailedTestsArtifacts?: boolean;
|
296
|
-
shouldTakeAutomaticSnapshots?: boolean;
|
297
|
-
takeWhen?: {
|
298
|
-
testStart?: boolean;
|
299
|
-
testFailure?: boolean;
|
300
|
-
testDone?: boolean;
|
301
|
-
appNotReady?: boolean;
|
302
|
-
};
|
303
|
-
}
|
304
|
-
|
305
|
-
interface DetoxVideoArtifactsPluginConfig {
|
306
|
-
enabled?: boolean;
|
307
|
-
keepOnlyFailedTestsArtifacts?: boolean;
|
308
|
-
android?: Partial<{
|
309
|
-
size: [number, number];
|
310
|
-
bitRate: number;
|
311
|
-
timeLimit: number;
|
312
|
-
verbose: boolean;
|
313
|
-
}>;
|
314
|
-
simulator?: Partial<{
|
315
|
-
codec: string;
|
316
|
-
}>;
|
317
|
-
}
|
318
|
-
|
319
|
-
interface DetoxInstrumentsArtifactsPluginConfig {
|
320
|
-
enabled?: boolean;
|
321
|
-
}
|
322
|
-
|
323
|
-
interface DetoxUIHierarchyArtifactsPluginConfig {
|
324
|
-
enabled?: boolean;
|
325
|
-
}
|
326
|
-
|
327
|
-
type DetoxBuiltInAppConfig = (DetoxIosAppConfig | DetoxAndroidAppConfig);
|
328
|
-
|
329
|
-
interface DetoxIosAppConfig {
|
330
|
-
type: 'ios.app';
|
331
|
-
binaryPath: string;
|
332
|
-
bundleId?: string;
|
333
|
-
build?: string;
|
334
|
-
start?: string;
|
335
|
-
launchArgs?: Record<string, any>;
|
336
|
-
}
|
337
|
-
|
338
|
-
interface DetoxAndroidAppConfig {
|
339
|
-
type: 'android.apk';
|
340
|
-
binaryPath: string;
|
341
|
-
bundleId?: string;
|
342
|
-
build?: string;
|
343
|
-
start?: string;
|
344
|
-
testBinaryPath?: string;
|
345
|
-
launchArgs?: Record<string, any>;
|
346
|
-
/**
|
347
|
-
* TCP ports to `adb reverse` upon the installation.
|
348
|
-
* E.g. 8081 - to be able to access React Native packager in Debug mode.
|
349
|
-
*
|
350
|
-
* @example [8081]
|
351
|
-
*/
|
352
|
-
reversePorts?: number[];
|
353
|
-
}
|
354
|
-
|
355
|
-
interface DetoxCustomAppConfig {
|
356
|
-
type: string;
|
357
|
-
|
358
|
-
[prop: string]: unknown;
|
359
|
-
}
|
360
|
-
|
361
|
-
type DetoxBuiltInDeviceConfig =
|
362
|
-
| DetoxIosSimulatorDriverConfig
|
363
|
-
| DetoxAttachedAndroidDriverConfig
|
364
|
-
| DetoxAndroidEmulatorDriverConfig
|
365
|
-
| DetoxGenymotionCloudDriverConfig;
|
366
|
-
|
367
|
-
interface DetoxIosSimulatorDriverConfig {
|
368
|
-
type: 'ios.simulator';
|
369
|
-
device: string | Partial<IosSimulatorQuery>;
|
370
|
-
bootArgs?: string;
|
371
|
-
}
|
372
|
-
|
373
|
-
interface DetoxSharedAndroidDriverConfig {
|
374
|
-
forceAdbInstall?: boolean;
|
375
|
-
utilBinaryPaths?: string[];
|
376
|
-
}
|
377
|
-
|
378
|
-
interface DetoxAttachedAndroidDriverConfig extends DetoxSharedAndroidDriverConfig {
|
379
|
-
type: 'android.attached';
|
380
|
-
device: string | { adbName: string };
|
381
|
-
}
|
382
|
-
|
383
|
-
interface DetoxAndroidEmulatorDriverConfig extends DetoxSharedAndroidDriverConfig {
|
384
|
-
type: 'android.emulator';
|
385
|
-
device: string | { avdName: string };
|
386
|
-
bootArgs?: string;
|
387
|
-
gpuMode?: 'auto' | 'host' | 'swiftshader_indirect' | 'angle_indirect' | 'guest' | 'off';
|
388
|
-
headless?: boolean;
|
389
|
-
/**
|
390
|
-
* @default true
|
391
|
-
*/
|
392
|
-
readonly?: boolean;
|
393
|
-
}
|
394
|
-
|
395
|
-
interface DetoxGenymotionCloudDriverConfig extends DetoxSharedAndroidDriverConfig {
|
396
|
-
type: 'android.genycloud';
|
397
|
-
device: string | { recipeUUID: string; } | { recipeName: string; };
|
398
|
-
}
|
399
|
-
|
400
|
-
interface DetoxCustomDriverConfig {
|
401
|
-
type: string;
|
402
|
-
|
403
|
-
[prop: string]: unknown;
|
404
|
-
}
|
405
|
-
|
406
|
-
interface IosSimulatorQuery {
|
407
|
-
id: string;
|
408
|
-
type: string;
|
409
|
-
name: string;
|
410
|
-
os: string;
|
411
|
-
}
|
412
|
-
|
413
|
-
type DetoxConfiguration = DetoxConfigurationCommon & (
|
414
|
-
| DetoxConfigurationSingleApp
|
415
|
-
| DetoxConfigurationMultiApps
|
416
|
-
);
|
417
|
-
|
418
|
-
interface DetoxConfigurationSingleApp {
|
419
|
-
device: DetoxAliasedDevice;
|
420
|
-
app: DetoxAliasedApp;
|
421
|
-
}
|
422
|
-
|
423
|
-
interface DetoxConfigurationMultiApps {
|
424
|
-
device: DetoxAliasedDevice;
|
425
|
-
apps: DetoxAliasedApp[];
|
426
|
-
}
|
427
|
-
|
428
|
-
type DetoxAliasedDevice = string | DetoxDeviceConfig;
|
429
|
-
|
430
|
-
type DetoxAliasedApp = string | DetoxAppConfig;
|
431
|
-
|
432
|
-
//#endregion
|
433
|
-
|
434
|
-
interface DetoxExportWrapper {
|
435
|
-
readonly device: Device;
|
436
|
-
|
437
|
-
readonly element: ElementFacade;
|
438
|
-
|
439
|
-
readonly waitFor: WaitForFacade;
|
440
|
-
|
441
|
-
readonly expect: ExpectFacade;
|
442
|
-
|
443
|
-
readonly by: ByFacade;
|
444
|
-
|
445
|
-
readonly web: WebFacade;
|
446
|
-
|
447
|
-
readonly DetoxConstants: {
|
448
|
-
userNotificationTriggers: {
|
449
|
-
push: 'push';
|
450
|
-
calendar: 'calendar';
|
451
|
-
timeInterval: 'timeInterval';
|
452
|
-
location: 'location';
|
453
|
-
};
|
454
|
-
userActivityTypes: {
|
455
|
-
searchableItem: string;
|
456
|
-
browsingWeb: string;
|
457
|
-
},
|
458
|
-
searchableItemActivityIdentifier: string;
|
459
|
-
};
|
460
|
-
|
461
|
-
/**
|
462
|
-
* Detox logger instance. Can be used for saving user logs to the general log file.
|
463
|
-
*/
|
464
|
-
readonly log: Logger;
|
465
|
-
|
466
|
-
/**
|
467
|
-
* @deprecated
|
468
|
-
*
|
469
|
-
* Deprecated - use {@link Detox.Logger#trace}
|
470
|
-
* Detox tracer instance. Can be used for building timelines in Google Event Tracing format.
|
471
|
-
*/
|
472
|
-
readonly trace: {
|
473
|
-
/** @deprecated */
|
474
|
-
readonly startSection: (name: string) => void;
|
475
|
-
/** @deprecated */
|
476
|
-
readonly endSection: (name: string) => void;
|
477
|
-
};
|
478
|
-
|
479
|
-
/**
|
480
|
-
* Trace a single call, with a given name and arguments.
|
481
|
-
*
|
482
|
-
* @deprecated
|
483
|
-
* @param sectionName The name of the section to trace.
|
484
|
-
* @param promiseOrFunction Promise or a function that provides a promise.
|
485
|
-
* @param args Optional arguments to pass to the trace.
|
486
|
-
* @returns The returned value of the traced call.
|
487
|
-
* @see https://wix.github.io/Detox/docs/19.x/api/detox-object-api/#detoxtracecall
|
488
|
-
*/
|
489
|
-
readonly traceCall: <T>(event: string, action: () => Promise<T>, args?: Record<string, unknown>) => Promise<T>;
|
490
|
-
}
|
491
|
-
|
492
|
-
interface Logger {
|
493
|
-
readonly level: DetoxLogLevel;
|
494
|
-
|
495
|
-
readonly fatal: _LogMethod;
|
496
|
-
readonly error: _LogMethod;
|
497
|
-
readonly warn: _LogMethod;
|
498
|
-
readonly info: _LogMethod;
|
499
|
-
readonly debug: _LogMethod;
|
500
|
-
readonly trace: _LogMethod;
|
501
|
-
|
502
|
-
child(context?: Partial<LogEvent>): Logger;
|
503
|
-
}
|
504
|
-
|
505
|
-
/** @internal */
|
506
|
-
interface _LogMethod extends _LogMethodSignature {
|
507
|
-
readonly begin: _LogMethodSignature;
|
508
|
-
readonly complete: _CompleteMethodSignature;
|
509
|
-
readonly end: _LogMethodSignature;
|
510
|
-
}
|
511
|
-
|
512
|
-
/** @internal */
|
513
|
-
interface _LogMethodSignature {
|
514
|
-
(...args: unknown[]): void
|
515
|
-
(event: LogEvent, ...args: unknown[]): void;
|
516
|
-
}
|
517
|
-
|
518
|
-
/** @internal */
|
519
|
-
interface _CompleteMethodSignature {
|
520
|
-
<T>(message: string, action: T | (() => T)): T;
|
521
|
-
<T>(event: LogEvent, message: string, action: T | (() => T)): T;
|
522
|
-
}
|
523
|
-
|
524
|
-
type LogEvent = {
|
525
|
-
/** Use when there's a risk of logging several parallel duration events. */
|
526
|
-
id?: string | number;
|
527
|
-
/** Optional. Event categories (tags) to facilitate filtering. */
|
528
|
-
cat?: string | string[];
|
529
|
-
/** Optional. Color name (applicable in Google Chrome Trace Format) */
|
530
|
-
cname?: string;
|
531
|
-
|
532
|
-
/** Reserved property. Process ID. */
|
533
|
-
pid?: never;
|
534
|
-
/** Reserved property. Thread ID. */
|
535
|
-
tid?: never;
|
536
|
-
/** Reserved property. Timestamp. */
|
537
|
-
ts?: never;
|
538
|
-
/** Reserved property. Event phase. */
|
539
|
-
ph?: never;
|
540
|
-
|
541
|
-
[customProperty: string]: unknown;
|
542
|
-
};
|
543
|
-
|
544
|
-
type DetoxLogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
545
|
-
|
546
|
-
type Point2D = {
|
547
|
-
x: number,
|
548
|
-
y: number,
|
549
|
-
}
|
550
|
-
|
551
|
-
/**
|
552
|
-
* A construct allowing for the querying and modification of user arguments passed to an app upon launch by Detox.
|
553
|
-
*
|
554
|
-
* @see AppLaunchArgs#modify
|
555
|
-
* @see AppLaunchArgs#reset
|
556
|
-
* @see AppLaunchArgs#get
|
557
|
-
*/
|
558
|
-
interface AppLaunchArgs {
|
559
|
-
/**
|
560
|
-
* Shared (global) arguments that are not specific to a particular application.
|
561
|
-
* Selecting another app does not reset them, yet they still can be overridden
|
562
|
-
* by configuring app-specific launch args.
|
563
|
-
* @see Device#selectApp
|
564
|
-
* @see AppLaunchArgs
|
565
|
-
*/
|
566
|
-
readonly shared: ScopedAppLaunchArgs;
|
567
|
-
|
568
|
-
/**
|
569
|
-
* Modify the launch-arguments via a modifier object, according to the following logic:
|
570
|
-
* - Non-nullish modifier properties would set a new value or override the previous value of
|
571
|
-
* existing properties with the same name.
|
572
|
-
* - Modifier properties set to either `undefined` or `null` would delete the corresponding property
|
573
|
-
* if it existed.
|
574
|
-
* These custom app launch arguments get erased whenever you select a different application.
|
575
|
-
* If you need to share them between all the applications, use {@link AppLaunchArgs#shared} property.
|
576
|
-
* Note: app-specific launch args have a priority over shared ones.
|
577
|
-
*
|
578
|
-
* @param modifier The modifier object.
|
579
|
-
* @example
|
580
|
-
* // With current launch arguments set to:
|
581
|
-
* // {
|
582
|
-
* // mockServerPort: 1234,
|
583
|
-
* // mockServerCredentials: 'user@test.com:12345678',
|
584
|
-
* // }
|
585
|
-
* device.appLaunchArgs.modify({
|
586
|
-
* mockServerPort: 4321,
|
587
|
-
* mockServerCredentials: null,
|
588
|
-
* mockServerToken: 'abcdef',
|
589
|
-
* });
|
590
|
-
* await device.launchApp();
|
591
|
-
* // ==> launch-arguments become:
|
592
|
-
* // {
|
593
|
-
* // mockServerPort: 4321,
|
594
|
-
* // mockServerToken: 'abcdef',
|
595
|
-
* // }
|
596
|
-
*/
|
597
|
-
modify(modifier: object): this;
|
598
|
-
|
599
|
-
/**
|
600
|
-
* Reset all app-specific launch arguments (back to an empty object).
|
601
|
-
* If you need to reset the shared launch args, use {@link AppLaunchArgs#shared}.
|
602
|
-
*/
|
603
|
-
reset(): this;
|
604
|
-
|
605
|
-
/**
|
606
|
-
* Get all currently set launch arguments (including shared ones).
|
607
|
-
* @returns An object containing all launch-arguments.
|
608
|
-
* Note: mutating the values inside the result object is pointless, as it is immutable.
|
609
|
-
*/
|
610
|
-
get(): object;
|
611
|
-
}
|
612
|
-
|
613
|
-
/**
|
614
|
-
* Shared (global) arguments that are not specific to a particular application.
|
615
|
-
*/
|
616
|
-
interface ScopedAppLaunchArgs {
|
617
|
-
/** @see AppLaunchArgs#modify */
|
618
|
-
modify(modifier: object): this;
|
619
|
-
|
620
|
-
/** @see AppLaunchArgs#reset */
|
621
|
-
reset(): this;
|
622
|
-
|
623
|
-
/** @see AppLaunchArgs#get */
|
624
|
-
get(): object;
|
625
|
-
}
|
626
|
-
|
627
|
-
interface Device {
|
628
|
-
/**
|
629
|
-
* 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 -
|
630
|
-
* as used by simctl (e.g. AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE).
|
631
|
-
*/
|
632
|
-
id: string;
|
633
|
-
/**
|
634
|
-
* Holds a descriptive name of the device. Example: emulator-5554 (Pixel_API_29)
|
635
|
-
*/
|
636
|
-
name: string;
|
637
|
-
|
638
|
-
/**
|
639
|
-
* Select the current app (relevant only to multi-app configs) by its name.
|
640
|
-
* After execution, all app-specific device methods will target the selected app.
|
641
|
-
*
|
642
|
-
* @see DetoxAppConfig#name
|
643
|
-
* @example
|
644
|
-
* await device.selectApp('passenger');
|
645
|
-
* await device.launchApp(); // passenger
|
646
|
-
* // ... run tests for the passenger app
|
647
|
-
* await device.uninstallApp(); // passenger
|
648
|
-
* await device.selectApp('driver');
|
649
|
-
* await device.installApp(); // driver
|
650
|
-
* await device.launchApp(); // driver
|
651
|
-
* // ... run tests for the driver app
|
652
|
-
* await device.terminateApp(); // driver
|
653
|
-
*/
|
654
|
-
selectApp(app: string): Promise<void>;
|
655
|
-
|
656
|
-
/**
|
657
|
-
* Launch the app.
|
658
|
-
*
|
659
|
-
* <p>For info regarding launch arguments, refer to the [dedicated guide](https://wix.github.io/Detox/docs/api/launch-args).
|
660
|
-
*
|
661
|
-
* @example
|
662
|
-
* // Terminate the app and launch it again. If set to false, the simulator will try to bring app from background,
|
663
|
-
* // if the app isn't running, it will launch a new instance. default is false
|
664
|
-
* await device.launchApp({newInstance: true});
|
665
|
-
* @example
|
666
|
-
* // Grant or deny runtime permissions for your application.
|
667
|
-
* await device.launchApp({permissions: {calendar: 'YES'}});
|
668
|
-
* @example
|
669
|
-
* // Mock opening the app from URL to test your app's deep link handling mechanism.
|
670
|
-
* await device.launchApp({url: url});
|
671
|
-
* @example
|
672
|
-
* // Start the app with some custom arguments.
|
673
|
-
* await device.launchApp({
|
674
|
-
* launchArgs: {arg1: 1, arg2: "2"},
|
675
|
-
* });
|
676
|
-
*/
|
677
|
-
launchApp(config?: DeviceLaunchAppConfig): Promise<void>;
|
678
|
-
|
679
|
-
/**
|
680
|
-
* Relaunch the app. Convenience method that calls {@link Device#launchApp}
|
681
|
-
* with { newInstance: true } override.
|
682
|
-
*
|
683
|
-
* @deprecated
|
684
|
-
* @param config
|
685
|
-
* @see Device#launchApp
|
686
|
-
*/
|
687
|
-
relaunchApp(config?: DeviceLaunchAppConfig): Promise<void>;
|
688
|
-
|
689
|
-
/**
|
690
|
-
* Access the user-defined launch-arguments predefined through static scopes such as the Detox configuration file and
|
691
|
-
* command-line arguments. This access allows - through dedicated methods, for both value-querying and
|
692
|
-
* modification (see {@link AppLaunchArgs}).
|
693
|
-
* Refer to the [dedicated guide](https://wix.github.io/Detox/docs/api/launch-args) for complete details.
|
694
|
-
*
|
695
|
-
* @example
|
696
|
-
* // With Detox being preconfigured statically to use these arguments in app launch:
|
697
|
-
* // {
|
698
|
-
* // mockServerPort: 1234,
|
699
|
-
* // }
|
700
|
-
* // The following code would result in these arguments eventually passed into the launched app:
|
701
|
-
* // {
|
702
|
-
* // mockServerPort: 4321,
|
703
|
-
* // mockServerToken: 'uvwxyz',
|
704
|
-
* // }
|
705
|
-
* device.appLaunchArgs.modify({
|
706
|
-
* mockServerPort: 4321,
|
707
|
-
* mockServerToken: 'abcdef',
|
708
|
-
* });
|
709
|
-
* await device.launchApp({ launchArgs: { mockServerToken: 'uvwxyz' } }};
|
710
|
-
*
|
711
|
-
* @see AppLaunchArgs
|
712
|
-
*/
|
713
|
-
appLaunchArgs: AppLaunchArgs;
|
714
|
-
|
715
|
-
/**
|
716
|
-
* Terminate the app.
|
717
|
-
*
|
718
|
-
* @example
|
719
|
-
* // By default, terminateApp() with no params will terminate the app
|
720
|
-
* await device.terminateApp();
|
721
|
-
* @example
|
722
|
-
* // To terminate another app, specify its bundle id
|
723
|
-
* await device.terminateApp('other.bundle.id');
|
724
|
-
*/
|
725
|
-
terminateApp(bundle?: string): Promise<void>;
|
726
|
-
|
727
|
-
/**
|
728
|
-
* Send application to background by bringing com.apple.springboard to the foreground.
|
729
|
-
* Combining sendToHome() with launchApp({newInstance: false}) will simulate app coming back from background.
|
730
|
-
* @example
|
731
|
-
* await device.sendToHome();
|
732
|
-
* await device.launchApp({newInstance: false});
|
733
|
-
*/
|
734
|
-
sendToHome(): Promise<void>;
|
735
|
-
|
736
|
-
/**
|
737
|
-
* If this is a React Native app, reload the React Native JS bundle. This action is much faster than device.launchApp(), and can be used if you just need to reset your React Native logic.
|
738
|
-
*
|
739
|
-
* @example await device.reloadReactNative()
|
740
|
-
*/
|
741
|
-
reloadReactNative(): Promise<void>;
|
742
|
-
|
743
|
-
/**
|
744
|
-
* By default, installApp() with no params will install the app file defined in the current configuration.
|
745
|
-
* To install another app, specify its path
|
746
|
-
* @example await device.installApp();
|
747
|
-
* @example await device.installApp('path/to/other/app');
|
748
|
-
*/
|
749
|
-
installApp(path?: any): Promise<void>;
|
750
|
-
|
751
|
-
/**
|
752
|
-
* By default, uninstallApp() with no params will uninstall the app defined in the current configuration.
|
753
|
-
* To uninstall another app, specify its bundle id
|
754
|
-
* @example await device.installApp('other.bundle.id');
|
755
|
-
*/
|
756
|
-
uninstallApp(bundle?: string): Promise<void>;
|
757
|
-
|
758
|
-
/**
|
759
|
-
* Mock opening the app from URL. sourceApp is an optional parameter to specify source application bundle id.
|
760
|
-
*/
|
761
|
-
openURL(url: { url: string; sourceApp?: string }): Promise<void>;
|
762
|
-
|
763
|
-
/**
|
764
|
-
* Mock handling of received user notification when app is in foreground.
|
765
|
-
*/
|
766
|
-
sendUserNotification(...params: any[]): Promise<void>;
|
767
|
-
|
768
|
-
/**
|
769
|
-
* Mock handling of received user activity when app is in foreground.
|
770
|
-
*/
|
771
|
-
sendUserActivity(...params: any[]): Promise<void>;
|
772
|
-
|
773
|
-
/**
|
774
|
-
* Takes "portrait" or "landscape" and rotates the device to the given orientation. Currently only available in the iOS Simulator.
|
775
|
-
*/
|
776
|
-
setOrientation(orientation: Orientation): Promise<void>;
|
777
|
-
|
778
|
-
/**
|
779
|
-
* Sets the simulator/emulator location to the given latitude and longitude.
|
780
|
-
*
|
781
|
-
* <p/>On iOS `setLocation` is dependent on [fbsimctl](https://github.com/facebook/idb/tree/4b7929480c3c0f158f33f78a5b802c1d0e7030d2/fbsimctl)
|
782
|
-
* which [is now deprecated](https://github.com/wix/Detox/issues/1371).
|
783
|
-
* If `fbsimctl` is not installed, the command will fail, asking for it to be installed.
|
784
|
-
*
|
785
|
-
* <p/>On Android `setLocation` will work with both Android Emulator (bundled with Android development tools) and Genymotion.
|
786
|
-
* The correct permissions must be set in your app manifest.
|
787
|
-
*
|
788
|
-
* @example await device.setLocation(32.0853, 34.7818);
|
789
|
-
*/
|
790
|
-
setLocation(lat: number, lon: number): Promise<void>;
|
791
|
-
|
792
|
-
/**
|
793
|
-
* Disable network synchronization mechanism on preferred endpoints. Useful if you want to on skip over synchronizing on certain URLs.
|
794
|
-
*
|
795
|
-
* @example await device.setURLBlacklist(['.*127.0.0.1.*']);
|
796
|
-
*/
|
797
|
-
setURLBlacklist(urls: string[]): Promise<void>;
|
798
|
-
|
799
|
-
/**
|
800
|
-
* Temporarily disable synchronization (idle/busy monitoring) with the app - namely, stop waiting for the app to go idle before moving forward in the test execution.
|
801
|
-
*
|
802
|
-
* <p/>This API is useful for cases where test assertions must be made in an area of your application where it is okay for it to ever remain partly *busy* (e.g. due to an
|
803
|
-
* endlessly repeating on-screen animation). However, using it inherently suggests that you are likely to resort to applying `sleep()`'s in your test code - testing
|
804
|
-
* that area, **which is not recommended and can never be 100% stable.
|
805
|
-
* **Therefore, as a rule of thumb, test code running "inside" a sync-disabled mode must be reduced to the bare minimum.
|
806
|
-
*
|
807
|
-
* <p/>Note: Synchronization is enabled by default, and it gets **reenabled on every launch of a new instance of the app.**
|
808
|
-
*
|
809
|
-
* @example await device.disableSynchronization();
|
810
|
-
*/
|
811
|
-
disableSynchronization(): Promise<void>;
|
812
|
-
|
813
|
-
/**
|
814
|
-
* Reenable synchronization (idle/busy monitoring) with the app - namely, resume waiting for the app to go idle before moving forward in the test execution, after a
|
815
|
-
* previous disabling of it through a call to `device.disableSynchronization()`.
|
816
|
-
*
|
817
|
-
* <p/>Warning: Making this call would resume synchronization **instantly**, having its returned promise only resolve when the app becomes idle again.
|
818
|
-
* In other words, this **must only be called after you navigate back to "the safe zone", where the app should be able to eventually become idle again**, or it would
|
819
|
-
* remain suspended "forever" (i.e. until a safeguard time-out expires).
|
820
|
-
*
|
821
|
-
* @example await device.enableSynchronization();
|
822
|
-
*/
|
823
|
-
enableSynchronization(): Promise<void>;
|
824
|
-
|
825
|
-
/**
|
826
|
-
* Resets the Simulator to clean state (like the Simulator > Reset Content and Settings... menu item), especially removing previously set permissions.
|
827
|
-
*
|
828
|
-
* @example await device.resetContentAndSettings();
|
829
|
-
*/
|
830
|
-
resetContentAndSettings(): Promise<void>;
|
831
|
-
|
832
|
-
/**
|
833
|
-
* Returns the current device, ios or android.
|
834
|
-
*
|
835
|
-
* @example
|
836
|
-
* if (device.getPlatform() === 'ios') {
|
837
|
-
* await expect(loopSwitch).toHaveValue('1');
|
838
|
-
* }
|
839
|
-
*/
|
840
|
-
getPlatform(): 'ios' | 'android';
|
841
|
-
|
842
|
-
/**
|
843
|
-
* Takes a screenshot on the device and schedules putting it in the artifacts folder upon completion of the current test.
|
844
|
-
* @param name for the screenshot artifact
|
845
|
-
* @returns a temporary path to the screenshot.
|
846
|
-
* @example
|
847
|
-
* test('Menu items should have logout', async () => {
|
848
|
-
* const tempPath = await device.takeScreenshot('tap on menu');
|
849
|
-
* // The temporary path will remain valid until the test completion.
|
850
|
-
* // Afterwards, the screenshot will be moved, e.g.:
|
851
|
-
* // * on success, to: <artifacts-location>/✓ Menu items should have Logout/tap on menu.png
|
852
|
-
* // * on failure, to: <artifacts-location>/✗ Menu items should have Logout/tap on menu.png
|
853
|
-
* });
|
854
|
-
*/
|
855
|
-
takeScreenshot(name: string): Promise<string>;
|
856
|
-
|
857
|
-
/**
|
858
|
-
* (iOS only) Saves a view hierarchy snapshot (*.viewhierarchy) of the currently opened application
|
859
|
-
* to a temporary folder and schedules putting it to the artifacts folder upon the completion of
|
860
|
-
* the current test. The file can be opened later in Xcode 12.0 and above.
|
861
|
-
* @see https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes#:~:text=57933113
|
862
|
-
* @param [name="capture"] optional name for the *.viewhierarchy artifact
|
863
|
-
* @returns a temporary path to the captured view hierarchy snapshot.
|
864
|
-
* @example
|
865
|
-
* test('Menu items should have logout', async () => {
|
866
|
-
* await device.captureViewHierarchy('myElements');
|
867
|
-
* // The temporary path will remain valid until the test completion.
|
868
|
-
* // Afterwards, the artifact will be moved, e.g.:
|
869
|
-
* // * on success, to: <artifacts-location>/✓ Menu items should have Logout/myElements.viewhierarchy
|
870
|
-
* // * on failure, to: <artifacts-location>/✗ Menu items should have Logout/myElements.viewhierarchy
|
871
|
-
* });
|
872
|
-
*/
|
873
|
-
captureViewHierarchy(name?: string): Promise<string>;
|
874
|
-
|
875
|
-
/**
|
876
|
-
* Simulate shake (iOS Only)
|
877
|
-
*/
|
878
|
-
shake(): Promise<void>;
|
879
|
-
|
880
|
-
/**
|
881
|
-
* Toggles device enrollment in biometric auth (TouchID or FaceID) (iOS Only)
|
882
|
-
* @example await device.setBiometricEnrollment(true);
|
883
|
-
* @example await device.setBiometricEnrollment(false);
|
884
|
-
*/
|
885
|
-
setBiometricEnrollment(enabled: boolean): Promise<void>;
|
886
|
-
|
887
|
-
/**
|
888
|
-
* Simulates the success of a face match via FaceID (iOS Only)
|
889
|
-
*/
|
890
|
-
matchFace(): Promise<void>;
|
891
|
-
|
892
|
-
/**
|
893
|
-
* Simulates the failure of a face match via FaceID (iOS Only)
|
894
|
-
*/
|
895
|
-
unmatchFace(): Promise<void>;
|
896
|
-
|
897
|
-
/**
|
898
|
-
* Simulates the success of a finger match via TouchID (iOS Only)
|
899
|
-
*/
|
900
|
-
matchFinger(): Promise<void>;
|
901
|
-
|
902
|
-
/**
|
903
|
-
* Simulates the failure of a finger match via TouchID (iOS Only)
|
904
|
-
*/
|
905
|
-
unmatchFinger(): Promise<void>;
|
906
|
-
|
907
|
-
/**
|
908
|
-
* Clears the simulator keychain (iOS Only)
|
909
|
-
*/
|
910
|
-
clearKeychain(): Promise<void>;
|
911
|
-
|
912
|
-
/**
|
913
|
-
* Simulate press back button (Android Only)
|
914
|
-
* @example await device.pressBack();
|
915
|
-
*/
|
916
|
-
pressBack(): Promise<void>;
|
917
|
-
|
918
|
-
/**
|
919
|
-
* (Android Only)
|
920
|
-
* Exposes UiAutomator's UiDevice API (https://developer.android.com/reference/android/support/test/uiautomator/UiDevice).
|
921
|
-
* This is not a part of the official Detox API,
|
922
|
-
* it may break and change whenever an update to UiDevice or UiAutomator gradle dependencies ('androidx.test.uiautomator:uiautomator') is introduced.
|
923
|
-
* UIDevice's autogenerated code reference: https://github.com/wix/Detox/blob/master/detox/src/android/espressoapi/UIDevice.js
|
924
|
-
*/
|
925
|
-
getUiDevice(): Promise<void>;
|
926
|
-
|
927
|
-
/**
|
928
|
-
* (Android Only)
|
929
|
-
* Runs `adb reverse tcp:PORT tcp:PORT` for the current device
|
930
|
-
* to enable network requests forwarding on localhost:PORT (computer<->device).
|
931
|
-
* For more information, see {@link https://www.reddit.com/r/reactnative/comments/5etpqw/what_do_you_call_what_adb_reverse_is_doing|here}.
|
932
|
-
* This is a no-op when running on iOS.
|
933
|
-
*/
|
934
|
-
reverseTcpPort(port: number): Promise<void>;
|
935
|
-
|
936
|
-
/**
|
937
|
-
* (Android Only)
|
938
|
-
* Runs `adb reverse --remove tcp:PORT tcp:PORT` for the current device
|
939
|
-
* to disable network requests forwarding on localhost:PORT (computer<->device).
|
940
|
-
* For more information, see {@link https://www.reddit.com/r/reactnative/comments/5etpqw/what_do_you_call_what_adb_reverse_is_doing|here}.
|
941
|
-
* This is a no-op when running on iOS.
|
942
|
-
*/
|
943
|
-
unreverseTcpPort(port: number): Promise<void>;
|
944
|
-
}
|
945
|
-
|
946
|
-
/**
|
947
|
-
* @deprecated
|
948
|
-
*/
|
949
|
-
type DetoxAny = NativeElement & WaitFor;
|
950
|
-
|
951
|
-
interface ElementFacade {
|
952
|
-
(by: NativeMatcher): IndexableNativeElement;
|
953
|
-
}
|
954
|
-
|
955
|
-
interface IndexableNativeElement extends NativeElement {
|
956
|
-
/**
|
957
|
-
* Choose from multiple elements matching the same matcher using index
|
958
|
-
* @example await element(by.text('Product')).atIndex(2).tap();
|
959
|
-
*/
|
960
|
-
atIndex(index: number): NativeElement;
|
961
|
-
}
|
962
|
-
|
963
|
-
interface NativeElement extends NativeElementActions {
|
964
|
-
}
|
965
|
-
|
966
|
-
interface ByFacade {
|
967
|
-
/**
|
968
|
-
* by.id will match an id that is given to the view via testID prop.
|
969
|
-
* @example
|
970
|
-
* // In a React Native component add testID like so:
|
971
|
-
* <TouchableOpacity testID={'tap_me'}>
|
972
|
-
* // Then match with by.id:
|
973
|
-
* await element(by.id('tap_me'));
|
974
|
-
* await element(by.id(/^tap_[a-z]+$/));
|
975
|
-
*/
|
976
|
-
id(id: string | RegExp): NativeMatcher;
|
977
|
-
|
978
|
-
/**
|
979
|
-
* Find an element by text, useful for text fields, buttons.
|
980
|
-
* @example
|
981
|
-
* await element(by.text('Tap Me'));
|
982
|
-
* await element(by.text(/^Tap .*$/));
|
983
|
-
*/
|
984
|
-
text(text: string | RegExp): NativeMatcher;
|
985
|
-
|
986
|
-
/**
|
987
|
-
* Find an element by accessibilityLabel on iOS, or by contentDescription on Android.
|
988
|
-
* @example
|
989
|
-
* await element(by.label('Welcome'));
|
990
|
-
* await element(by.label(/[a-z]+/i));
|
991
|
-
*/
|
992
|
-
label(label: string | RegExp): NativeMatcher;
|
993
|
-
|
994
|
-
/**
|
995
|
-
* Find an element by native view type.
|
996
|
-
* @example await element(by.type('RCTImageView'));
|
997
|
-
*/
|
998
|
-
type(nativeViewType: string): NativeMatcher;
|
999
|
-
|
1000
|
-
/**
|
1001
|
-
* Find an element with an accessibility trait. (iOS only)
|
1002
|
-
* @example await element(by.traits(['button']));
|
1003
|
-
*/
|
1004
|
-
traits(traits: string[]): NativeMatcher;
|
1005
|
-
|
1006
|
-
/**
|
1007
|
-
* Collection of web matchers
|
1008
|
-
*/
|
1009
|
-
readonly web: ByWebFacade;
|
1010
|
-
}
|
1011
|
-
|
1012
|
-
interface ByWebFacade {
|
1013
|
-
/**
|
1014
|
-
* (Android Only)
|
1015
|
-
* Find an element on the DOM tree by its id
|
1016
|
-
* @param id
|
1017
|
-
* @example
|
1018
|
-
* web.element(by.web.id('testingh1'))
|
1019
|
-
*/
|
1020
|
-
id(id: string): WebMatcher;
|
1021
|
-
|
1022
|
-
/**
|
1023
|
-
* (Android Only)
|
1024
|
-
* Find an element on the DOM tree by its CSS class
|
1025
|
-
* @param className
|
1026
|
-
* @example
|
1027
|
-
* web.element(by.web.className('a'))
|
1028
|
-
*/
|
1029
|
-
className(className: string): WebMatcher;
|
1030
|
-
|
1031
|
-
/**
|
1032
|
-
* (Android Only)
|
1033
|
-
* Find an element on the DOM tree matching the given CSS selector
|
1034
|
-
* @param cssSelector
|
1035
|
-
* @example
|
1036
|
-
* web.element(by.web.cssSelector('#cssSelector'))
|
1037
|
-
*/
|
1038
|
-
cssSelector(cssSelector: string): WebMatcher;
|
1039
|
-
|
1040
|
-
/**
|
1041
|
-
* (Android Only)
|
1042
|
-
* Find an element on the DOM tree by its "name" attribute
|
1043
|
-
* @param name
|
1044
|
-
* @example
|
1045
|
-
* web.element(by.web.name('sec_input'))
|
1046
|
-
*/
|
1047
|
-
name(name: string): WebMatcher;
|
1048
|
-
|
1049
|
-
/**
|
1050
|
-
* (Android Only)
|
1051
|
-
* Find an element on the DOM tree by its XPath
|
1052
|
-
* @param xpath
|
1053
|
-
* @example
|
1054
|
-
* web.element(by.web.xpath('//*[@id="testingh1-1"]'))
|
1055
|
-
*/
|
1056
|
-
xpath(xpath: string): WebMatcher;
|
1057
|
-
|
1058
|
-
/**
|
1059
|
-
* (Android Only)
|
1060
|
-
* Find an <a> element on the DOM tree by its link text (href content)
|
1061
|
-
* @param linkText
|
1062
|
-
* @example
|
1063
|
-
* web.element(by.web.href('disney.com'))
|
1064
|
-
*/
|
1065
|
-
href(linkText: string): WebMatcher;
|
1066
|
-
|
1067
|
-
/**
|
1068
|
-
* (Android Only)
|
1069
|
-
* Find an <a> element on the DOM tree by its partial link text (href content)
|
1070
|
-
* @param linkTextFragment
|
1071
|
-
* @example
|
1072
|
-
* web.element(by.web.hrefContains('disney'))
|
1073
|
-
*/
|
1074
|
-
hrefContains(linkTextFragment: string): WebMatcher;
|
1075
|
-
|
1076
|
-
/**
|
1077
|
-
* (Android Only)
|
1078
|
-
* Find an element on the DOM tree by its tag name
|
1079
|
-
* @param tag
|
1080
|
-
* @example
|
1081
|
-
* web.element(by.web.tag('mark'))
|
1082
|
-
*/
|
1083
|
-
tag(tagName: string): WebMatcher;
|
1084
|
-
|
1085
|
-
/**
|
1086
|
-
* (iOS Only)
|
1087
|
-
* Find an element on the web-view by its text content
|
1088
|
-
* @param label
|
1089
|
-
* @example
|
1090
|
-
* web.element(by.web.label('Welcome'))
|
1091
|
-
*/
|
1092
|
-
label(label: string): WebMatcher;
|
1093
|
-
|
1094
|
-
/**
|
1095
|
-
* (iOS Only)
|
1096
|
-
* Find an element on the web-view by its content description
|
1097
|
-
* @param value
|
1098
|
-
* @example
|
1099
|
-
* web.element(by.web.value('Write a comment...'))
|
1100
|
-
*/
|
1101
|
-
value(value: string): WebMatcher;
|
1102
|
-
}
|
1103
|
-
|
1104
|
-
interface NativeMatcher {
|
1105
|
-
/**
|
1106
|
-
* Find an element satisfying all the matchers
|
1107
|
-
* @example await element(by.text('Product').and(by.id('product_name'));
|
1108
|
-
*/
|
1109
|
-
and(by: NativeMatcher): NativeMatcher;
|
1110
|
-
|
1111
|
-
/**
|
1112
|
-
* Find an element by a matcher with a parent matcher
|
1113
|
-
* @example await element(by.id('Grandson883').withAncestor(by.id('Son883')));
|
1114
|
-
*/
|
1115
|
-
withAncestor(parentBy: NativeMatcher): NativeMatcher;
|
1116
|
-
|
1117
|
-
/**
|
1118
|
-
* Find an element by a matcher with a child matcher
|
1119
|
-
* @example await element(by.id('Son883').withDescendant(by.id('Grandson883')));
|
1120
|
-
*/
|
1121
|
-
withDescendant(childBy: NativeMatcher): NativeMatcher;
|
1122
|
-
}
|
1123
|
-
|
1124
|
-
interface WebMatcher {
|
1125
|
-
__web__: any; // prevent type coersion
|
1126
|
-
}
|
1127
|
-
|
1128
|
-
interface ExpectFacade {
|
1129
|
-
(element: NativeElement): Expect;
|
1130
|
-
|
1131
|
-
(webElement: WebElement): WebExpect;
|
1132
|
-
}
|
1133
|
-
|
1134
|
-
interface WebViewElement {
|
1135
|
-
element(webMatcher: WebMatcher): IndexableWebElement;
|
1136
|
-
}
|
1137
|
-
|
1138
|
-
interface WebFacade extends WebViewElement {
|
1139
|
-
/**
|
1140
|
-
* Gets the webview element as a testing element.
|
1141
|
-
* @param matcher a simple view matcher for the webview element in th UI hierarchy.
|
1142
|
-
* If there is only ONE webview element in the UI hierarchy, its NOT a must to supply it.
|
1143
|
-
* If there are MORE then one webview element in the UI hierarchy you MUST supply are view matcher.
|
1144
|
-
*/
|
1145
|
-
(matcher?: NativeMatcher): WebViewElement;
|
1146
|
-
}
|
1147
|
-
|
1148
|
-
interface Expect<R = Promise<void>> {
|
1149
|
-
|
1150
|
-
/**
|
1151
|
-
* Expect the view to be at least N% visible. If no number is provided then defaults to 75%. Negating this
|
1152
|
-
* expectation with a `not` expects the view's visible area to be smaller than N%.
|
1153
|
-
* @param pct optional integer ranging from 1 to 100, indicating how much percent of the view should be
|
1154
|
-
* visible to the user to be accepted.
|
1155
|
-
* @example await expect(element(by.id('mainTitle'))).toBeVisible(35);
|
1156
|
-
*/
|
1157
|
-
toBeVisible(pct?: number): R;
|
1158
|
-
|
1159
|
-
/**
|
1160
|
-
* Negate the expectation.
|
1161
|
-
* @example await expect(element(by.id('cancelButton'))).not.toBeVisible();
|
1162
|
-
*/
|
1163
|
-
not: this;
|
1164
|
-
|
1165
|
-
/**
|
1166
|
-
* Expect the view to not be visible.
|
1167
|
-
* @example await expect(element(by.id('cancelButton'))).toBeNotVisible();
|
1168
|
-
* @deprecated Use `.not.toBeVisible()` instead.
|
1169
|
-
*/
|
1170
|
-
toBeNotVisible(): R;
|
1171
|
-
|
1172
|
-
/**
|
1173
|
-
* Expect the view to exist in the UI hierarchy.
|
1174
|
-
* @example await expect(element(by.id('okButton'))).toExist();
|
1175
|
-
*/
|
1176
|
-
toExist(): R;
|
1177
|
-
|
1178
|
-
/**
|
1179
|
-
* Expect the view to not exist in the UI hierarchy.
|
1180
|
-
* @example await expect(element(by.id('cancelButton'))).toNotExist();
|
1181
|
-
* @deprecated Use `.not.toExist()` instead.
|
1182
|
-
*/
|
1183
|
-
toNotExist(): R;
|
1184
|
-
|
1185
|
-
/**
|
1186
|
-
* Expect the view to be focused.
|
1187
|
-
* @example await expect(element(by.id('emailInput'))).toBeFocused();
|
1188
|
-
*/
|
1189
|
-
toBeFocused(): R;
|
1190
|
-
|
1191
|
-
/**
|
1192
|
-
* Expect the view not to be focused.
|
1193
|
-
* @example await expect(element(by.id('passwordInput'))).toBeNotFocused();
|
1194
|
-
* @deprecated Use `.not.toBeFocused()` instead.
|
1195
|
-
*/
|
1196
|
-
toBeNotFocused(): R;
|
1197
|
-
|
1198
|
-
/**
|
1199
|
-
* In React Native apps, expect UI component of type <Text> to have text.
|
1200
|
-
* In native iOS apps, expect UI elements of type UIButton, UILabel, UITextField or UITextViewIn to have inputText with text.
|
1201
|
-
* @example await expect(element(by.id('mainTitle'))).toHaveText('Welcome back!);
|
1202
|
-
*/
|
1203
|
-
toHaveText(text: string): R;
|
1204
|
-
|
1205
|
-
/**
|
1206
|
-
* Expects a specific accessibilityLabel, as specified via the `accessibilityLabel` prop in React Native.
|
1207
|
-
* On the native side (in both React Native and pure-native apps), that is equivalent to `accessibilityLabel`
|
1208
|
-
* on iOS and contentDescription on Android. Refer to Detox's documentation in order to learn about caveats
|
1209
|
-
* with accessibility-labels in React Native apps.
|
1210
|
-
* @example await expect(element(by.id('submitButton'))).toHaveLabel('Submit');
|
1211
|
-
*/
|
1212
|
-
toHaveLabel(label: string): R;
|
1213
|
-
|
1214
|
-
/**
|
1215
|
-
* In React Native apps, expect UI component to have testID with that id.
|
1216
|
-
* In native iOS apps, expect UI element to have accessibilityIdentifier with that id.
|
1217
|
-
* @example await expect(element(by.text('Submit'))).toHaveId('submitButton');
|
1218
|
-
*/
|
1219
|
-
toHaveId(id: string): R;
|
1220
|
-
|
1221
|
-
/**
|
1222
|
-
* Expects a toggle-able element (e.g. a Switch or a Check-Box) to be on/checked or off/unchecked.
|
1223
|
-
* As a reference, in react-native, this is the equivalent switch component.
|
1224
|
-
* @example await expect(element(by.id('switch'))).toHaveToggleValue(true);
|
1225
|
-
*/
|
1226
|
-
toHaveToggleValue(value: boolean): R;
|
1227
|
-
|
1228
|
-
/**
|
1229
|
-
* Expect components like a Switch to have a value ('0' for off, '1' for on).
|
1230
|
-
* @example await expect(element(by.id('temperatureDial'))).toHaveValue('25');
|
1231
|
-
*/
|
1232
|
-
toHaveValue(value: any): R;
|
1233
|
-
|
1234
|
-
/**
|
1235
|
-
* Expect Slider to have a position (0 - 1).
|
1236
|
-
* Can have an optional tolerance to take into account rounding issues on ios
|
1237
|
-
* @example await expect(element(by.id('SliderId'))).toHavePosition(0.75);
|
1238
|
-
* @example await expect(element(by.id('SliderId'))).toHavePosition(0.74, 0.1);
|
1239
|
-
*/
|
1240
|
-
toHaveSliderPosition(position: number, tolerance?: number): Promise<void>;
|
1241
|
-
}
|
1242
|
-
|
1243
|
-
interface WaitForFacade {
|
1244
|
-
/**
|
1245
|
-
* This API polls using the given expectation continuously until the expectation is met. Use manual synchronization with waitFor only as a last resort.
|
1246
|
-
* NOTE: Every waitFor call must set a timeout using withTimeout(). Calling waitFor without setting a timeout will do nothing.
|
1247
|
-
* @example await waitFor(element(by.id('bigButton'))).toExist().withTimeout(2000);
|
1248
|
-
*/
|
1249
|
-
(element: NativeElement): Expect<WaitFor>;
|
1250
|
-
}
|
1251
|
-
|
1252
|
-
interface WaitFor {
|
1253
|
-
/**
|
1254
|
-
* Waits for the condition to be met until the specified time (millis) have elapsed.
|
1255
|
-
* @example await waitFor(element(by.id('bigButton'))).toExist().withTimeout(2000);
|
1256
|
-
*/
|
1257
|
-
withTimeout(millis: number): Promise<void>;
|
1258
|
-
|
1259
|
-
/**
|
1260
|
-
* Performs the action repeatedly on the element until an expectation is met
|
1261
|
-
* @example await waitFor(element(by.text('Item #5'))).toBeVisible().whileElement(by.id('itemsList')).scroll(50, 'down');
|
1262
|
-
*/
|
1263
|
-
whileElement(by: NativeMatcher): NativeElement & WaitFor;
|
1264
|
-
|
1265
|
-
// TODO: not sure about & WaitFor - check if we can chain whileElement multiple times
|
1266
|
-
}
|
1267
|
-
|
1268
|
-
interface NativeElementActions {
|
1269
|
-
/**
|
1270
|
-
* Simulate tap on an element
|
1271
|
-
* @param point relative coordinates to the matched element (the element size could changes on different devices or even when changing the device font size)
|
1272
|
-
* @example await element(by.id('tappable')).tap();
|
1273
|
-
* @example await element(by.id('tappable')).tap({ x:5, y:10 });
|
1274
|
-
*/
|
1275
|
-
tap(point?: Point2D): Promise<void>;
|
1276
|
-
|
1277
|
-
/**
|
1278
|
-
* Simulate long press on an element
|
1279
|
-
* @param duration (iOS only) custom press duration time, in milliseconds. Optional (default is 1000ms).
|
1280
|
-
* @example await element(by.id('tappable')).longPress();
|
1281
|
-
*/
|
1282
|
-
longPress(duration?: number): Promise<void>;
|
1283
|
-
|
1284
|
-
/**
|
1285
|
-
* Simulate long press on an element and then drag it to the position of the target element. (iOS Only)
|
1286
|
-
* @example await element(by.id('draggable')).longPressAndDrag(2000, NaN, NaN, element(by.id('target')), NaN, NaN, 'fast', 0);
|
1287
|
-
*/
|
1288
|
-
longPressAndDrag(duration: number, normalizedPositionX: number, normalizedPositionY: number, targetElement: NativeElement,
|
1289
|
-
normalizedTargetPositionX: number, normalizedTargetPositionY: number, speed: Speed, holdDuration: number): Promise<void>;
|
1290
|
-
|
1291
|
-
/**
|
1292
|
-
* Simulate multiple taps on an element.
|
1293
|
-
* @param times number of times to tap
|
1294
|
-
* @example await element(by.id('tappable')).multiTap(3);
|
1295
|
-
*/
|
1296
|
-
multiTap(times: number): Promise<void>;
|
1297
|
-
|
1298
|
-
/**
|
1299
|
-
* Simulate tap at a specific point on an element.
|
1300
|
-
* Note: The point coordinates are relative to the matched element and the element size could changes on different devices or even when changing the device font size.
|
1301
|
-
* @example await element(by.id('tappable')).tapAtPoint({ x:5, y:10 });
|
1302
|
-
* @deprecated Use `.tap()` instead.
|
1303
|
-
*/
|
1304
|
-
tapAtPoint(point: Point2D): Promise<void>;
|
1305
|
-
|
1306
|
-
/**
|
1307
|
-
* Use the builtin keyboard to type text into a text field.
|
1308
|
-
* @example await element(by.id('textField')).typeText('passcode');
|
1309
|
-
*/
|
1310
|
-
typeText(text: string): Promise<void>;
|
1311
|
-
|
1312
|
-
/**
|
1313
|
-
* Paste text into a text field.
|
1314
|
-
* @example await element(by.id('textField')).replaceText('passcode again');
|
1315
|
-
*/
|
1316
|
-
replaceText(text: string): Promise<void>;
|
1317
|
-
|
1318
|
-
/**
|
1319
|
-
* Clear text from a text field.
|
1320
|
-
* @example await element(by.id('textField')).clearText();
|
1321
|
-
*/
|
1322
|
-
clearText(): Promise<void>;
|
1323
|
-
|
1324
|
-
/**
|
1325
|
-
* Taps the backspace key on the built-in keyboard.
|
1326
|
-
* @example await element(by.id('textField')).tapBackspaceKey();
|
1327
|
-
*/
|
1328
|
-
tapBackspaceKey(): Promise<void>;
|
1329
|
-
|
1330
|
-
/**
|
1331
|
-
* Taps the return key on the built-in keyboard.
|
1332
|
-
* @example await element(by.id('textField')).tapReturnKey();
|
1333
|
-
*/
|
1334
|
-
tapReturnKey(): Promise<void>;
|
1335
|
-
|
1336
|
-
/**
|
1337
|
-
* Scrolls a given amount of pixels in the provided direction, starting from the provided start positions.
|
1338
|
-
* @param pixels - independent device pixels
|
1339
|
-
* @param direction - left/right/up/down
|
1340
|
-
* @param startPositionX - the X starting scroll position, in percentage; valid input: `[0.0, 1.0]`, `NaN`; default: `NaN`—choose the best value automatically
|
1341
|
-
* @param startPositionY - the Y starting scroll position, in percentage; valid input: `[0.0, 1.0]`, `NaN`; default: `NaN`—choose the best value automatically
|
1342
|
-
* @example await element(by.id('scrollView')).scroll(100, 'down', NaN, 0.85);
|
1343
|
-
* @example await element(by.id('scrollView')).scroll(100, 'up');
|
1344
|
-
*/
|
1345
|
-
scroll(
|
1346
|
-
pixels: number,
|
1347
|
-
direction: Direction,
|
1348
|
-
startPositionX?: number,
|
1349
|
-
startPositionY?: number
|
1350
|
-
): Promise<void>;
|
1351
|
-
|
1352
|
-
/**
|
1353
|
-
* Scroll to index.
|
1354
|
-
* @example await element(by.id('scrollView')).scrollToIndex(10);
|
1355
|
-
*/
|
1356
|
-
scrollToIndex(
|
1357
|
-
index: Number
|
1358
|
-
): Promise<void>;
|
1359
|
-
|
1360
|
-
/**
|
1361
|
-
* Scroll to edge.
|
1362
|
-
* @example await element(by.id('scrollView')).scrollTo('bottom');
|
1363
|
-
* @example await element(by.id('scrollView')).scrollTo('top');
|
1364
|
-
*/
|
1365
|
-
scrollTo(edge: Direction): Promise<void>;
|
1366
|
-
|
1367
|
-
/**
|
1368
|
-
* Adjust slider to position.
|
1369
|
-
* @example await element(by.id('slider')).adjustSliderToPosition(0.75);
|
1370
|
-
*/
|
1371
|
-
adjustSliderToPosition(newPosition: number): Promise<void>;
|
1372
|
-
|
1373
|
-
/**
|
1374
|
-
* Swipes in the provided direction at the provided speed, started from percentage.
|
1375
|
-
* @param speed default: `fast`
|
1376
|
-
* @param percentage screen percentage to swipe; valid input: `[0.0, 1.0]`
|
1377
|
-
* @param optional normalizedStartingPointX X coordinate of swipe starting point, relative to the view width; valid input: `[0.0, 1.0]`
|
1378
|
-
* @param normalizedStartingPointY Y coordinate of swipe starting point, relative to the view height; valid input: `[0.0, 1.0]`
|
1379
|
-
* @example await element(by.id('scrollView')).swipe('down');
|
1380
|
-
* @example await element(by.id('scrollView')).swipe('down', 'fast');
|
1381
|
-
* @example await element(by.id('scrollView')).swipe('down', 'fast', 0.5);
|
1382
|
-
* @example await element(by.id('scrollView')).swipe('down', 'fast', 0.5, 0.2);
|
1383
|
-
* @example await element(by.id('scrollView')).swipe('down', 'fast', 0.5, 0.2, 0.5);
|
1384
|
-
*/
|
1385
|
-
swipe(direction: Direction, speed?: Speed, percentage?: number, normalizedStartingPointX?: number, normalizedStartingPointY?: number): Promise<void>;
|
1386
|
-
|
1387
|
-
/**
|
1388
|
-
* Sets a picker view’s column to the given value. This function supports both date pickers and general picker views. (iOS Only)
|
1389
|
-
* Note: When working with date pickers, you should always set an explicit locale when launching your app in order to prevent flakiness from different date and time styles.
|
1390
|
-
* See [here](https://wix.github.io/Detox/docs/api/device-object-api#9-launch-with-a-specific-language-ios-only) for more information.
|
1391
|
-
*
|
1392
|
-
* @param column number of datepicker column (starts from 0)
|
1393
|
-
* @param value string value in set column (must be correct)
|
1394
|
-
* @example
|
1395
|
-
* await expect(element(by.type('UIPickerView'))).toBeVisible();
|
1396
|
-
* await element(by.type('UIPickerView')).setColumnToValue(1,"6");
|
1397
|
-
* await element(by.type('UIPickerView')).setColumnToValue(2,"34");
|
1398
|
-
*/
|
1399
|
-
setColumnToValue(column: number, value: string): Promise<void>;
|
1400
|
-
|
1401
|
-
/**
|
1402
|
-
* Sets the date of a date-picker according to the specified date-string and format.
|
1403
|
-
* @param dateString Textual representation of a date (e.g. '2023/01/01'). Should be in coherence with the format specified by `dateFormat`.
|
1404
|
-
* @param dateFormat Format of `dateString`: Generally either 'ISO8601' or an explicitly specified format (e.g. 'yyyy/MM/dd'); It should
|
1405
|
-
* follow the rules of NSDateFormatter for iOS and DateTimeFormatter for Android.
|
1406
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
1407
|
-
* @example
|
1408
|
-
* await element(by.id('datePicker')).setDatePickerDate('2023-01-01T00:00:00Z', 'ISO8601');
|
1409
|
-
* await element(by.id('datePicker')).setDatePickerDate(new Date().toISOString(), 'ISO8601');
|
1410
|
-
* await element(by.id('datePicker')).setDatePickerDate('2023/01/01', 'yyyy/MM/dd');
|
1411
|
-
*/
|
1412
|
-
setDatePickerDate(dateString: string, dateFormat: string): Promise<void>;
|
1413
|
-
|
1414
|
-
/**
|
1415
|
-
* Triggers a given [accessibility action]{@link https://reactnative.dev/docs/accessibility#accessibility-actions}.
|
1416
|
-
* @param actionName - name of the accessibility action
|
1417
|
-
* @example await element(by.id('view')).performAccessibilityAction('activate');
|
1418
|
-
*/
|
1419
|
-
performAccessibilityAction(actionName: string): Promise<void>
|
1420
|
-
|
1421
|
-
/**
|
1422
|
-
* Pinches in the given direction with speed and angle. (iOS only)
|
1423
|
-
* @param angle value in radiant, default is `0`
|
1424
|
-
* @example
|
1425
|
-
* await expect(element(by.id('PinchableScrollView'))).toBeVisible();
|
1426
|
-
* await element(by.id('PinchableScrollView')).pinchWithAngle('outward', 'slow', 0);
|
1427
|
-
* @deprecated Use `.pinch()` instead.
|
1428
|
-
*/
|
1429
|
-
pinchWithAngle(direction: PinchDirection, speed: Speed, angle: number): Promise<void>;
|
1430
|
-
|
1431
|
-
/**
|
1432
|
-
* Pinches with the given scale, speed, and angle. (iOS only)
|
1433
|
-
* @param speed default is `fast`
|
1434
|
-
* @param angle value in radiant, default is `0`
|
1435
|
-
* @example
|
1436
|
-
* await element(by.id('PinchableScrollView')).pinch(1.1);
|
1437
|
-
* await element(by.id('PinchableScrollView')).pinch(2.0);
|
1438
|
-
* await element(by.id('PinchableScrollView')).pinch(0.001);
|
1439
|
-
*/
|
1440
|
-
pinch(scale: number, speed?: Speed, angle?: number): Promise<void>;
|
1441
|
-
|
1442
|
-
/**
|
1443
|
-
* Takes a screenshot of the element and schedules putting it in the artifacts folder upon completion of the current test.
|
1444
|
-
* For more information, see {@link https://wix.github.io/Detox/docs/api/screenshots#element-level-screenshots}
|
1445
|
-
* @param {string} name for the screenshot artifact
|
1446
|
-
* @returns {Promise<string>} a temporary path to the screenshot.
|
1447
|
-
* @example
|
1448
|
-
* test('Menu items should have logout', async () => {
|
1449
|
-
* const imagePath = await element(by.id('menuRoot')).takeScreenshot('tap on menu');
|
1450
|
-
* // The temporary path will remain valid until the test completion.
|
1451
|
-
* // Afterwards, the screenshot will be moved, e.g.:
|
1452
|
-
* // * on success, to: <artifacts-location>/✓ Menu items should have Logout/tap on menu.png
|
1453
|
-
* // * on failure, to: <artifacts-location>/✗ Menu items should have Logout/tap on menu.png
|
1454
|
-
* });
|
1455
|
-
*/
|
1456
|
-
takeScreenshot(name: string): Promise<string>;
|
1457
|
-
|
1458
|
-
/**
|
1459
|
-
* Gets the native (OS-dependent) attributes of the element.
|
1460
|
-
* For more information, see {@link https://wix.github.io/Detox/docs/api/actions-on-element/#getattributes}
|
1461
|
-
*
|
1462
|
-
* @example
|
1463
|
-
* test('Get the attributes for my text element', async () => {
|
1464
|
-
* const attributes = await element(by.id('myText')).getAttributes()
|
1465
|
-
* const jestExpect = require('expect');
|
1466
|
-
* // 'visible' attribute available on both iOS and Android
|
1467
|
-
* jestExpect(attributes.visible).toBe(true);
|
1468
|
-
* // 'activationPoint' attribute available on iOS only
|
1469
|
-
* jestExpect(attributes.activationPoint.x).toHaveValue(50);
|
1470
|
-
* // 'width' attribute available on Android only
|
1471
|
-
* jestExpect(attributes.width).toHaveValue(100);
|
1472
|
-
* })
|
1473
|
-
*/
|
1474
|
-
getAttributes(): Promise<IosElementAttributes | AndroidElementAttributes | { elements: IosElementAttributes[]; }>;
|
1475
|
-
}
|
1476
|
-
|
1477
|
-
interface WebExpect<R = Promise<void>> {
|
1478
|
-
/**
|
1479
|
-
* Negate the expectation.
|
1480
|
-
* @example await expect(web.element(by.web.id('sessionTimeout'))).not.toExist();
|
1481
|
-
*/
|
1482
|
-
not: this;
|
1483
|
-
|
1484
|
-
/**
|
1485
|
-
* Expect the element content to have the `text` supplied
|
1486
|
-
* @param text expected to be on the element content
|
1487
|
-
* @example
|
1488
|
-
* await expect(web.element(by.web.id('checkoutButton'))).toHaveText('Proceed to check out');
|
1489
|
-
*/
|
1490
|
-
toHaveText(text: string): R;
|
1491
|
-
|
1492
|
-
/**
|
1493
|
-
* Expect the view to exist in the webview DOM tree.
|
1494
|
-
* @example await expect(web.element(by.web.id('submitButton'))).toExist();
|
1495
|
-
*/
|
1496
|
-
toExist(): R;
|
1497
|
-
}
|
1498
|
-
|
1499
|
-
interface IndexableWebElement extends WebElement {
|
1500
|
-
/**
|
1501
|
-
* Choose from multiple elements matching the same matcher using index
|
1502
|
-
* @example await web.element(by.web.hrefContains('Details')).atIndex(2).tap();
|
1503
|
-
*/
|
1504
|
-
atIndex(index: number): WebElement;
|
1505
|
-
}
|
1506
|
-
|
1507
|
-
interface WebElement extends WebElementActions {
|
1508
|
-
}
|
1509
|
-
|
1510
|
-
interface WebElementActions {
|
1511
|
-
/**
|
1512
|
-
* Taps the element
|
1513
|
-
*/
|
1514
|
-
tap(): Promise<void>;
|
1515
|
-
|
1516
|
-
/**
|
1517
|
-
* @param text to type
|
1518
|
-
* @param isContentEditable whether its a ContentEditable element, default is false.
|
1519
|
-
*/
|
1520
|
-
typeText(text: string, isContentEditable: boolean): Promise<void>;
|
1521
|
-
|
1522
|
-
/**
|
1523
|
-
* At the moment not working on content-editable
|
1524
|
-
* @param text to replace with the old content.
|
1525
|
-
*/
|
1526
|
-
replaceText(text: string): Promise<void>;
|
1527
|
-
|
1528
|
-
/**
|
1529
|
-
* At the moment not working on content-editable
|
1530
|
-
*/
|
1531
|
-
clearText(): Promise<void>;
|
1532
|
-
|
1533
|
-
/**
|
1534
|
-
* scrolling to the view, the element top position will be at the top of the screen.
|
1535
|
-
*/
|
1536
|
-
scrollToView(): Promise<void>;
|
1537
|
-
|
1538
|
-
/**
|
1539
|
-
* Gets the input content
|
1540
|
-
*/
|
1541
|
-
getText(): Promise<string>;
|
1542
|
-
|
1543
|
-
/**
|
1544
|
-
* Calls the focus function on the element
|
1545
|
-
*/
|
1546
|
-
focus(): Promise<void>;
|
1547
|
-
|
1548
|
-
/**
|
1549
|
-
* Selects all the input content, works on ContentEditable at the moment.
|
1550
|
-
*/
|
1551
|
-
selectAllText(): Promise<void>;
|
1552
|
-
|
1553
|
-
/**
|
1554
|
-
* Moves the input cursor / caret to the end of the content, works on ContentEditable at the moment.
|
1555
|
-
*/
|
1556
|
-
moveCursorToEnd(): Promise<void>;
|
1557
|
-
|
1558
|
-
/**
|
1559
|
-
* Running a script on the element
|
1560
|
-
* @param script a method that accept the element as its first arg
|
1561
|
-
* @example function foo(element) { console.log(element); }
|
1562
|
-
*/
|
1563
|
-
runScript(script: string): Promise<any>;
|
1564
|
-
|
1565
|
-
/**
|
1566
|
-
* Running a script on the element that accept args
|
1567
|
-
* @param script a method that accept few args, and the element as the last arg.
|
1568
|
-
* @param args a list of args to pass to the script
|
1569
|
-
* @example function foo(a, b, c, element) { console.log(`${a}, ${b}, ${c}, ${element}`)}
|
1570
|
-
*/
|
1571
|
-
runScriptWithArgs(script: string, args: any[]): Promise<any>;
|
1572
|
-
|
1573
|
-
/**
|
1574
|
-
* Gets the current page url
|
1575
|
-
*/
|
1576
|
-
getCurrentUrl(): Promise<string>;
|
1577
|
-
|
1578
|
-
/**
|
1579
|
-
* Gets the current page title
|
1580
|
-
*/
|
1581
|
-
getTitle(): Promise<string>;
|
1582
|
-
}
|
1583
|
-
|
1584
|
-
type Direction = 'left' | 'right' | 'top' | 'bottom' | 'up' | 'down';
|
1585
|
-
|
1586
|
-
type PinchDirection = 'outward' | 'inward'
|
1587
|
-
|
1588
|
-
type Orientation = 'portrait' | 'landscape';
|
1589
|
-
|
1590
|
-
type Speed = 'fast' | 'slow';
|
1591
|
-
|
1592
|
-
interface LanguageAndLocale {
|
1593
|
-
language?: string;
|
1594
|
-
locale?: string;
|
1595
|
-
}
|
1596
|
-
|
1597
|
-
/**
|
1598
|
-
* Source for string definitions is https://github.com/wix/AppleSimulatorUtils
|
1599
|
-
*/
|
1600
|
-
interface DevicePermissions {
|
1601
|
-
location?: LocationPermission;
|
1602
|
-
notifications?: NotificationsPermission;
|
1603
|
-
calendar?: CalendarPermission;
|
1604
|
-
camera?: CameraPermission;
|
1605
|
-
contacts?: ContactsPermission;
|
1606
|
-
health?: HealthPermission;
|
1607
|
-
homekit?: HomekitPermission;
|
1608
|
-
medialibrary?: MediaLibraryPermission;
|
1609
|
-
microphone?: MicrophonePermission;
|
1610
|
-
motion?: MotionPermission;
|
1611
|
-
photos?: PhotosPermission;
|
1612
|
-
reminders?: RemindersPermission;
|
1613
|
-
siri?: SiriPermission;
|
1614
|
-
speech?: SpeechPermission;
|
1615
|
-
faceid?: FaceIDPermission;
|
1616
|
-
userTracking?: UserTrackingPermission;
|
1617
|
-
}
|
1618
|
-
|
1619
|
-
type LocationPermission = 'always' | 'inuse' | 'never' | 'unset';
|
1620
|
-
type PermissionState = 'YES' | 'NO' | 'unset';
|
1621
|
-
type CameraPermission = PermissionState;
|
1622
|
-
type ContactsPermission = PermissionState;
|
1623
|
-
type CalendarPermission = PermissionState;
|
1624
|
-
type HealthPermission = PermissionState;
|
1625
|
-
type HomekitPermission = PermissionState;
|
1626
|
-
type MediaLibraryPermission = PermissionState;
|
1627
|
-
type MicrophonePermission = PermissionState;
|
1628
|
-
type MotionPermission = PermissionState;
|
1629
|
-
type PhotosPermission = PermissionState;
|
1630
|
-
type RemindersPermission = PermissionState;
|
1631
|
-
type SiriPermission = PermissionState;
|
1632
|
-
type SpeechPermission = PermissionState;
|
1633
|
-
type NotificationsPermission = PermissionState;
|
1634
|
-
type FaceIDPermission = PermissionState;
|
1635
|
-
type UserTrackingPermission = PermissionState;
|
1636
|
-
|
1637
|
-
interface DeviceLaunchAppConfig {
|
1638
|
-
/**
|
1639
|
-
* Restart the app
|
1640
|
-
* Terminate the app and launch it again. If set to false, the simulator will try to bring app from background, if the app isn't running, it will launch a new instance. default is false
|
1641
|
-
*/
|
1642
|
-
newInstance?: boolean;
|
1643
|
-
/**
|
1644
|
-
* Set runtime permissions
|
1645
|
-
* Grant or deny runtime permissions for your application.
|
1646
|
-
*/
|
1647
|
-
permissions?: DevicePermissions;
|
1648
|
-
/**
|
1649
|
-
* Launch from URL
|
1650
|
-
* Mock opening the app from URL to test your app's deep link handling mechanism.
|
1651
|
-
*/
|
1652
|
-
url?: any;
|
1653
|
-
/**
|
1654
|
-
* Launch with user notifications
|
1655
|
-
*/
|
1656
|
-
userNotification?: any;
|
1657
|
-
/**
|
1658
|
-
* Launch with user activity
|
1659
|
-
*/
|
1660
|
-
userActivity?: any;
|
1661
|
-
/**
|
1662
|
-
* Launch into a fresh installation
|
1663
|
-
* A flag that enables relaunching into a fresh installation of the app (it will uninstall and install the binary again), default is false.
|
1664
|
-
*/
|
1665
|
-
delete?: boolean;
|
1666
|
-
/**
|
1667
|
-
* Arguments to pass-through into the app.
|
1668
|
-
* Refer to the [dedicated guide](https://wix.github.io/Detox/docs/api/launch-args) for complete details.
|
1669
|
-
*/
|
1670
|
-
launchArgs?: Record<string, any>;
|
1671
|
-
/**
|
1672
|
-
* Launch config for specifying the native language and locale
|
1673
|
-
*/
|
1674
|
-
languageAndLocale?: LanguageAndLocale;
|
1675
|
-
}
|
1676
|
-
|
1677
|
-
// Element Attributes Shared Among iOS and Android
|
1678
|
-
interface ElementAttributes {
|
1679
|
-
/**
|
1680
|
-
* Whether or not the element is enabled for user interaction.
|
1681
|
-
*/
|
1682
|
-
enabled: boolean;
|
1683
|
-
/**
|
1684
|
-
* The identifier of the element. Matches accessibilityIdentifier on iOS, and the main view tag, on Android - both commonly holding the component's test ID in React Native apps.
|
1685
|
-
*/
|
1686
|
-
identifier: string;
|
1687
|
-
/**
|
1688
|
-
* Whether the element is visible. On iOS, visibility is calculated for the activation point. On Android, the attribute directly holds the value returned by View.getLocalVisibleRect()).
|
1689
|
-
*/
|
1690
|
-
visible: boolean;
|
1691
|
-
/**
|
1692
|
-
* The text value of any textual element.
|
1693
|
-
*/
|
1694
|
-
text?: string;
|
1695
|
-
/**
|
1696
|
-
* The label of the element. Largely matches accessibilityLabel for ios, and contentDescription for android.
|
1697
|
-
* Refer to Detox's documentation (`toHaveLabel()` subsection) in order to learn about caveats associated with
|
1698
|
-
* this property in React Native apps.
|
1699
|
-
*/
|
1700
|
-
label?: string;
|
1701
|
-
/**
|
1702
|
-
* The placeholder text value of the element. Matches hint on android.
|
1703
|
-
*/
|
1704
|
-
placeholder?: string;
|
1705
|
-
/**
|
1706
|
-
* The value of the element, where applicable.
|
1707
|
-
* Matches accessibilityValue, on iOS.
|
1708
|
-
* For example: the position of a slider, or whether a checkbox has been marked (Android).
|
1709
|
-
*/
|
1710
|
-
value?: unknown;
|
1711
|
-
}
|
1712
|
-
|
1713
|
-
interface IosElementAttributeFrame {
|
1714
|
-
y: number;
|
1715
|
-
x: number;
|
1716
|
-
width: number;
|
1717
|
-
height: number;
|
1718
|
-
}
|
1719
|
-
|
1720
|
-
interface IosElementAttributeInsets {
|
1721
|
-
right: number;
|
1722
|
-
top: number;
|
1723
|
-
left: number;
|
1724
|
-
bottom: number;
|
1725
|
-
}
|
1726
|
-
|
1727
|
-
// iOS Specific Attributes
|
1728
|
-
interface IosElementAttributes extends ElementAttributes {
|
1729
|
-
/**
|
1730
|
-
* The [activation point]{@link https://developer.apple.com/documentation/objectivec/nsobject/1615179-accessibilityactivationpoint} of the element, in element coordinate space.
|
1731
|
-
*/
|
1732
|
-
activationPoint: Point2D;
|
1733
|
-
/**
|
1734
|
-
* The activation point of the element, in normalized percentage ([0.0, 1.0]).
|
1735
|
-
*/
|
1736
|
-
normalizedActivationPoint: Point2D;
|
1737
|
-
/**
|
1738
|
-
* Whether the element is hittable at the activation point.
|
1739
|
-
*/
|
1740
|
-
hittable: boolean;
|
1741
|
-
/**
|
1742
|
-
* The frame of the element, in screen coordinate space.
|
1743
|
-
*/
|
1744
|
-
frame: IosElementAttributeFrame;
|
1745
|
-
/**
|
1746
|
-
* The frame of the element, in container coordinate space.
|
1747
|
-
*/
|
1748
|
-
elementFrame: IosElementAttributeFrame;
|
1749
|
-
/**
|
1750
|
-
* The bounds of the element, in element coordinate space.
|
1751
|
-
*/
|
1752
|
-
elementBounds: IosElementAttributeFrame;
|
1753
|
-
/**
|
1754
|
-
* The safe area insets of the element, in element coordinate space.
|
1755
|
-
*/
|
1756
|
-
safeAreaInsets: IosElementAttributeInsets;
|
1757
|
-
/**
|
1758
|
-
* The safe area bounds of the element, in element coordinate space.
|
1759
|
-
*/
|
1760
|
-
elementSafeBounds: IosElementAttributeFrame;
|
1761
|
-
/**
|
1762
|
-
* The date of the element (if it is a date picker).
|
1763
|
-
*/
|
1764
|
-
date?: string;
|
1765
|
-
/**
|
1766
|
-
* The normalized slider position (if it is a slider).
|
1767
|
-
*/
|
1768
|
-
normalizedSliderPosition?: number;
|
1769
|
-
/**
|
1770
|
-
* The content offset (if it is a scroll view).
|
1771
|
-
*/
|
1772
|
-
contentOffset?: Point2D;
|
1773
|
-
/**
|
1774
|
-
* The content inset (if it is a scroll view).
|
1775
|
-
*/
|
1776
|
-
contentInset?: IosElementAttributeInsets;
|
1777
|
-
/**
|
1778
|
-
* The adjusted content inset (if it is a scroll view).
|
1779
|
-
*/
|
1780
|
-
adjustedContentInset?: IosElementAttributeInsets;
|
1781
|
-
/**
|
1782
|
-
* @example "<CALayer: 0x600003f759e0>"
|
1783
|
-
*/
|
1784
|
-
layer: string;
|
1785
|
-
}
|
1786
|
-
|
1787
|
-
// Android Specific Attributes
|
1788
|
-
interface AndroidElementAttributes extends ElementAttributes {
|
1789
|
-
/**
|
1790
|
-
* The OS visibility type associated with the element: visible, invisible or gone.
|
1791
|
-
*/
|
1792
|
-
visibility: 'visible' | 'invisible' | 'gone';
|
1793
|
-
/**
|
1794
|
-
* Width of the element, in pixels.
|
1795
|
-
*/
|
1796
|
-
width: number;
|
1797
|
-
/**
|
1798
|
-
* Height of the element, in pixels.
|
1799
|
-
*/
|
1800
|
-
height: number;
|
1801
|
-
/**
|
1802
|
-
* Elevation of the element.
|
1803
|
-
*/
|
1804
|
-
elevation: number;
|
1805
|
-
/**
|
1806
|
-
* Alpha value for the element.
|
1807
|
-
*/
|
1808
|
-
alpha: number;
|
1809
|
-
/**
|
1810
|
-
* Whether the element is the one currently in focus.
|
1811
|
-
*/
|
1812
|
-
focused: boolean;
|
1813
|
-
/**
|
1814
|
-
* The text size for the text element.
|
1815
|
-
*/
|
1816
|
-
textSize?: number;
|
1817
|
-
/**
|
1818
|
-
* The length of the text element (character count).
|
1819
|
-
*/
|
1820
|
-
length?: number;
|
1821
|
-
}
|
1822
|
-
}
|
1823
|
-
}
|
1
|
+
/// <reference path="detox.d.ts" />
|
2
|
+
/// <reference path="globals.d.ts" />
|
1824
3
|
|
1825
4
|
declare const detox: Detox.DetoxExportWrapper;
|
1826
5
|
export = detox;
|