#!/bin/bash

# Проверка аргумента
if [ -z "$1" ]; then
  echo "Usage: $0 <name>"
  exit 1
fi

NAME="$1"
DEVICE_ID="6edc4a47"

# Снимок UI Automator
adb -s "$DEVICE_ID" shell 'uiautomator dump /sdcard/uidump.xml' && \
adb -s "$DEVICE_ID" pull /sdcard/uidump.xml "${NAME}.xml" && \
adb -s "$DEVICE_ID" shell 'rm /sdcard/uidump.xml'

# Скриншот экрана
adb -s "$DEVICE_ID" shell 'screencap -p /sdcard/screen.png' && \
adb -s "$DEVICE_ID" pull /sdcard/screen.png "${NAME}.png" && \
adb -s "$DEVICE_ID" shell 'rm /sdcard/screen.png'

