@@ -23,22 +23,13 @@ export async function assertLifecycleAndSystem(context: LiveContext): Promise<vo
2323}
2424
2525async function assertPermissionRecovery ( context : LiveContext ) : Promise < void > {
26- await runStep ( context , 'reset microphone permission before runtime prompt' , [
27- 'settings' ,
28- 'permission' ,
29- 'reset' ,
30- 'microphone' ,
31- ] ) ;
32- await runStep ( context , 'request Android microphone permission in fixture' , [
33- 'click' ,
34- 'id="automation-request-microphone"' ,
35- ] ) ;
36- const prompt = await runStep ( context , 'inspect Android microphone permission prompt' , [
37- 'alert' ,
38- 'get' ,
39- ] ) ;
40- assert . equal ( prompt . json ?. data ?. alert ?. source , 'permission' , JSON . stringify ( prompt . json ) ) ;
41- await runStep ( context , 'accept Android microphone permission prompt' , [ 'alert' , 'accept' ] ) ;
26+ await resetAndRequestMicrophonePermission ( context , 'accept' ) ;
27+ await assertElementText ( context , 'id="automation-microphone-permission"' , 'granted' ) ;
28+
29+ await resetAndRequestMicrophonePermission ( context , 'deny' ) ;
30+ await assertElementText ( context , 'id="automation-microphone-permission"' , 'denied' ) ;
31+
32+ await resetAndRequestMicrophonePermission ( context , 'accept after denial' ) ;
4233 await assertElementText ( context , 'id="automation-microphone-permission"' , 'granted' ) ;
4334
4435 await runStep ( context , 'revoke Android microphone permission' , [
@@ -54,15 +45,42 @@ async function assertPermissionRecovery(context: LiveContext): Promise<void> {
5445 verifyCommand (
5546 context ,
5647 C . settings ,
57- 'grant and deny runtime permission transitions are fixture-visible' ,
48+ 'prompt accept, prompt deny, and adb revoke transitions are fixture-visible' ,
5849 ) ;
5950 verifyBehavior (
6051 context ,
6152 'runtime-permission-recovery' ,
62- 'fixture observed prompt acceptance then the app-active readback after pm revoke' ,
53+ 'fixture observed native prompt accept and deny, then app-active readback after pm revoke' ,
6354 ) ;
6455}
6556
57+ async function resetAndRequestMicrophonePermission (
58+ context : LiveContext ,
59+ action : 'accept' | 'deny' | 'accept after denial' ,
60+ ) : Promise < void > {
61+ await runStep ( context , `reset microphone permission before ${ action } ` , [
62+ 'settings' ,
63+ 'permission' ,
64+ 'reset' ,
65+ 'microphone' ,
66+ ] ) ;
67+ await runStep ( context , `scroll to microphone permission control before ${ action } ` , [
68+ 'scroll' ,
69+ 'bottom' ,
70+ ] ) ;
71+ await runStep ( context , `request Android microphone permission for ${ action } ` , [
72+ 'click' ,
73+ 'id="automation-request-microphone"' ,
74+ ] ) ;
75+ const prompt = await runStep ( context , `inspect Android microphone prompt for ${ action } ` , [
76+ 'alert' ,
77+ 'get' ,
78+ ] ) ;
79+ assert . equal ( prompt . json ?. data ?. alert ?. source , 'permission' , JSON . stringify ( prompt . json ) ) ;
80+ const alertAction = action === 'deny' ? 'dismiss' : 'accept' ;
81+ await runStep ( context , `${ action } Android microphone permission prompt` , [ 'alert' , alertAction ] ) ;
82+ }
83+
6684async function assertPushBroadcast ( context : LiveContext ) : Promise < void > {
6785 const payload = JSON . stringify ( { extras : { count : 7 , source : 'android-nightly' } } ) ;
6886 const pushed = await runStep ( context , 'broadcast typed Android fixture push' , [
@@ -72,6 +90,7 @@ async function assertPushBroadcast(context: LiveContext): Promise<void> {
7290 ] ) ;
7391 assert . equal ( pushed . json ?. data ?. package , context . appId , JSON . stringify ( pushed . json ) ) ;
7492 assert . equal ( pushed . json ?. data ?. extrasCount , 2 , JSON . stringify ( pushed . json ) ) ;
93+ await runStep ( context , 'scroll to Android push receiver state' , [ 'scroll' , 'bottom' ] ) ;
7594 await runStep ( context , 'refresh fixture push receiver state' , [
7695 'click' ,
7796 'id="automation-refresh-push-broadcast"' ,
0 commit comments