1+ # Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE
2+
13import base64
24import time
35
46import bootstrap_channels
5-
67from common import screenshot , wait_for
78
9+ OPENERS = ['termux-open' , 'termux-open-url' , 'xdg-open' ]
10+ TOOLS = [
11+ 'am' ,
12+ 'termux-setup-storage' ,
13+ 'termux-reload-settings' ,
14+ 'termux-wake-lock' ,
15+ 'termux-wake-unlock' ,
16+ * OPENERS ,
17+ ]
818
9- def run (d ):
10- OPENERS = ['termux-open' , 'termux-open-url' , 'xdg-open' ]
11- TOOLS = ['am' , 'termux-setup-storage' , 'termux-reload-settings' ,
12- 'termux-wake-lock' , 'termux-wake-unlock' ] + OPENERS
1319
20+ def run (d ):
1421 nod = bootstrap_channels .run (d )
1522
1623 # Verify that android-integration tools aren't installed by default
@@ -21,9 +28,11 @@ def run(d):
2128 screenshot (d , f'no-{ toolname } ' )
2229
2330 # Apply a config that enables android-integration tools
24- cfg = ('/data/local/tmp/n-o-d/unpacked/tests/on-device/'
25- 'config-android-integration.nix' )
26- d (f'input text \' cp { cfg } .config/nixpkgs/nix-on-droid.nix\' ' )
31+ cfg = (
32+ '/data/local/tmp/n-o-d/unpacked/tests/on-device/'
33+ 'config-android-integration.nix'
34+ )
35+ d (f"input text 'cp { cfg } .config/nixpkgs/nix-on-droid.nix'" )
2736 d .ui .press ('enter' )
2837 screenshot (d , 'pre-switch' )
2938 d ('input text "nix-on-droid switch && echo integration tools installed"' )
@@ -135,7 +144,7 @@ def run(d):
135144 d .ui (text = 'ALLOW' ).click ()
136145 screenshot (d , 'wake-lock-permission-granted' )
137146 d .ui .open_notification ()
138- time .sleep (.5 )
147+ time .sleep (0 .5 )
139148 screenshot (d , 'notification-opened' )
140149 wait_for (d , '(wake lock held)' )
141150 if 'Release wakelock' not in d .ui .dump_hierarchy ():
@@ -152,7 +161,7 @@ def run(d):
152161 d .ui .press ('enter' )
153162 screenshot (d , 'wake-unlock-command' )
154163 d .ui .open_notification ()
155- time .sleep (.5 )
164+ time .sleep (0 .5 )
156165 screenshot (d , 'notification-opened' )
157166 if 'Acquire wakelock' not in d .ui .dump_hierarchy ():
158167 d .ui (text = 'Nix' ).right (resourceId = 'android:id/expand_button' ).click ()
0 commit comments