Skip to content

Commit

Permalink
tweak the example
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Aug 30, 2024
1 parent 044f0c0 commit bce40e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions docs/reference/execute-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -2090,21 +2090,20 @@ payload | string | Base64-encoded content of the recorded media file if `remoteP
### mobile: simctl

Runs the given command as a subcommand of `xcrun simctl` against the device under test.
This method requires `simctl` [server secuity option](https://appium.io/docs/en/latest/guides/security/).

`stream` commands such as log stream keeps listening the output, thus Appium keeps waiting for the command to end up to the given `timeot`.

#### Arguments
Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
command | string | yes | a subcommand for the `simctl`. | `'list'`
args | array | no | array of string as arguments for the command after `<device>`. For example `getenv` subcommand accept `simctl getenv <device> <variable name>`. The `<device>` will be filled out automatically. This `args` should be the ` <variable name>` part only. | `['ENV_EXAMPLE']`
command | string | yes | a subcommand for the `simctl`. Please check the error message about the latest available commands. | `'getenv'`
args | array | no | array of string as arguments for the command after `<device>`. For example `getenv` subcommand accept `simctl getenv <device> <variable name>`. The `<device>` will be filled out automatically. This `args` should be the ` <variable name>` part only. | `['HOME']`
timeout | number | no | Command timeout in milliseconds. If the command blocks for longer than this timeout then an exception is going to be thrown. The default timeout is `600000` ms. | `10000`

#### Returned Result

Name | Type | Description | Example
--- | --- | --- | ---
stdout | string | The standard output of the command. | `'{\n \'devices\' : {\n \'com.apple.CoreSimulator.SimRuntime.iOS...'`
stdout | string | The standard output of the command. | `'/Users/user/Library/Developer/CoreSimulator/Devices/60EB8FDB-92E0-4895-B466-0153C6DE7BAE/data\n'`
stderr | string | The standard error of the command. | `''`
code | string | The status code of the command. | `0`
4 changes: 2 additions & 2 deletions lib/commands/simctl.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const commands = {
*/
async mobileSimctl(command, args = []) {
if (!SUBCOMMANDS_HAS_DEVICE.includes(command)) {
throw new errors.InvalidArgumentError(`The given command '${command}' is not supported. ' +
'Available subcommands are ${SUBCOMMANDS_HAS_DEVICE.join(',')}`);
throw new errors.InvalidArgumentError(`The given command '${command}' is not supported. ` +
`Available subcommands are ${SUBCOMMANDS_HAS_DEVICE.join(',')}`);
}

return await /** @type {import('./../driver').Simulator} */ (this.device).simctl.exec(
Expand Down

0 comments on commit bce40e7

Please sign in to comment.