Skip to content

Commit

Permalink
feat: Add mobile wrappers to lock/unlock the device (#1624)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Apr 19, 2023
1 parent 347281e commit eca9530
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/execute-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -1262,3 +1262,25 @@ Checks if the system on-screen keyboard is visible.
#### Returned Result

`true` if the keyboard is visible

### mobile: lock

Lock the device (and optionally unlock it after a certain amount of time). Only simple (e.g. without a password) locks are supported.

#### Arguments

Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
seconds | number|string | no | The number of seconds after which to unlock the device. Set to `0` or leave it empty to require manual unlock (e.g. do not block and automatically unlock afterwards). | 5

### mobile: unlock

Unlocks the previously locked device. Only simple (e.g. without a password) locks are supported.

### mobile: isLocked

Determine whether the device is locked.

#### Returned Result

Either `true` or `false`
12 changes: 12 additions & 0 deletions lib/execute-method-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,16 @@ export const executeMethodMap = {
'mobile: isKeyboardShown': {
command: 'isKeyboardShown',
},
'mobile: lock': {
command: 'lock',
params: {
optional: ['seconds'],
}
},
'mobile: unlock': {
command: 'unlock'
},
'mobile: isLocked': {
command: 'isLocked'
},
} as const satisfies ExecuteMethodMap<XCUITestDriver>;

0 comments on commit eca9530

Please sign in to comment.