@onslip/automation
- AndroidLogOptions
- AutomationContext
- AutomationOptions
- DeviceOptions
- LocatorOptions
- ReaderOptions
- SelectorOptions
- StartOptions
- iOSLogOptions
- collectLines
- execFile
- findWebViewContexts
- mkdir
- openWebView
- pipeline
- readCommandOutput
- sleep
- throwError
- writeFile
▸ collectLines(stream
): () => Promise
<string
[]>
Begins collecting and buffering lines from an async iterator, like the one returned by readCommandOutput. When the returned function is called, all lines are returned as an array.
Name | Type | Description |
---|---|---|
stream |
(stopSignal : Signal <boolean >) => AsyncIterable <undefined | string > |
A callback that should create the async iterator and stop generating lines when the provided signal becomes true. |
fn
A function that, when invoked, stops reading and returns all collected lines as an array.
▸ (): Promise
<string
[]>
Begins collecting and buffering lines from an async iterator, like the one returned by readCommandOutput. When the returned function is called, all lines are returned as an array.
Promise
<string
[]>
A function that, when invoked, stops reading and returns all collected lines as an array.
▸ execFile(file
): PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
Name | Type |
---|---|
file |
string |
PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
▸ execFile(file
, args
): PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
Name | Type |
---|---|
file |
string |
args |
undefined | null | readonly string [] |
PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
▸ execFile(file
, options
): PromiseWithChild
<{ stderr
: Buffer
; stdout
: Buffer
}>
Name | Type |
---|---|
file |
string |
options |
ExecFileOptionsWithBufferEncoding |
PromiseWithChild
<{ stderr
: Buffer
; stdout
: Buffer
}>
▸ execFile(file
, args
, options
): PromiseWithChild
<{ stderr
: Buffer
; stdout
: Buffer
}>
Name | Type |
---|---|
file |
string |
args |
undefined | null | readonly string [] |
options |
ExecFileOptionsWithBufferEncoding |
PromiseWithChild
<{ stderr
: Buffer
; stdout
: Buffer
}>
▸ execFile(file
, options
): PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
Name | Type |
---|---|
file |
string |
options |
ExecFileOptionsWithStringEncoding |
PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
▸ execFile(file
, args
, options
): PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
Name | Type |
---|---|
file |
string |
args |
undefined | null | readonly string [] |
options |
ExecFileOptionsWithStringEncoding |
PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
▸ execFile(file
, options
): PromiseWithChild
<{ stderr
: string
| Buffer
; stdout
: string
| Buffer
}>
Name | Type |
---|---|
file |
string |
options |
ExecFileOptionsWithOtherEncoding |
PromiseWithChild
<{ stderr
: string
| Buffer
; stdout
: string
| Buffer
}>
▸ execFile(file
, args
, options
): PromiseWithChild
<{ stderr
: string
| Buffer
; stdout
: string
| Buffer
}>
Name | Type |
---|---|
file |
string |
args |
undefined | null | readonly string [] |
options |
ExecFileOptionsWithOtherEncoding |
PromiseWithChild
<{ stderr
: string
| Buffer
; stdout
: string
| Buffer
}>
▸ execFile(file
, options
): PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
Name | Type |
---|---|
file |
string |
options |
ExecFileOptions |
PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
▸ execFile(file
, args
, options
): PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
Name | Type |
---|---|
file |
string |
args |
undefined | null | readonly string [] |
options |
ExecFileOptions |
PromiseWithChild
<{ stderr
: string
; stdout
: string
}>
▸ execFile(file
, options
): PromiseWithChild
<{ stderr
: string
| Buffer
; stdout
: string
| Buffer
}>
Name | Type |
---|---|
file |
string |
options |
undefined | null | { encoding? : null | string } & ExecFileOptions |
PromiseWithChild
<{ stderr
: string
| Buffer
; stdout
: string
| Buffer
}>
▸ execFile(file
, args
, options
): PromiseWithChild
<{ stderr
: string
| Buffer
; stdout
: string
| Buffer
}>
Name | Type |
---|---|
file |
string |
args |
undefined | null | readonly string [] |
options |
undefined | null | { encoding? : null | string } & ExecFileOptions |
PromiseWithChild
<{ stderr
: string
| Buffer
; stdout
: string
| Buffer
}>
▸ findWebViewContexts(options
): Promise
<AutomationContext
[]>
Finds and returns a description of all matching web contexts.
Useful to find out what AutomationOptions.ctxId value to specify when calling openWebView.
Name | Type | Description |
---|---|---|
options |
AutomationOptions |
Where to look for contexts. |
Promise
<AutomationContext
[]>
A list of matching contexts.
▸ mkdir(path
, options?
): Promise
<void
>
Name | Type |
---|---|
path |
PathLike |
options? |
null | string | number | MakeDirectoryOptions |
Promise
<void
>
▸ openWebView(options
): Promise
<Page
>
Connects to a web context and return a Page.
Name | Type | Description |
---|---|---|
options |
AutomationOptions |
Specify what context to use. |
Promise
<Page
>
A new Page object which can be used to interact with the web page.
▸ pipeline(stream1
, stream2
): Promise
<void
>
Name | Type |
---|---|
stream1 |
ReadableStream |
stream2 |
WritableStream |
Promise
<void
>
▸ pipeline(stream1
, stream2
, stream3
): Promise
<void
>
Name | Type |
---|---|
stream1 |
ReadableStream |
stream2 |
ReadWriteStream |
stream3 |
WritableStream |
Promise
<void
>
▸ pipeline(stream1
, stream2
, stream3
, stream4
): Promise
<void
>
Name | Type |
---|---|
stream1 |
ReadableStream |
stream2 |
ReadWriteStream |
stream3 |
ReadWriteStream |
stream4 |
WritableStream |
Promise
<void
>
▸ pipeline(stream1
, stream2
, stream3
, stream4
, stream5
): Promise
<void
>
Name | Type |
---|---|
stream1 |
ReadableStream |
stream2 |
ReadWriteStream |
stream3 |
ReadWriteStream |
stream4 |
ReadWriteStream |
stream5 |
WritableStream |
Promise
<void
>
▸ pipeline(streams
): Promise
<void
>
Name | Type |
---|---|
streams |
readonly (ReadableStream | WritableStream | ReadWriteStream )[] |
Promise
<void
>
▸ pipeline(stream1
, stream2
, ...streams
): Promise
<void
>
Name | Type |
---|---|
stream1 |
ReadableStream |
stream2 |
WritableStream | ReadWriteStream |
...streams |
(WritableStream | ReadWriteStream )[] |
Promise
<void
>
▸ readCommandOutput(command
, args
, options?
): AsyncGenerator
<string
>
Spawns a command and reads its standard output line by line.
Name | Type | Description |
---|---|---|
command |
string |
The command to executed. |
args |
string [] |
Command arguments. |
options? |
ReaderOptions |
Reader options. |
AsyncGenerator
<string
>
An async iterator generating one line at a time.
▸ readCommandOutput(command
, args
, options?
, timeout?
): AsyncGenerator
<string
| undefined
>
Spawns a command and reads its standard output line by line, with heartbeats.
Name | Type | Description |
---|---|---|
command |
string |
The command to executed. |
args |
string [] |
Command arguments. |
options? |
ReaderOptions |
Reader options. |
timeout? |
number |
The timeout, in milliseconds. If no lines has been produced within this time, an undefined value is generated instead of a string. |
AsyncGenerator
<string
| undefined
>
An async iterator generating one line at a time, or undefined
on timeouts.
▸ sleep(timeout
): Promise
<void
>
Does nothing for a while.
Name | Type | Description |
---|---|---|
timeout |
number |
The sleep duration in milliseconds |
Promise
<void
>
▸ throwError(error
): never
Throws an error.
throws
The provided error.
Name | Type | Description |
---|---|---|
error |
Error |
The error to throw. |
never
▸ writeFile(path
, data
, options?
): Promise
<void
>
Name | Type |
---|---|
path |
number | PathLike |
data |
any |
options? |
WriteFileOptions |
Promise
<void
>