-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
181 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from common import screenshot, wait_for, APK, BOOTSTRAP_URL | ||
|
||
import time | ||
|
||
|
||
def run(d): | ||
nod = d.app('com.termux.nix', url=APK) | ||
nod.permissions.allow_notifications() | ||
nod.launch() | ||
|
||
wait_for(d, 'Bootstrap zipball location') | ||
d.ui(className='android.widget.EditText').set_text(BOOTSTRAP_URL) | ||
screenshot(d, 'entered-url') | ||
for i in range(2): | ||
if 'text="OK"' not in d.ui.dump_hierarchy(): | ||
d.ui.press('back') | ||
time.sleep(.5) | ||
else: | ||
break | ||
screenshot(d, 'entered-url-back') | ||
d.ui(text='OK').click() | ||
screenshot(d, 'ok-clicked') | ||
|
||
wait_for(d, 'Welcome to Nix-on-Droid!') | ||
wait_for(d, 'Do you want to set it up with flakes? (y/N)') | ||
d('input text y') | ||
d.ui.press('enter') | ||
wait_for(d, 'Setting up Nix-on-Droid with flakes...') | ||
|
||
wait_for(d, 'Installing flake from default template...') | ||
wait_for(d, 'Overriding input urls / arch in flake...') | ||
wait_for(d, 'Installing first Nix-on-Droid generation...', timeout=600) | ||
wait_for(d, 'Building activation package') | ||
wait_for(d, 'Congratulations!', timeout=900) | ||
wait_for(d, 'bash-5.2$') | ||
|
||
d('input text "echo smoke-test | base64"') # remove | ||
d.ui.press('enter') | ||
wait_for(d, 'c21va2UtdGVzdAo=') | ||
|
||
screenshot(d, 'success-bootstrap-flakes') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from common import screenshot, wait_for | ||
|
||
|
||
def run(d): | ||
wait_for(d, 'bash-5.2$') | ||
|
||
d('input text "nix-on-droid on-device-test"') | ||
d.ui.press('enter') | ||
wait_for(d, 'These semi-automated tests are destructive', timeout=180) | ||
wait_for(d, 'Proceeding will wreck your installation.') | ||
wait_for(d, 'Do you still wish to proceed?') | ||
d('input text "I do"') | ||
d.ui.press('enter') | ||
|
||
d.ui.open_notification() | ||
d.ui(text='Nix').right(resourceId='android:id/expand_button').click() | ||
screenshot(d, 'notification_expanded') | ||
d.ui(description='Acquire wakelock').click() | ||
screenshot(d, 'wakelock_acquired') | ||
d.ui(description='Release wakelock').wait() | ||
screenshot(d, 'gotta go back') | ||
d.ui.press('back') | ||
screenshot(d, 'went back') | ||
|
||
if 'Allow' in d.ui.dump_hierarchy(): | ||
d.ui(text='Allow').click() | ||
|
||
wait_for(d, 'tests, 0 failures in', timeout=1800) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from common import screenshot, wait_for, APK, BOOTSTRAP_URL | ||
|
||
|
||
def run(d): | ||
nod = d.app('com.termux.nix', url=APK) | ||
nod.permissions.allow_notifications() | ||
nod.launch() | ||
|
||
tv = d.ui(resourceId='com.termux.nix:id/terminal_view') | ||
print(tv) | ||
print(tv.info) | ||
print(tv.info['contentDescription']) | ||
#wait_for(d, 'Welcome to Nix-on-Droid!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import bootstrap_channels | ||
import subprocess | ||
|
||
from common import wait_for | ||
|
||
TD = '/data/data/com.termux.nix/files/usr/home/.cache/nix-on-droid-self-test' | ||
|
||
|
||
def run(d): | ||
bootstrap_channels.run(d) | ||
|
||
d('input text "exit"') # remove | ||
d.ui.press('enter') | ||
|
||
nod = d.app('com.termux.nix') | ||
nod.launch() | ||
|
||
wait_for(d, 'bash-5.2$') | ||
|
||
# run tests in a way that'd display progress in CI | ||
user = d.su('stat -c %U /data/data/com.termux.nix').output.strip() | ||
# WARNING: assumes `su 0` style `su` that doesn't support -c from now on | ||
print(f'{user=}') | ||
for cmd in [ | ||
'id', | ||
f'mkdir -p {TD}', | ||
f'touch {TD}/confirmation-granted', | ||
('/data/data/com.termux.nix/files/usr/bin/login echo test'), | ||
('/data/data/com.termux.nix/files/usr/bin/login id'), | ||
('cd /data/data/com.termux.nix/files/home; ' | ||
'pwd; ' | ||
'id; ' | ||
'/data/data/com.termux.nix/files/usr/bin/login ' | ||
' nix-on-droid on-device-test') | ||
]: | ||
subprocess.run(['adb', 'shell', 'su', '0', 'su', user, | ||
'sh', '-c', cmd]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import bootstrap_channels | ||
import on_device_tests | ||
|
||
|
||
def run(d): | ||
bootstrap_channels.run(d) | ||
on_device_tests.run(d) |