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