@@ -1050,6 +1050,77 @@ test('runReplayScriptFile captures a fresh Maestro snapshot for tapOn after asse
10501050 ) ;
10511051} ) ;
10521052
1053+ test ( 'runReplayScriptFile scopes duplicate tap targets after native Maestro assertVisible' , async ( ) => {
1054+ const { response, calls } = await runReplayFixture ( {
1055+ label : 'maestro-native-assert-context-duplicate-tap' ,
1056+ script : [ 'appId: demo.app' , '---' , '- assertVisible: Albums' , '- tapOn: Push article' , '' ] . join (
1057+ '\n' ,
1058+ ) ,
1059+ flags : { replayBackend : 'maestro' , platform : 'android' } ,
1060+ invoke : async ( req ) => {
1061+ if ( req . command === 'wait' ) {
1062+ return { ok : true , data : { matched : true } } ;
1063+ }
1064+ if ( req . command === 'snapshot' ) {
1065+ return {
1066+ ok : true ,
1067+ data : {
1068+ nodes : [
1069+ {
1070+ index : 1 ,
1071+ depth : 1 ,
1072+ type : 'android.widget.ScrollView' ,
1073+ rect : { x : 0 , y : 0 , width : 390 , height : 844 } ,
1074+ } ,
1075+ {
1076+ index : 2 ,
1077+ depth : 2 ,
1078+ parentIndex : 1 ,
1079+ type : 'android.widget.TextView' ,
1080+ label : 'Albums' ,
1081+ rect : { x : 24 , y : 120 , width : 120 , height : 40 } ,
1082+ } ,
1083+ {
1084+ index : 3 ,
1085+ depth : 2 ,
1086+ parentIndex : 1 ,
1087+ type : 'android.widget.TextView' ,
1088+ label : 'Push article' ,
1089+ rect : { x : 32 , y : 220 , width : 160 , height : 44 } ,
1090+ } ,
1091+ {
1092+ index : 10 ,
1093+ depth : 1 ,
1094+ type : 'android.widget.ScrollView' ,
1095+ rect : { x : 0 , y : 0 , width : 390 , height : 844 } ,
1096+ } ,
1097+ {
1098+ index : 11 ,
1099+ depth : 2 ,
1100+ parentIndex : 10 ,
1101+ type : 'android.widget.TextView' ,
1102+ label : 'Push article' ,
1103+ rect : { x : 32 , y : 520 , width : 160 , height : 44 } ,
1104+ } ,
1105+ ] ,
1106+ } ,
1107+ } ;
1108+ }
1109+ return { ok : true , data : { } } ;
1110+ } ,
1111+ } ) ;
1112+
1113+ assert . equal ( response . ok , true ) ;
1114+ assert . deepEqual (
1115+ calls . map ( ( call ) => [ call . command , call . positionals ] ) ,
1116+ [
1117+ [ 'wait' , [ 'Albums' , '17000' ] ] ,
1118+ [ 'snapshot' , [ ] ] ,
1119+ [ 'click' , [ '112' , '242' ] ] ,
1120+ ] ,
1121+ ) ;
1122+ } ) ;
1123+
10531124test ( 'runReplayScriptFile treats absent Maestro assertNotVisible targets as passing' , async ( ) => {
10541125 const calls : CapturedInvocation [ ] = [ ] ;
10551126 const { response } = await runReplayFixture ( {
0 commit comments