@@ -469,6 +469,94 @@ describe("qa suite runtime launcher", () => {
469469 expect ( runQaTestFileScenarios ) . toHaveBeenCalledTimes ( 1 ) ;
470470 } ) ;
471471
472+ it ( "starts native suite proof before isolated flow work fills the weighted queue" , async ( ) => {
473+ const repoRoot = await makeTempRepo ( "qa-suite-native-before-isolated-" ) ;
474+ let releaseShared ! : ( ) => void ;
475+ let markSharedStarted ! : ( ) => void ;
476+ const sharedStarted = new Promise < void > ( ( resolve ) => {
477+ markSharedStarted = resolve ;
478+ } ) ;
479+ const sharedBlocked = new Promise < void > ( ( resolve ) => {
480+ releaseShared = resolve ;
481+ } ) ;
482+ let releaseTestFile ! : ( ) => void ;
483+ let markTestFileStarted ! : ( ) => void ;
484+ const testFileStarted = new Promise < void > ( ( resolve ) => {
485+ markTestFileStarted = resolve ;
486+ } ) ;
487+ const testFileBlocked = new Promise < void > ( ( resolve ) => {
488+ releaseTestFile = resolve ;
489+ } ) ;
490+ runQaFlowSuite . mockImplementationOnce (
491+ async ( params : { outputDir ?: string ; scenarioIds ?: string [ ] } | undefined ) => {
492+ markSharedStarted ( ) ;
493+ await sharedBlocked ;
494+ const outputDir = params ?. outputDir ?? "/tmp/qa-flow" ;
495+ const evidencePath = path . join ( outputDir , "qa-evidence.json" ) ;
496+ await writeEvidence ( evidencePath ) ;
497+ const scenarioIds = params ?. scenarioIds ?? [ "channel-chat-baseline" ] ;
498+ return {
499+ outputDir,
500+ evidencePath,
501+ reportPath : path . join ( outputDir , "qa-suite-report.md" ) ,
502+ summaryPath : path . join ( outputDir , "qa-suite-summary.json" ) ,
503+ report : "# QA Suite Report\n" ,
504+ scenarios : scenarioIds . map ( ( scenarioId ) => ( {
505+ name : scenarioId ,
506+ status : "pass" ,
507+ steps : [ ] ,
508+ } ) ) ,
509+ watchUrl : "http://127.0.0.1:43124" ,
510+ } ;
511+ } ,
512+ ) ;
513+ runQaTestFileScenarios . mockImplementationOnce (
514+ async ( params : {
515+ outputDir : string ;
516+ scenarios : Array < { id : string ; execution : { kind : "script" | "vitest" | "playwright" } } > ;
517+ } ) => {
518+ markTestFileStarted ( ) ;
519+ await testFileBlocked ;
520+ const evidencePath = path . join ( params . outputDir , "qa-evidence.json" ) ;
521+ await writeEvidence ( evidencePath ) ;
522+ return {
523+ outputDir : params . outputDir ,
524+ executionKind : params . scenarios [ 0 ] ?. execution . kind ?? "playwright" ,
525+ evidencePath,
526+ results : params . scenarios . map ( ( scenarioItem ) => ( {
527+ durationMs : 1 ,
528+ logPath : path . join ( params . outputDir , `${ scenarioItem . id } .log` ) ,
529+ scenario : scenarioItem ,
530+ status : "pass" ,
531+ } ) ) ,
532+ } ;
533+ } ,
534+ ) ;
535+
536+ const runPromise = runQaSuite ( {
537+ repoRoot,
538+ outputDir : ".artifacts/qa-e2e/native-before-isolated" ,
539+ concurrency : 2 ,
540+ scenarioIds : [
541+ "channel-chat-baseline" ,
542+ "group-visible-reply-tool" ,
543+ "control-ui-chat-flow-playwright" ,
544+ ] ,
545+ } ) ;
546+ await sharedStarted ;
547+ await testFileStarted ;
548+ await Promise . resolve ( ) ;
549+
550+ expect ( runQaFlowSuite ) . toHaveBeenCalledTimes ( 1 ) ;
551+ expect ( runQaTestFileScenarios ) . toHaveBeenCalledTimes ( 1 ) ;
552+
553+ releaseTestFile ( ) ;
554+ releaseShared ( ) ;
555+ await runPromise ;
556+
557+ expect ( runQaFlowSuite ) . toHaveBeenCalledTimes ( 2 ) ;
558+ } ) ;
559+
472560 it ( "waits for already-started partitions before rejecting a unified suite" , async ( ) => {
473561 const repoRoot = await makeTempRepo ( "qa-suite-reject-settle-" ) ;
474562 let releaseTestFile ! : ( ) => void ;
0 commit comments