Skip to content

Commit

Permalink
feat: Add mobile: injectEmulatorCameraImage extension (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored May 3, 2024
1 parent e39a4cf commit 768a629
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,22 @@ Name | Type | Required | Description | Example
pkg | string | yes | The package name to send the `trimMemory` event to. | com.my.company
level | 'COMPLETE' or 'MODERATE' or 'BACKGROUND' or 'UI_HIDDEN' or 'RUNNING_CRITICAL' or 'RUNNING_LOW' or 'RUNNING_MODERATE' | yes | The actual memory trim level to simulate | RUNNING_CRITICAL

### mobile: injectEmulatorCameraImage

Simulates an image injection into the VirtualScene emulator camera background.
This feature only works on Android emulators.
It might be necessary to restart the camera client app after calling this extension
for the first time as it modifies global emulator's virtual scene settings.
All the further calls should seamlessly change the foreground picture to the supplied one.
This extension could, for example, be useful if you need to verify QR codes scanning
by the application under test.
Available since driver version 3.2.0

#### Arguments

Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
payload | string | yes | A valid base64-encoded .PNG image payload. Other image formats are not supported. This image will be shown on the virtual scene foreground as soon as you open a camera client app. | iVBORw0KGgoAAAANSUh...

## Applications Management

Expand Down
6 changes: 6 additions & 0 deletions lib/execute-method-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,12 @@ export const executeMethodMap = {
}
},

'mobile: injectEmulatorCameraImage': {
command: 'mobileInjectEmulatorCameraImage',
params: {
optional: ['opts'],
}
}
} as const;

export type Uiautomator2ExecuteMethodMap = typeof executeMethodMap;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"dependencies": {
"appium-adb": "^12.0.0",
"appium-android-driver": "^9.1.0",
"appium-android-driver": "^9.2.0",
"appium-chromedriver": "^5.6.28",
"appium-uiautomator2-server": "^7.0.1",
"asyncbox": "^3.0.0",
Expand Down

0 comments on commit 768a629

Please sign in to comment.