fixup! modules/android-integration: add am command

This commit is contained in:
Alexander Sosedkin 2024-07-06 15:51:10 +02:00
parent 2ef689482b
commit 86bedccba5
2 changed files with 23 additions and 6 deletions

View file

@ -19,11 +19,12 @@ stdenv.mkDerivation rec {
patchPhase = '' patchPhase = ''
# Header generation doesn't seem to work on android # Header generation doesn't seem to work on android
echo "#define SOCKET_PATH \"${socketPath}\"" > termux-am.h echo "#define SOCKET_PATH \"${socketPath}\"" > termux-am.h
# Fix the bash link so that nix can patch it + path to termux-am-socket
cat termux-am.h substituteInPlace termux-am.sh.in \
# Fix the bash link so that nix can patch it --replace @TERMUX_PREFIX@/bin/bash /bin/bash \
substituteInPlace termux-am.sh.in --replace @TERMUX_PREFIX@ "" --replace \
head termux-am.sh.in "termux-am-socket \"\$am_command_string\"" \
"$out/bin/termux-am-socket \"\$am_command_string\""
''; '';
postInstall = '' postInstall = ''
# Scripts use 'am' as an alias. # Scripts use 'am' as an alias.

View file

@ -1,3 +1,5 @@
import time
import bootstrap_channels import bootstrap_channels
from common import screenshot, wait_for from common import screenshot, wait_for
@ -17,8 +19,9 @@ def run(d):
d(f'input text \'cp {cfg} .config/nixpkgs/nix-on-droid.nix\'') d(f'input text \'cp {cfg} .config/nixpkgs/nix-on-droid.nix\'')
d.ui.press('enter') d.ui.press('enter')
screenshot(d, 'pre-switch') screenshot(d, 'pre-switch')
d('input text "nix-on-droid switch"') d('input text "nix-on-droid switch && echo integration tools installed"')
d.ui.press('enter') d.ui.press('enter')
wait_for(d, 'integration tools installed')
screenshot(d, 'post-switch') screenshot(d, 'post-switch')
# Verify am is there # Verify am is there
@ -35,6 +38,18 @@ def run(d):
wait_for(d, 'https://dontkillmyapp.com') wait_for(d, 'https://dontkillmyapp.com')
screenshot(d, 'am-wants-permission') screenshot(d, 'am-wants-permission')
# ... there might be a notification now, get rid of it
time.sleep(3)
screenshot(d, 'am-wants-permission-3-seconds-later')
if 'text="TermuxAm Socket Server Error"' in d.ui.dump_hierarchy():
d.ui.open_notification()
time.sleep(1)
screenshot(d, 'notification-opened')
d.ui(text='TermuxAm Socket Server Error').swipe('right')
screenshot(d, 'error-notification-swiped-right')
d.ui.press('back')
screenshot(d, 'back')
# Grant nix app 'Draw over other apps' permission # Grant nix app 'Draw over other apps' permission
nod.permissions += 'android.permission.SYSTEM_ALERT_WINDOW' nod.permissions += 'android.permission.SYSTEM_ALERT_WINDOW'
@ -44,6 +59,7 @@ def run(d):
screenshot(d, 'settings-opening') screenshot(d, 'settings-opening')
wait_for(d, 'Search settings') wait_for(d, 'Search settings')
wait_for(d, 'Network') wait_for(d, 'Network')
screenshot(d, 'settings-awaited')
d.ui.press('back') d.ui.press('back')
screenshot(d, 'back-from-settings') screenshot(d, 'back-from-settings')