@@ -161,6 +161,95 @@ test('resolveVisibleMaestroNodeFromSnapshot requires visible text matches to be
161161 } ) ;
162162} ) ;
163163
164+ test ( 'resolveMaestroNodeFromSnapshot infers missing selected tab slot from tab-strip children' , ( ) => {
165+ const snapshot : SnapshotState = {
166+ createdAt : Date . now ( ) ,
167+ nodes : [
168+ {
169+ index : 1 ,
170+ ref : 'e1' ,
171+ type : 'ScrollView' ,
172+ label : 'Chat' ,
173+ rect : { x : 0 , y : 116.66666412353516 , width : 402 , height : 48 } ,
174+ depth : 3 ,
175+ } ,
176+ {
177+ index : 2 ,
178+ ref : 'e2' ,
179+ type : 'Cell' ,
180+ label : 'Contacts' ,
181+ rect : { x : 134 , y : 116.66666412353516 , width : 134 , height : 48 } ,
182+ depth : 4 ,
183+ parentIndex : 1 ,
184+ } ,
185+ {
186+ index : 3 ,
187+ ref : 'e3' ,
188+ type : 'Cell' ,
189+ label : 'Albums' ,
190+ rect : { x : 268 , y : 116.66666412353516 , width : 134 , height : 48 } ,
191+ depth : 4 ,
192+ parentIndex : 1 ,
193+ } ,
194+ ] ,
195+ } ;
196+
197+ const target = resolveMaestroNodeFromSnapshot (
198+ snapshot ,
199+ 'label="Chat" || text="Chat" || id="Chat"' ,
200+ { } ,
201+ 'ios' ,
202+ { referenceWidth : 402 , referenceHeight : 874 } ,
203+ { promoteTapTarget : true } ,
204+ ) ;
205+
206+ expect ( target ) . toMatchObject ( {
207+ ok : true ,
208+ node : expect . objectContaining ( { index : 1 } ) ,
209+ rect : { x : 0 , y : 116.66666412353516 , width : 134 , height : 48 } ,
210+ } ) ;
211+ } ) ;
212+
213+ test ( 'resolveMaestroNodeFromSnapshot keeps concrete child matches over tab-strip inference' , ( ) => {
214+ const snapshot : SnapshotState = {
215+ createdAt : Date . now ( ) ,
216+ nodes : [
217+ {
218+ index : 1 ,
219+ ref : 'e1' ,
220+ type : 'ScrollView' ,
221+ label : 'Article by Gandalf' ,
222+ rect : { x : 0 , y : 58.33333333333333 , width : 402 , height : 58.33333333333333 } ,
223+ depth : 4 ,
224+ } ,
225+ {
226+ index : 2 ,
227+ ref : 'e2' ,
228+ type : 'Cell' ,
229+ label : 'Article by Gandalf' ,
230+ rect : { x : 8 , y : 65.33333587646484 , width : 155 , height : 48 } ,
231+ depth : 5 ,
232+ parentIndex : 1 ,
233+ } ,
234+ ] ,
235+ } ;
236+
237+ const target = resolveMaestroNodeFromSnapshot (
238+ snapshot ,
239+ 'label="Article by Gandalf" || text="Article by Gandalf" || id="Article by Gandalf"' ,
240+ { } ,
241+ 'ios' ,
242+ { referenceWidth : 402 , referenceHeight : 874 } ,
243+ { promoteTapTarget : true } ,
244+ ) ;
245+
246+ expect ( target ) . toMatchObject ( {
247+ ok : true ,
248+ node : expect . objectContaining ( { index : 2 } ) ,
249+ rect : { x : 8 , y : 65.33333587646484 , width : 155 , height : 48 } ,
250+ } ) ;
251+ } ) ;
252+
164253function makeReactNativeOverlaySnapshot ( ) : SnapshotState {
165254 return {
166255 createdAt : Date . now ( ) ,
0 commit comments