1
+ # Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE
2
+
1
3
import base64
2
4
import time
3
5
4
6
import bootstrap_channels
5
-
6
7
from common import screenshot , wait_for
7
8
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
+ ]
8
18
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
13
19
20
+ def run (d ):
14
21
nod = bootstrap_channels .run (d )
15
22
16
23
# Verify that android-integration tools aren't installed by default
@@ -21,9 +28,11 @@ def run(d):
21
28
screenshot (d , f'no-{ toolname } ' )
22
29
23
30
# 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'" )
27
36
d .ui .press ('enter' )
28
37
screenshot (d , 'pre-switch' )
29
38
d ('input text "nix-on-droid switch && echo integration tools installed"' )
@@ -135,7 +144,7 @@ def run(d):
135
144
d .ui (text = 'ALLOW' ).click ()
136
145
screenshot (d , 'wake-lock-permission-granted' )
137
146
d .ui .open_notification ()
138
- time .sleep (.5 )
147
+ time .sleep (0 .5 )
139
148
screenshot (d , 'notification-opened' )
140
149
wait_for (d , '(wake lock held)' )
141
150
if 'Release wakelock' not in d .ui .dump_hierarchy ():
@@ -152,7 +161,7 @@ def run(d):
152
161
d .ui .press ('enter' )
153
162
screenshot (d , 'wake-unlock-command' )
154
163
d .ui .open_notification ()
155
- time .sleep (.5 )
164
+ time .sleep (0 .5 )
156
165
screenshot (d , 'notification-opened' )
157
166
if 'Acquire wakelock' not in d .ui .dump_hierarchy ():
158
167
d .ui (text = 'Nix' ).right (resourceId = 'android:id/expand_button' ).click ()
0 commit comments