mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
tests/emulator: assorted robustness fixes
This commit is contained in:
parent
27696cac81
commit
51158ee84f
2 changed files with 22 additions and 5 deletions
|
|
@ -5,6 +5,18 @@ import bootstrap_channels
|
|||
|
||||
from common import screenshot, wait_for
|
||||
|
||||
def expand_notification(d):
|
||||
session = d.ui(text='1 session')
|
||||
nix = session.up(text='Nix', resourceId='android:id/app_name_text')
|
||||
if nix is None: # works on 29, but not on 35
|
||||
print('android:id/app_name_text not found, '
|
||||
'go for com.android.systemui:id/notification_title')
|
||||
nix = session.up(
|
||||
text='Nix',
|
||||
resourceId='com.android.systemui:id/notification_title'
|
||||
)
|
||||
expand = nix.right(resourceId='android:id/expand_button')
|
||||
nix.right(resourceId='android:id/expand_button').click()
|
||||
|
||||
def run(d):
|
||||
OPENERS = ['termux-open', 'termux-open-url', 'xdg-open']
|
||||
|
|
@ -28,7 +40,7 @@ def run(d):
|
|||
screenshot(d, 'pre-switch')
|
||||
d('input text "nix-on-droid switch && echo integration tools installed"')
|
||||
d.ui.press('enter')
|
||||
wait_for(d, 'integration tools installed')
|
||||
wait_for(d, 'integration tools installed', timeout=180)
|
||||
screenshot(d, 'post-switch')
|
||||
|
||||
# Verify am is there
|
||||
|
|
@ -115,9 +127,12 @@ def run(d):
|
|||
wait_for(d, f'{opener} https://example.org')
|
||||
|
||||
# test termux-wake-lock/termux-wake-unlock
|
||||
time.sleep(.5)
|
||||
d.ui.open_notification()
|
||||
time.sleep(.5)
|
||||
screenshot(d, 'notification-opened')
|
||||
d.ui(text='Nix').right(resourceId='android:id/expand_button').click()
|
||||
if 'Release wakelock' not in d.ui.dump_hierarchy():
|
||||
expand_notification(d)
|
||||
screenshot(d, 'notification-expanded')
|
||||
wait_for(d, 'Acquire wakelock')
|
||||
screenshot(d, 'wakelock-initially-not-acquired')
|
||||
|
|
@ -139,7 +154,7 @@ def run(d):
|
|||
screenshot(d, 'notification-opened')
|
||||
wait_for(d, '(wake lock held)')
|
||||
if 'Release wakelock' not in d.ui.dump_hierarchy():
|
||||
d.ui(text='Nix').right(resourceId='android:id/expand_button').click()
|
||||
expand_notification(d)
|
||||
screenshot(d, 'notification-expanded')
|
||||
wait_for(d, 'Release wakelock')
|
||||
screenshot(d, 'notification-with-wakelock')
|
||||
|
|
@ -155,7 +170,7 @@ def run(d):
|
|||
time.sleep(.5)
|
||||
screenshot(d, 'notification-opened')
|
||||
if 'Acquire wakelock' not in d.ui.dump_hierarchy():
|
||||
d.ui(text='Nix').right(resourceId='android:id/expand_button').click()
|
||||
expand_notification(d)
|
||||
screenshot(d, 'notification-expanded')
|
||||
wait_for(d, 'Acquire wakelock')
|
||||
screenshot(d, 'notification-without-wakelock')
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import time
|
||||
|
||||
import bootstrap_channels
|
||||
|
||||
from common import screenshot, wait_for
|
||||
|
|
@ -45,6 +47,7 @@ def run(d):
|
|||
screenshot(d, 're-login')
|
||||
wait_for(d, 'Installing new login-inner...')
|
||||
wait_for(d, 'bash-5.2$')
|
||||
time.sleep(1)
|
||||
screenshot(d, 're-login-done')
|
||||
|
||||
# And verify zip is still there
|
||||
|
|
@ -55,7 +58,6 @@ def run(d):
|
|||
|
||||
def change_shell_and_relogin(shell, descr):
|
||||
import base64
|
||||
import time
|
||||
config = ('{pkgs, ...}: {user.shell = %SHELL%; ' +
|
||||
'system.stateVersion = "24.05";}').replace('%SHELL%', shell)
|
||||
config_base64 = base64.b64encode(config.encode()).decode()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue