@@ -558,12 +558,40 @@ export async function validateGeneratedTestScriptContent(
558558 ) ;
559559 const tab = ( await editorView . openEditor ( tstFilename ) ) as TextEditor ;
560560
561- const fullGenTstScript = await tab . getText ( ) ;
561+ // Strip TEST.NOTES: ... TEST.END_NOTES: — the wording changed between VC
562+ // releases (vc26 reworded the "no controllable inputs" note), so it isn't
563+ // something we should assert on. Structure/VALUE/STUB lines stay.
564+ const stripNotes = ( s : string ) =>
565+ s . replace ( / T E S T \. N O T E S : [ \s \S ] * ?T E S T \. E N D _ N O T E S : / g, "" ) ;
566+
567+ // expectedTestCode may be a single string or an array of lines.
568+ const expectedLines = (
569+ Array . isArray ( expectedTestCode )
570+ ? expectedTestCode
571+ : stripNotes ( expectedTestCode ) . split ( "\n" )
572+ )
573+ . map ( ( l ) => l . trim ( ) )
574+ . filter ( ( l ) => l . length > 0 ) ;
575+
576+ // Wait until the editor has fully rendered all expected lines — it can
577+ // return partial text right after opening.
578+ let genStripped = "" ;
579+ await browser . waitUntil (
580+ async ( ) => {
581+ genStripped = stripNotes ( await tab . getText ( ) ) ;
582+ return expectedLines . every ( ( line ) => genStripped . includes ( line ) ) ;
583+ } ,
584+ {
585+ timeout : 15_000 ,
586+ interval : 300 ,
587+ timeoutMsg : "Generated tst did not contain all expected lines in time" ,
588+ }
589+ ) ;
562590
563591 await editorView . closeAllEditors ( ) ;
564- for ( let line of expectedTestCode ) {
565- line = line . trim ( ) ;
566- expect ( fullGenTstScript . includes ( line ) ) . toBe ( true ) ;
592+
593+ for ( const line of expectedLines ) {
594+ expect ( genStripped . includes ( line ) ) . toBe ( true ) ;
567595 }
568596}
569597
0 commit comments