modules/android-integration: termux-open, termux-open-url, xdg-open

This commit is contained in:
Alexander Sosedkin 2024-07-06 17:10:49 +02:00
parent 733a9fe55c
commit b195fa0b15
6 changed files with 81 additions and 14 deletions

View file

@ -6,17 +6,17 @@ from common import screenshot, wait_for
def run(d):
OPENERS = ['termux-open', 'termux-open-url', 'xdg-open']
TOOLS = ['am', 'termux-setup-storage'] + OPENERS
nod = bootstrap_channels.run(d)
# Verify that android-integration tools aren't installed by default
d('input text "am"')
d.ui.press('enter')
wait_for(d, 'bash: am: command not found')
screenshot(d, 'no-am')
d('input text "termux-setup-storage"')
d.ui.press('enter')
wait_for(d, 'bash: termux-setup-storage: command not found')
screenshot(d, 'no-termux-setup-storage')
for toolname in TOOLS:
d(f'input text "{toolname}"')
d.ui.press('enter')
wait_for(d, f'bash: {toolname}: command not found')
screenshot(d, f'no-{toolname}')
# Apply a config that enables android-integration tools
cfg = ('/data/local/tmp/n-o-d/unpacked/tests/on-device/'
@ -100,3 +100,14 @@ def run(d):
wait_for(d, 'Do you want to continue?')
d.ui.press('enter')
wait_for(d, 'Aborting configuration and leaving')
# Verify that *-open* commands work
for opener in OPENERS:
d(f'input text "{opener} https://example.org"')
d.ui.press('enter')
screenshot(d, f'{opener}-opened')
wait_for(d, 'This domain is for use in illustrative')
screenshot(d, f'{opener}-waited')
d.ui.press('back')
screenshot(d, f'{opener}-back')
wait_for(d, f'{opener} https://example.org')

View file

@ -6,7 +6,10 @@ load lib
bats_require_minimum_version 1.5.0
run ! command -v am
run ! command -v termux-setup-storage
run ! command -v termux-open
run ! command -v termux-open-url
run ! command -v xdg-open
run ! command -v termux-backup
cp \
"$ON_DEVICE_TESTS_DIR/config-android-integration.nix" \
@ -15,7 +18,10 @@ load lib
command -v am
command -v termux-setup-storage
run ! command -v termux-open-url
command -v termux-open
command -v termux-open-url
command -v xdg-open
run ! command -v termux-backup
_sed \
-e "s|# unsupported.enable = false;|unsupported.enable = true;|" \
@ -24,7 +30,10 @@ load lib
nix-on-droid switch
run ! command -v am
command -v termux-setup-storage
command -v termux-open
command -v termux-open-url
command -v xdg-open
command -v termux-backup
switch_to_default_config
}

View file

@ -4,7 +4,10 @@ _:
system.stateVersion = "23.11";
android-integration = {
am.enable = true;
termux-open.enable = true;
termux-open-url.enable = true;
termux-setup-storage.enable = true;
xdg-open.enable = true;
# unsupported.enable = false;
};
}