devicely 2.1.5 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/server.js +7 -5
- package/package.json +1 -1
- package/scripts/shell/android_device_control.sh +0 -848
- package/scripts/shell/connect_android_usb_multi_final.sh +0 -289
- package/scripts/shell/connect_android_wireless.sh +0 -58
- package/scripts/shell/connect_android_wireless_multi_final.sh +0 -476
- package/scripts/shell/connect_ios_usb_multi_final.sh +0 -4225
- package/scripts/shell/connect_ios_wireless_multi_final.sh +0 -4167
- package/scripts/shell/create_production_scripts.sh +0 -38
- package/scripts/shell/install_uiautomator2.sh +0 -93
- package/scripts/shell/ios_device_control.sh +0 -220
- package/scripts/shell/organize_project.sh +0 -59
- package/scripts/shell/pre-publish-check.sh +0 -238
- package/scripts/shell/publish-to-npm.sh +0 -366
- package/scripts/shell/publish.sh +0 -100
- package/scripts/shell/setup.sh +0 -121
- package/scripts/shell/start.sh +0 -59
- package/scripts/shell/sync-to-npm-package-final.sh +0 -60
- package/scripts/shell/test-local-package.sh +0 -95
- package/scripts/shell/verify-shell-protection.sh +0 -73
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Android Multi-Device USB Control Script
|
|
3
|
-
# Complete feature parity with iOS USB multi-device control
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(dirname "$0")"
|
|
6
|
-
source "$SCRIPT_DIR/android_device_control.sh"
|
|
7
|
-
|
|
8
|
-
# Check for config files in both local and npm package locations
|
|
9
|
-
if [ -f "$SCRIPT_DIR/devices.conf" ]; then
|
|
10
|
-
CONFIG_FILE="$SCRIPT_DIR/devices.conf"
|
|
11
|
-
elif [ -f "$SCRIPT_DIR/../../config/devices.conf" ]; then
|
|
12
|
-
CONFIG_FILE="$SCRIPT_DIR/../../config/devices.conf"
|
|
13
|
-
else
|
|
14
|
-
echo "❌ Required file not found: devices.conf"
|
|
15
|
-
exit 1
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
if [ -f "$SCRIPT_DIR/apps_presets.conf" ]; then
|
|
19
|
-
APPS_PRESETS_FILE="$SCRIPT_DIR/apps_presets.conf"
|
|
20
|
-
elif [ -f "$SCRIPT_DIR/../../config/apps_presets.conf" ]; then
|
|
21
|
-
APPS_PRESETS_FILE="$SCRIPT_DIR/../../config/apps_presets.conf"
|
|
22
|
-
else
|
|
23
|
-
echo "❌ Required file not found: apps_presets.conf"
|
|
24
|
-
exit 1
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
# Port management (using files for bash 3.2 compatibility)
|
|
28
|
-
UIAUTOMATOR2_PORT_BASE=6790
|
|
29
|
-
DEVICE_PORTS_FILE="/tmp/android_usb_ports.$$"
|
|
30
|
-
|
|
31
|
-
# Color codes
|
|
32
|
-
GREEN='\033[0;32m'
|
|
33
|
-
RED='\033[0;31m'
|
|
34
|
-
YELLOW='\033[1;33m'
|
|
35
|
-
BLUE='\033[0;34m'
|
|
36
|
-
NC='\033[0m'
|
|
37
|
-
|
|
38
|
-
# Load Android devices from config
|
|
39
|
-
load_android_devices() {
|
|
40
|
-
local devices=()
|
|
41
|
-
|
|
42
|
-
if [ -f "$CONFIG_FILE" ]; then
|
|
43
|
-
while IFS=',' read -r name serial ip platform type; do
|
|
44
|
-
# Skip comments and empty lines
|
|
45
|
-
[[ "$name" =~ ^#.*$ ]] && continue
|
|
46
|
-
[ -z "$name" ] && continue
|
|
47
|
-
|
|
48
|
-
# Only load Android devices
|
|
49
|
-
if [ "$platform" = "android" ]; then
|
|
50
|
-
devices+=("$name:$serial:$type")
|
|
51
|
-
fi
|
|
52
|
-
done < "$CONFIG_FILE"
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
echo "${devices[@]}"
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
# Detect connected Android devices via USB
|
|
59
|
-
detect_usb_devices() {
|
|
60
|
-
echo -e "${BLUE}Detecting USB-connected Android devices...${NC}"
|
|
61
|
-
|
|
62
|
-
local devices=()
|
|
63
|
-
while IFS=$'\t' read -r serial status; do
|
|
64
|
-
if [ "$status" = "device" ]; then
|
|
65
|
-
local model=$(adb -s "$serial" shell getprop ro.product.model | tr -d '\r' | tr ' ' '_')
|
|
66
|
-
devices+=("$model:$serial:usb")
|
|
67
|
-
echo -e "${GREEN}✓ Found: $model ($serial)${NC}"
|
|
68
|
-
fi
|
|
69
|
-
done < <(adb devices | tail -n +2)
|
|
70
|
-
|
|
71
|
-
echo "${devices[@]}"
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
# Select target devices
|
|
75
|
-
select_devices() {
|
|
76
|
-
local all_devices=($1)
|
|
77
|
-
local specified_device=$2
|
|
78
|
-
local selected=()
|
|
79
|
-
|
|
80
|
-
if [ -n "$specified_device" ]; then
|
|
81
|
-
# Find specific device
|
|
82
|
-
for device in "${all_devices[@]}"; do
|
|
83
|
-
local name=$(echo "$device" | cut -d':' -f1)
|
|
84
|
-
local serial=$(echo "$device" | cut -d':' -f2)
|
|
85
|
-
|
|
86
|
-
if [ "$name" = "$specified_device" ] || [ "$serial" = "$specified_device" ]; then
|
|
87
|
-
selected+=("$device")
|
|
88
|
-
break
|
|
89
|
-
fi
|
|
90
|
-
done
|
|
91
|
-
|
|
92
|
-
if [ ${#selected[@]} -eq 0 ]; then
|
|
93
|
-
echo -e "${RED}Device not found: $specified_device${NC}" >&2
|
|
94
|
-
return 1
|
|
95
|
-
fi
|
|
96
|
-
else
|
|
97
|
-
# Use all devices
|
|
98
|
-
selected=("${all_devices[@]}")
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
echo "${selected[@]}"
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
# Execute command on device
|
|
105
|
-
execute_on_device() {
|
|
106
|
-
local device_info=$1
|
|
107
|
-
local command=$2
|
|
108
|
-
|
|
109
|
-
local name=$(echo "$device_info" | cut -d':' -f1)
|
|
110
|
-
local serial=$(echo "$device_info" | cut -d':' -f2)
|
|
111
|
-
local port=$((UIAUTOMATOR2_PORT_BASE))
|
|
112
|
-
|
|
113
|
-
echo -e "\n${YELLOW}━━━ $name ($serial) ━━━${NC}"
|
|
114
|
-
|
|
115
|
-
# Parse command
|
|
116
|
-
local cmd_parts=($command)
|
|
117
|
-
local main_cmd="${cmd_parts[0]}"
|
|
118
|
-
local cmd_args="${command#* }"
|
|
119
|
-
|
|
120
|
-
# Handle app presets
|
|
121
|
-
if [ "$main_cmd" = "launch" ] && [ -f "$APPS_PRESETS_FILE" ]; then
|
|
122
|
-
local app_name="${cmd_parts[1]}"
|
|
123
|
-
local preset=$(grep "^$app_name=" "$APPS_PRESETS_FILE" 2>/dev/null | cut -d'=' -f2)
|
|
124
|
-
if [ -n "$preset" ]; then
|
|
125
|
-
cmd_args="$preset"
|
|
126
|
-
fi
|
|
127
|
-
fi
|
|
128
|
-
|
|
129
|
-
# Execute via android_device_control.sh
|
|
130
|
-
process_command "$serial" "$port" "$main_cmd" $cmd_args
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
# Execute command on multiple devices in parallel
|
|
134
|
-
execute_parallel() {
|
|
135
|
-
local last_idx=$#
|
|
136
|
-
local command="${!last_idx}"
|
|
137
|
-
set -- "${@:1:$(($#-1))}"
|
|
138
|
-
|
|
139
|
-
local pids=()
|
|
140
|
-
|
|
141
|
-
for device in "${devices[@]}"; do
|
|
142
|
-
execute_on_device "$device" "$command" &
|
|
143
|
-
pids+=($!)
|
|
144
|
-
done
|
|
145
|
-
|
|
146
|
-
# Wait for all to complete
|
|
147
|
-
for pid in "${pids[@]}"; do
|
|
148
|
-
wait $pid
|
|
149
|
-
done
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
# Interactive mode
|
|
153
|
-
interactive_mode() {
|
|
154
|
-
local devices=("$@")
|
|
155
|
-
|
|
156
|
-
echo -e "${BLUE}╔════════════════════════════════════════╗${NC}"
|
|
157
|
-
echo -e "${BLUE}║ Android Multi-Device Control (USB) ║${NC}"
|
|
158
|
-
echo -e "${BLUE}╚════════════════════════════════════════╝${NC}"
|
|
159
|
-
echo ""
|
|
160
|
-
echo -e "${GREEN}Connected Devices:${NC}"
|
|
161
|
-
|
|
162
|
-
for i in "${!devices[@]}"; do
|
|
163
|
-
local name=$(echo "${devices[$i]}" | cut -d':' -f1)
|
|
164
|
-
local serial=$(echo "${devices[$i]}" | cut -d':' -f2)
|
|
165
|
-
echo -e " $((i+1)). $name ($serial)"
|
|
166
|
-
done
|
|
167
|
-
|
|
168
|
-
echo ""
|
|
169
|
-
echo -e "${YELLOW}Commands:${NC}"
|
|
170
|
-
echo " launch <package> - Launch app"
|
|
171
|
-
echo " click <text> - Click element"
|
|
172
|
-
echo " type <text> - Type text"
|
|
173
|
-
echo " swipe <direction> - Swipe (up/down/left/right)"
|
|
174
|
-
echo " screenshot - Take screenshot"
|
|
175
|
-
echo " home - Go to home screen"
|
|
176
|
-
echo " back - Go back"
|
|
177
|
-
echo " getLocators - Get UI elements"
|
|
178
|
-
echo " info - Device info"
|
|
179
|
-
echo " listapps - List installed apps"
|
|
180
|
-
echo " quit - Exit"
|
|
181
|
-
echo ""
|
|
182
|
-
|
|
183
|
-
while true; do
|
|
184
|
-
echo -ne "${BLUE}android>${NC} "
|
|
185
|
-
read -r input
|
|
186
|
-
|
|
187
|
-
[ -z "$input" ] && continue
|
|
188
|
-
[ "$input" = "quit" ] && break
|
|
189
|
-
|
|
190
|
-
execute_parallel "${devices[@]}" "$input"
|
|
191
|
-
done
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
# Show help
|
|
195
|
-
show_help() {
|
|
196
|
-
cat << EOF
|
|
197
|
-
Android Multi-Device USB Control
|
|
198
|
-
|
|
199
|
-
Usage:
|
|
200
|
-
$0 # Interactive mode (all devices)
|
|
201
|
-
$0 "command" # Execute on all devices
|
|
202
|
-
$0 -d <device> "command" # Execute on specific device
|
|
203
|
-
|
|
204
|
-
Commands:
|
|
205
|
-
launch <package> [activity] Launch app
|
|
206
|
-
close <package> Close app
|
|
207
|
-
click <text|x,y> Click element
|
|
208
|
-
type <text> Type text
|
|
209
|
-
swipe <up|down|left|right> Swipe gesture
|
|
210
|
-
screenshot Take screenshot
|
|
211
|
-
getLocators Get UI elements
|
|
212
|
-
home Press home button
|
|
213
|
-
back Press back button
|
|
214
|
-
lock Lock device
|
|
215
|
-
unlock Unlock device
|
|
216
|
-
info Device information
|
|
217
|
-
listapps List installed apps
|
|
218
|
-
|
|
219
|
-
Examples:
|
|
220
|
-
$0 "launch com.android.chrome"
|
|
221
|
-
$0 -d Pixel8 "click 'Search'"
|
|
222
|
-
$0 "screenshot"
|
|
223
|
-
$0 -d Galaxy "getLocators"
|
|
224
|
-
|
|
225
|
-
Device Selection:
|
|
226
|
-
-d <name> Target specific device by name
|
|
227
|
-
-d <serial> Target specific device by serial number
|
|
228
|
-
|
|
229
|
-
Configuration:
|
|
230
|
-
devices.conf Device definitions
|
|
231
|
-
apps_presets.conf App package shortcuts
|
|
232
|
-
|
|
233
|
-
EOF
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
# Main
|
|
237
|
-
main() {
|
|
238
|
-
# Parse arguments
|
|
239
|
-
local specified_device=""
|
|
240
|
-
local command=""
|
|
241
|
-
|
|
242
|
-
while [[ $# -gt 0 ]]; do
|
|
243
|
-
case $1 in
|
|
244
|
-
-h|--help)
|
|
245
|
-
show_help
|
|
246
|
-
exit 0
|
|
247
|
-
;;
|
|
248
|
-
-d)
|
|
249
|
-
specified_device="$2"
|
|
250
|
-
shift 2
|
|
251
|
-
;;
|
|
252
|
-
*)
|
|
253
|
-
command="$1"
|
|
254
|
-
shift
|
|
255
|
-
break
|
|
256
|
-
;;
|
|
257
|
-
esac
|
|
258
|
-
done
|
|
259
|
-
|
|
260
|
-
# Detect devices
|
|
261
|
-
local detected_devices=$(detect_usb_devices)
|
|
262
|
-
|
|
263
|
-
if [ -z "$detected_devices" ]; then
|
|
264
|
-
echo -e "${RED}No Android devices detected via USB${NC}"
|
|
265
|
-
echo "Please ensure:"
|
|
266
|
-
echo " 1. Device is connected via USB"
|
|
267
|
-
echo " 2. USB debugging is enabled"
|
|
268
|
-
echo " 3. Device is authorized (check device screen)"
|
|
269
|
-
exit 1
|
|
270
|
-
fi
|
|
271
|
-
|
|
272
|
-
# Select target devices
|
|
273
|
-
local target_devices=$(select_devices "$detected_devices" "$specified_device")
|
|
274
|
-
|
|
275
|
-
if [ -z "$target_devices" ]; then
|
|
276
|
-
exit 1
|
|
277
|
-
fi
|
|
278
|
-
|
|
279
|
-
local devices_array=($target_devices)
|
|
280
|
-
|
|
281
|
-
# Execute command or enter interactive mode
|
|
282
|
-
if [ -n "$command" ]; then
|
|
283
|
-
execute_parallel "${devices_array[@]}" "$command"
|
|
284
|
-
else
|
|
285
|
-
interactive_mode "${devices_array[@]}"
|
|
286
|
-
fi
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
main "$@"
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Simple Android Wireless Command Wrapper
|
|
3
|
-
# Calls android_device_control.sh directly with wireless device handling
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(dirname "$0")"
|
|
6
|
-
ANDROID_CONTROL="$SCRIPT_DIR/android_device_control.sh"
|
|
7
|
-
|
|
8
|
-
# Parse arguments
|
|
9
|
-
DEVICE_NAME=""
|
|
10
|
-
COMMAND=""
|
|
11
|
-
|
|
12
|
-
while [[ $# -gt 0 ]]; do
|
|
13
|
-
case $1 in
|
|
14
|
-
-d)
|
|
15
|
-
DEVICE_NAME="$2"
|
|
16
|
-
shift 2
|
|
17
|
-
;;
|
|
18
|
-
*)
|
|
19
|
-
COMMAND="$*"
|
|
20
|
-
break
|
|
21
|
-
;;
|
|
22
|
-
esac
|
|
23
|
-
done
|
|
24
|
-
|
|
25
|
-
# Find device serial (wireless devices show as IP:PORT)
|
|
26
|
-
if [ -z "$DEVICE_NAME" ]; then
|
|
27
|
-
SERIAL=$(adb devices | tail -n +2 | grep ":5555" | head -1 | awk '{print $1}')
|
|
28
|
-
if [ -z "$SERIAL" ]; then
|
|
29
|
-
echo "Error: No wireless Android devices found"
|
|
30
|
-
exit 1
|
|
31
|
-
fi
|
|
32
|
-
else
|
|
33
|
-
# Check if it's an IP address
|
|
34
|
-
if [[ "$DEVICE_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
35
|
-
SERIAL="$DEVICE_NAME:5555"
|
|
36
|
-
elif adb devices | grep -q "^$DEVICE_NAME"; then
|
|
37
|
-
SERIAL="$DEVICE_NAME"
|
|
38
|
-
else
|
|
39
|
-
# Try to find by model name in wireless devices
|
|
40
|
-
SERIAL=$(adb devices -l | grep ":5555" | grep "$DEVICE_NAME" | awk '{print $1}')
|
|
41
|
-
if [ -z "$SERIAL" ]; then
|
|
42
|
-
SERIAL=$(adb devices | tail -n +2 | grep ":5555" | head -1 | awk '{print $1}')
|
|
43
|
-
fi
|
|
44
|
-
fi
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
if [ -z "$SERIAL" ]; then
|
|
48
|
-
echo "Error: Could not find wireless device: $DEVICE_NAME"
|
|
49
|
-
exit 1
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
if [ -z "$COMMAND" ]; then
|
|
53
|
-
echo "Error: No command specified"
|
|
54
|
-
exit 1
|
|
55
|
-
fi
|
|
56
|
-
|
|
57
|
-
# Execute command directly
|
|
58
|
-
exec "$ANDROID_CONTROL" "$SERIAL" $COMMAND
|