Skip to content

Commit

Permalink
WIP: pure experimentation in swiping off error message
Browse files Browse the repository at this point in the history
  • Loading branch information
t184256 committed Jul 6, 2024
1 parent ef90256 commit 5485df9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/emulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 27 additions & 6 deletions tests/emulator/android_integration.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

import bootstrap_channels

from common import screenshot, wait_for
Expand All @@ -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
Expand All @@ -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'

Expand All @@ -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')

Expand Down Expand Up @@ -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')
Expand All @@ -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')

0 comments on commit 5485df9

Please sign in to comment.