Skip to content
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
36 changes: 26 additions & 10 deletions docs/adb-commands-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ slug: adb-commands-support/

import CodeBlock from '@theme/CodeBlock';
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
import RealDeviceTag from '../src/component/realDevice';
import VirtualDeviceTag from '../src/component/virtualDevice';

<script type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify({
Expand All @@ -44,8 +46,6 @@ import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/co
})
}}
></script>


Android Debug Bridge (adb) is a versatile command-line tool that lets users communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps.

LambdaTest provides support for limited commands which can be executed in your app automation test scripts via javascript executors. The following command with the below mentioned parameters need to be used to execute adb command with LambdaTest real device cloud.
Expand All @@ -59,7 +59,7 @@ driver.execute_script("lambda-adb", params)
> **NOTE :** All these commands are supported on both Real and Virtual Devices except for the [**adb shell dumpsys**](/support/docs/adb-commands-support/#adb-shell-command) command, which is not supported for Virtual Device.

### Swipe
**adb shell input swipe**
**adb shell input swipe** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />

The command is used to generate a swipe gesture by defining the coordinates of starting and ending point of the swipe. The following is a Python sample of using the adb swipe command with LambdaTest executor.

Expand All @@ -70,7 +70,7 @@ result = driver.execute_script("lambda-adb",params)

### Clipboard

**adb shell input sendKeys**
**adb shell input sendKeys** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />

The command is used to sends text as if typed at the keyboard in the real devices. The following is a Python sample of using the adb sendKeys command with LambdaTest executor.

Expand All @@ -81,7 +81,7 @@ result = driver.execute_script("lambda-adb",params)

### Home Button

- **Navigate to the home screen**
- **Navigate to the home screen** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />

The command is used to navigate to the home screen of the device while running an app automation test script. The following is a Python sample of using the adb command to navigate to the home screen with LambdaTest executor.

Expand All @@ -92,7 +92,7 @@ result = driver.execute_script("lambda-adb",params)

### Enable/Disable auto rotate

- **enableAutoRotate**
- **enableAutoRotate** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />

The command is used to auto rotate the screen of the device while running an app automation test script. The following is a Python sample using the adb command to allow auto rotation with LambdaTest executor.

Expand All @@ -102,17 +102,18 @@ result = driver.execute_script("lambda-adb",params)
```
### ADB Shell Command

- **adb shell dumpsys**
- **adb shell dumpsys** <RealDeviceTag value="Real Device" />

This command is used to obtain detailed information about installed packages on device. When you run this command, it provides a list of information for each package installed on the device. The output includes various details about each package.The following is a Python sample using the adb command:

```bash
params = {"command": "shell", "text": "dumpsys package <package_info>"}
result = driver.execute_script("lambda-adb",params)
```

### Enable/Disable Notification

- **enableNotification**
- **enableNotification** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />

These commands enable or disable your app notifications on the device based on the value provided for `enableNotification`. **True** is used to enable notifications, while **False** is used to disable them.The following is a Python sample using the adb command with LambdaTest executor:

Expand All @@ -128,7 +129,7 @@ result = driver.execute_script("lambda-adb",params)

### Enable/Disable Battery Optimization

- **disableBatteryOptimization**
- **disableBatteryOptimization** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />

This command is used to enable or disable battery optimization for your app on the device. The following is a Python sample using the adb command to disable battery optimization with LambdaTest executor:

Expand All @@ -139,7 +140,7 @@ result = driver.execute_script("lambda-adb",params)

### Fixed-to-User Rotation

- **fixedToUserRotation**
- **fixedToUserRotation** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />

This command serves to lock the screen rotation in alignment with the app's default behavior and user-defined settings. Below is a Python example utilizing the adb command to enforce fixed screen rotation with the LambdaTest executor:

Expand All @@ -148,6 +149,21 @@ params = {"command":"fixed-to-user-rotation", "fixedToUserRotation":True}
result = driver.execute_script("lambda-adb",params)
```

### Disabling Animations on Android Devices <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />
Disabling animations can enhance test execution speed by preventing unnecessary visual effects. The following commands are used to disable different types of animations:

- `adb shell settings put global animator_duration_scale 0`: Disables property animation effects, such as object transitions and transformations.
- `adb shell settings put global transition_animation_scale 0`: Disables window transition animations, making UI transitions instant.
- `adb shell settings put global window_animation_scale 0`: Disables activity window animations, eliminating fade-in or zoom-in effects.

These commands set the respective global animation scales to 0, effectively disabling animations.

```java
Map<String, String> params = Map.of("command", "shell", "text", "settings get global animator_duration_scale");
androidDriver.executeScript("lambda-adb", params);
```


<nav aria-label="breadcrumbs">
<ul className="breadcrumbs">
<li className="breadcrumbs__item">
Expand Down
9 changes: 9 additions & 0 deletions src/component/realDevice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const React = require('react');

export default function RealDeviceTag({ value, color, bgColor }) {
return (
<span className='realDeviceColor'>
{value}
</span>
)
}
9 changes: 9 additions & 0 deletions src/component/virtualDevice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const React = require('react');

export default function VirtualDeviceTag({ value, color, bgColor }) {
return (
<span className='virtualDeviceColor'>
{value}
</span>
)
}
6 changes: 5 additions & 1 deletion src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
--newReleaseColor-tag-color: #389d59;
--bugFix-tag-color: #db4437;
--featureColor-tag-color: #860ac6;
--ifm-tabs-color:#333333
--ifm-tabs-color:#333333;
--realDevice-tag-color: #28A745;
--virtualDevice-tag-color: #007BFF
}

[data-theme=dark] {
Expand Down Expand Up @@ -54,6 +56,8 @@
.bugFixTagColor{color: #ffffff; background-color: var(--bugFix-tag-color); font-weight:bold; margin: -2px 3px; font-size: 12px; padding: 5px 10px; border-radius: 20px; border:1px solid var(--bugFix-tag-color)}
.newReleaseColor{color: #ffffff; background-color: var(--newReleaseColor-tag-color); font-weight:bold; font-size: 12px; padding: 2px 6px; border-radius: 20px; border:1px solid var(--newReleaseColor-tag-color)}
.featureColor{color: #ffffff; background-color: var(--featureColor-tag-color); font-weight:bold; font-size: 12px; padding: 2px 6px; border-radius: 20px; border:1px solid var(--featureColor-tag-color)}
.realDeviceColor{color: #ffffff; background-color: var(--realDevice-tag-color); font-weight:bold; font-size: 12px; padding: 2px 6px; border-radius: 20px; border:1px solid var(--realDevice-tag-color)}
.virtualDeviceColor{color: #ffffff; background-color: var(--virtualDevice-tag-color); font-weight:bold; font-size: 12px; padding: 2px 6px; border-radius: 20px; border:1px solid var(--virtualDevice-tag-color)}


[data-theme=dark] .footer__title {
Expand Down
Loading