modules/android-integration: termux-reload-settings

This commit is contained in:
Alexander Sosedkin 2024-07-06 18:26:18 +02:00
parent 1bd1d47fdd
commit fbdc0a0630
6 changed files with 52 additions and 2 deletions

View file

@ -1,3 +1,4 @@
import base64
import time
import bootstrap_channels
@ -154,3 +155,31 @@ def run(d):
screenshot(d, 'back')
wait_for(d, 'termux-wake-unlock')
screenshot(d, 'really-back')
# Test termux-reload-settings
assert 'text="PGUP"' in d.ui.dump_hierarchy()
assert 'text="F12"' not in d.ui.dump_hierarchy()
d('input text "mkdir ~/.termux"')
d.ui.press('enter')
cmd = 'echo "extra-keys=[[\'F12\']]" > ~/.termux/termux.properties'
cmd_base64 = base64.b64encode(cmd.encode()).decode()
d(f'input text "echo {cmd_base64} | base64 -d | bash -s"')
d.ui.press('enter')
screenshot(d, 'pre-reload')
d('input text "termux-reload-settings"')
d.ui.press('enter')
time.sleep(1)
screenshot(d, 'post-reload')
assert 'text="PGUP"' not in d.ui.dump_hierarchy()
assert 'text="F12"' in d.ui.dump_hierarchy()
d('input text "rm -r ~/.termux"')
d.ui.press('enter')
screenshot(d, 'pre-reload-back')
d('input text "termux-reload-settings"')
d.ui.press('enter')
time.sleep(1)
screenshot(d, 'post-reload-back')
assert 'text="PGUP"' in d.ui.dump_hierarchy()
assert 'text="F12"' not in d.ui.dump_hierarchy()