From 5485df97ea599800abbd29ac3b3907f28d187756 Mon Sep 17 00:00:00 2001 From: Alexander Sosedkin Date: Sat, 6 Jul 2024 18:19:46 +0200 Subject: [PATCH] WIP: pure experimentation in swiping off error message --- .github/workflows/emulator.yml | 10 ++++---- tests/emulator/android_integration.py | 33 ++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.github/workflows/emulator.yml b/.github/workflows/emulator.yml index 490c17ed..01b36b71 100644 --- a/.github/workflows/emulator.yml +++ b/.github/workflows/emulator.yml @@ -109,11 +109,11 @@ jobs: # 34: sometimes work, but doesn't seem stable, even w/o caching images script: - android_integration - - bootstrap_flakes - - bootstrap_channels - - poke_around - - test_channels_uiautomator - - test_channels_shell + # bootstrap_flakes + # bootstrap_channels + # poke_around + # test_channels_uiautomator + # test_channels_shell steps: - name: Checkout repository diff --git a/tests/emulator/android_integration.py b/tests/emulator/android_integration.py index 2349c267..4520e4aa 100644 --- a/tests/emulator/android_integration.py +++ b/tests/emulator/android_integration.py @@ -1,3 +1,5 @@ +import time + import bootstrap_channels from common import screenshot, wait_for @@ -23,9 +25,9 @@ def run(d): d(f'input text \'cp {cfg} .config/nixpkgs/nix-on-droid.nix\'') d.ui.press('enter') 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') - wait_for(d, 'bash') + wait_for(d, 'integration tools installed') screenshot(d, 'post-switch') # Verify am is there @@ -42,6 +44,28 @@ def run(d): wait_for(d, 'https://dontkillmyapp.com') 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') + time.sleep(.5) + if 'text="TermuxAm Socket Server Error"' in d.ui.dump_hierarchy(): + d.ui(text='TermuxAm Socket Server Error').click() + time.sleep(.25) + screenshot(d, 'error-notification-clicked') + d.ui.press('back') + screenshot(d, 'back-1') + for i in range(3): + if 'https://dontkillmyapp.com' not in d.ui.dump_hierarchy(): + d.ui.press('back') + time.sleep(.5) + screenshot(d, 'back-{i}') + # Grant nix app 'Draw over other apps' permission nod.permissions += 'android.permission.SYSTEM_ALERT_WINDOW' @@ -51,6 +75,7 @@ def run(d): screenshot(d, 'settings-opening') wait_for(d, 'Search settings') wait_for(d, 'Network') + screenshot(d, 'settings-awaited') d.ui.press('back') screenshot(d, 'back-from-settings') @@ -113,8 +138,6 @@ def run(d): d.ui.open_notification() screenshot(d, 'notification-opened') wait_for(d, '(wake lock held)') - d.ui(text='Nix').right(resourceId='android:id/expand_button').click() - screenshot(d, 'notification-expanded') wait_for(d, 'Release wakelock') screenshot(d, 'notification-with-wakelock') d.ui.press('back') @@ -124,8 +147,6 @@ def run(d): screenshot(d, 'wake-unlock-command') d.ui.open_notification() screenshot(d, 'notification-opened') - d.ui(text='Nix').right(resourceId='android:id/expand_button').click() - screenshot(d, 'notification-expanded') wait_for(d, 'Acquire wakelock') screenshot(d, 'notification-without-wakelock') d.ui.press('back')