tests/emulator, .github/workflows/emulator: add

This commit is contained in:
Alexander Sosedkin 2024-06-15 19:41:11 +02:00
parent d72ab2a167
commit 291970c4c4
9 changed files with 374 additions and 0 deletions

View file

@ -0,0 +1,33 @@
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')
screenshot(d, 'tests-started')
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 'text="Allow"' in d.ui.dump_hierarchy():
d.ui(text='Allow').click()
elif 'text="ALLOW"' in d.ui.dump_hierarchy():
d.ui(text='ALLOW').click()
screenshot(d, 'tests-running')
wait_for(d, 'tests, 0 failures in', timeout=1800)
screenshot(d, 'tests-finished')