@@ -14,6 +14,7 @@ import {
1414 sessionTodoToggleButtonSelector ,
1515} from "../selectors"
1616import { modKey } from "../utils"
17+ import { inputMatch } from "../prompt/mock"
1718
1819type Sdk = Parameters < typeof clearSessionDockSeed > [ 0 ]
1920type PermissionRule = { permission : string ; pattern : string ; action : "allow" | "deny" | "ask" }
@@ -36,6 +37,17 @@ async function withDockSession<T>(
3637 }
3738}
3839
40+ const defaultQuestions = [
41+ {
42+ header : "Need input" ,
43+ question : "Pick one option" ,
44+ options : [
45+ { label : "Continue" , description : "Continue now" } ,
46+ { label : "Stop" , description : "Stop here" } ,
47+ ] ,
48+ } ,
49+ ]
50+
3951test . setTimeout ( 120_000 )
4052
4153async function withDockSeed < T > ( sdk : Sdk , sessionID : string , fn : ( ) => Promise < T > ) {
@@ -291,27 +303,19 @@ test("auto-accept toggle works before first submit", async ({ page, withBackendP
291303 } )
292304} )
293305
294- test ( "blocked question flow unblocks after submit" , async ( { page, withBackendProject } ) => {
295- await withBackendProject ( async ( project ) => {
306+ test ( "blocked question flow unblocks after submit" , async ( { page, llm , withMockProject } ) => {
307+ await withMockProject ( async ( project ) => {
296308 await withDockSession (
297309 project . sdk ,
298310 "e2e composer dock question" ,
299311 async ( session ) => {
300312 await withDockSeed ( project . sdk , session . id , async ( ) => {
301313 await project . gotoSession ( session . id )
302314
315+ await llm . toolMatch ( inputMatch ( { questions : defaultQuestions } ) , "question" , { questions : defaultQuestions } )
303316 await seedSessionQuestion ( project . sdk , {
304317 sessionID : session . id ,
305- questions : [
306- {
307- header : "Need input" ,
308- question : "Pick one option" ,
309- options : [
310- { label : "Continue" , description : "Continue now" } ,
311- { label : "Stop" , description : "Stop here" } ,
312- ] ,
313- } ,
314- ] ,
318+ questions : defaultQuestions ,
315319 } )
316320
317321 const dock = page . locator ( questionDockSelector )
@@ -328,27 +332,19 @@ test("blocked question flow unblocks after submit", async ({ page, withBackendPr
328332 } )
329333} )
330334
331- test ( "blocked question flow supports keyboard shortcuts" , async ( { page, withBackendProject } ) => {
332- await withBackendProject ( async ( project ) => {
335+ test ( "blocked question flow supports keyboard shortcuts" , async ( { page, llm , withMockProject } ) => {
336+ await withMockProject ( async ( project ) => {
333337 await withDockSession (
334338 project . sdk ,
335339 "e2e composer dock question keyboard" ,
336340 async ( session ) => {
337341 await withDockSeed ( project . sdk , session . id , async ( ) => {
338342 await project . gotoSession ( session . id )
339343
344+ await llm . toolMatch ( inputMatch ( { questions : defaultQuestions } ) , "question" , { questions : defaultQuestions } )
340345 await seedSessionQuestion ( project . sdk , {
341346 sessionID : session . id ,
342- questions : [
343- {
344- header : "Need input" ,
345- question : "Pick one option" ,
346- options : [
347- { label : "Continue" , description : "Continue now" } ,
348- { label : "Stop" , description : "Stop here" } ,
349- ] ,
350- } ,
351- ] ,
347+ questions : defaultQuestions ,
352348 } )
353349
354350 const dock = page . locator ( questionDockSelector )
@@ -371,27 +367,19 @@ test("blocked question flow supports keyboard shortcuts", async ({ page, withBac
371367 } )
372368} )
373369
374- test ( "blocked question flow supports escape dismiss" , async ( { page, withBackendProject } ) => {
375- await withBackendProject ( async ( project ) => {
370+ test ( "blocked question flow supports escape dismiss" , async ( { page, llm , withMockProject } ) => {
371+ await withMockProject ( async ( project ) => {
376372 await withDockSession (
377373 project . sdk ,
378374 "e2e composer dock question escape" ,
379375 async ( session ) => {
380376 await withDockSeed ( project . sdk , session . id , async ( ) => {
381377 await project . gotoSession ( session . id )
382378
379+ await llm . toolMatch ( inputMatch ( { questions : defaultQuestions } ) , "question" , { questions : defaultQuestions } )
383380 await seedSessionQuestion ( project . sdk , {
384381 sessionID : session . id ,
385- questions : [
386- {
387- header : "Need input" ,
388- question : "Pick one option" ,
389- options : [
390- { label : "Continue" , description : "Continue now" } ,
391- { label : "Stop" , description : "Stop here" } ,
392- ] ,
393- } ,
394- ] ,
382+ questions : defaultQuestions ,
395383 } )
396384
397385 const dock = page . locator ( questionDockSelector )
@@ -512,9 +500,20 @@ test("blocked permission flow supports allow always", async ({ page, withBackend
512500
513501test ( "child session question request blocks parent dock and unblocks after submit" , async ( {
514502 page,
515- withBackendProject,
503+ llm,
504+ withMockProject,
516505} ) => {
517- await withBackendProject ( async ( project ) => {
506+ const questions = [
507+ {
508+ header : "Child input" ,
509+ question : "Pick one child option" ,
510+ options : [
511+ { label : "Continue" , description : "Continue child" } ,
512+ { label : "Stop" , description : "Stop child" } ,
513+ ] ,
514+ } ,
515+ ]
516+ await withMockProject ( async ( project ) => {
518517 await withDockSession (
519518 project . sdk ,
520519 "e2e composer dock child question parent" ,
@@ -532,18 +531,10 @@ test("child session question request blocks parent dock and unblocks after submi
532531
533532 try {
534533 await withDockSeed ( project . sdk , child . id , async ( ) => {
534+ await llm . toolMatch ( inputMatch ( { questions } ) , "question" , { questions } )
535535 await seedSessionQuestion ( project . sdk , {
536536 sessionID : child . id ,
537- questions : [
538- {
539- header : "Child input" ,
540- question : "Pick one child option" ,
541- options : [
542- { label : "Continue" , description : "Continue child" } ,
543- { label : "Stop" , description : "Stop child" } ,
544- ] ,
545- } ,
546- ] ,
537+ questions,
547538 } )
548539
549540 const dock = page . locator ( questionDockSelector )
@@ -652,24 +643,26 @@ test("todo dock transitions and collapse behavior", async ({ page, withBackendPr
652643 } )
653644} )
654645
655- test ( "keyboard focus stays off prompt while blocked" , async ( { page, withBackendProject } ) => {
656- await withBackendProject ( async ( project ) => {
646+ test ( "keyboard focus stays off prompt while blocked" , async ( { page, llm, withMockProject } ) => {
647+ const questions = [
648+ {
649+ header : "Need input" ,
650+ question : "Pick one option" ,
651+ options : [ { label : "Continue" , description : "Continue now" } ] ,
652+ } ,
653+ ]
654+ await withMockProject ( async ( project ) => {
657655 await withDockSession (
658656 project . sdk ,
659657 "e2e composer dock keyboard" ,
660658 async ( session ) => {
661659 await withDockSeed ( project . sdk , session . id , async ( ) => {
662660 await project . gotoSession ( session . id )
663661
662+ await llm . toolMatch ( inputMatch ( { questions } ) , "question" , { questions } )
664663 await seedSessionQuestion ( project . sdk , {
665664 sessionID : session . id ,
666- questions : [
667- {
668- header : "Need input" ,
669- question : "Pick one option" ,
670- options : [ { label : "Continue" , description : "Continue now" } ] ,
671- } ,
672- ] ,
665+ questions,
673666 } )
674667
675668 await expectQuestionBlocked ( page )
0 commit comments