Skip to content

Commit ec82868

Browse files
adb commands
1 parent f9e7408 commit ec82868

File tree

4 files changed

+49
-11
lines changed

4 files changed

+49
-11
lines changed

docs/adb-commands-support.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ slug: adb-commands-support/
2020

2121
import CodeBlock from '@theme/CodeBlock';
2222
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
23+
import RealDeviceTag from '../src/component/realDevice';
24+
import VirtualDeviceTag from '../src/component/virtualDevice';
2325

2426
<script type="application/ld+json"
2527
dangerouslySetInnerHTML={{ __html: JSON.stringify({
@@ -44,8 +46,6 @@ import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/co
4446
})
4547
}}
4648
></script>
47-
48-
4949
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.
5050

5151
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.
@@ -59,7 +59,7 @@ driver.execute_script("lambda-adb", params)
5959
> **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.
6060
6161
### Swipe
62-
**adb shell input swipe**
62+
**adb shell input swipe** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />
6363

6464
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.
6565

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

7171
### Clipboard
7272

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

7575
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.
7676

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

8282
### Home Button
8383

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

8686
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.
8787

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

9393
### Enable/Disable auto rotate
9494

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

9797
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.
9898

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

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

107107
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:
108108

109109
```bash
110110
params = {"command": "shell", "text": "dumpsys package <package_info>"}
111111
result = driver.execute_script("lambda-adb",params)
112112
```
113+
113114
### Enable/Disable Notification
114115

115-
- **enableNotification**
116+
- **enableNotification** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />
116117

117118
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:
118119

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

129130
### Enable/Disable Battery Optimization
130131

131-
- **disableBatteryOptimization**
132+
- **disableBatteryOptimization** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />
132133

133134
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:
134135

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

140141
### Fixed-to-User Rotation
141142

142-
- **fixedToUserRotation**
143+
- **fixedToUserRotation** <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />
143144

144145
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:
145146

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

152+
### Disabling Animations on Android Devices <RealDeviceTag value="Real Device" /> <VirtualDeviceTag value="Virtual Device" />
153+
Disabling animations can enhance test execution speed by preventing unnecessary visual effects. The following commands are used to disable different types of animations:
154+
155+
- `adb shell settings put global animator_duration_scale 0`: Disables property animation effects, such as object transitions and transformations.
156+
- `adb shell settings put global transition_animation_scale 0`: Disables window transition animations, making UI transitions instant.
157+
- `adb shell settings put global window_animation_scale 0`: Disables activity window animations, eliminating fade-in or zoom-in effects.
158+
159+
These commands set the respective global animation scales to 0, effectively disabling animations.
160+
161+
```java
162+
Map<String, String> params = Map.of("command", "shell", "text", "settings get global animator_duration_scale");
163+
androidDriver.executeScript("lambda-adb", params);
164+
```
165+
166+
151167
<nav aria-label="breadcrumbs">
152168
<ul className="breadcrumbs">
153169
<li className="breadcrumbs__item">

src/component/realDevice.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const React = require('react');
2+
3+
export default function RealDeviceTag({ value, color, bgColor }) {
4+
return (
5+
<span className='realDeviceColor'>
6+
{value}
7+
</span>
8+
)
9+
}

src/component/virtualDevice.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const React = require('react');
2+
3+
export default function VirtualDeviceTag({ value, color, bgColor }) {
4+
return (
5+
<span className='virtualDeviceColor'>
6+
{value}
7+
</span>
8+
)
9+
}

src/css/custom.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
--newReleaseColor-tag-color: #389d59;
2626
--bugFix-tag-color: #db4437;
2727
--featureColor-tag-color: #860ac6;
28-
--ifm-tabs-color:#333333
28+
--ifm-tabs-color:#333333;
29+
--realDevice-tag-color: #28A745;
30+
--virtualDevice-tag-color: #007BFF
2931
}
3032

3133
[data-theme=dark] {
@@ -54,6 +56,8 @@
5456
.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)}
5557
.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)}
5658
.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)}
59+
.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)}
60+
.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)}
5761

5862

5963
[data-theme=dark] .footer__title {

0 commit comments

Comments
 (0)