Skip to content

Commit

Permalink
feat: Add mobile: wrappers for the clipboard API (#2418)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Jun 27, 2024
1 parent 76e53b7 commit 3b41576
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/reference/execute-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,32 @@ Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
style | string | yes | Either `light` or `dark` | dark

### mobile: getClipboard

Gets the content of the primary clipboard on the device under test.

#### Arguments

Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
contentType | string | no | `plaintext` (default), `image` or `url` | image

#### Returned Result

The actual clipboard content encoded into base64 string.
An empty string is returned if the clipboard contains no data.

### mobile: setClipboard

Sets the primary clipboard's content on the device under test.

#### Arguments

Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
content| string | yes | The content to be set as base64-encoded string. | QXBwaXVt
contentType | string | no | `plaintext` (default), `image` or `url` | image

### mobile: siriCommand

Presents the Siri UI, if it is not currently active, and accepts a string which is then processed as if it were recognized speech. Check the documentation on [activateWithVoiceRecognitionText](https://developer.apple.com/documentation/xctest/xcuisiriservice/2852140-activatewithvoicerecognitiontext?language=objc) XCTest method for more details.
Expand Down
13 changes: 13 additions & 0 deletions lib/execute-method-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,19 @@ export const executeMethodMap = {
required: ['style'],
},
},
'mobile: getClipboard': {
command: 'getClipboard',
params: {
optional: ['contentType'],
},
},
'mobile: setClipboard': {
command: 'setClipboard',
params: {
required: ['content'],
optional: ['contentType'],
},
},
'mobile: siriCommand': {
command: 'mobileSiriCommand',
params: {
Expand Down

0 comments on commit 3b41576

Please sign in to comment.