Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Document the helper method to simulate the low-memory event #714

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,19 @@ The actual mode value. Supported values for different UI modes are:
- `night`: yes,no,auto,custom_schedule,custom_bedtime
- `car`: yes,no

### mobile: sendTrimMemory

Simulates the [onTrimMemory()](https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)) event for the given package, which allows to verify the app functinality under different RAM-related circumstances.
Read [Manage your app's memory](https://developer.android.com/topic/performance/memory) for more details.
Available since driver version 2.41

#### Arguments

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


## Applications Management

Expand Down
8 changes: 8 additions & 0 deletions lib/execute-method-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,14 @@ export const executeMethodMap = {
optional: ['opts'],
},
},

'mobile: sendTrimMemory': {
command: 'mobileSendTrimMemory',
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 @@ -63,7 +63,7 @@
},
"dependencies": {
"appium-adb": "^11.0.1",
"appium-android-driver": "^7.6.1",
"appium-android-driver": "^7.7.0",
"appium-chromedriver": "^5.6.5",
"appium-uiautomator2-server": "^6.0.3",
"asyncbox": "^3.0.0",
Expand Down