55 type Locator ,
66 type Page ,
77} from "@playwright/test" ;
8+ import { mkdtemp , rm } from "node:fs/promises" ;
9+ import { tmpdir } from "node:os" ;
10+ import { join } from "node:path" ;
811
912import {
1013 cleanupE2EAgents ,
@@ -84,13 +87,17 @@ async function getWindowScrollY(page: Page): Promise<number> {
8487
8588async function seedOverflowAgents (
8689 request : APIRequestContext ,
87- count : number
90+ count : number ,
91+ cwd : string
8892) : Promise < Array < { id : string ; name : string } > > {
8993 const created = await Promise . all (
9094 Array . from ( { length : count } , async ( _ , index ) => {
9195 const agent = await createAgentViaAPI ( request , {
9296 name : `e2e-agent-overflow-${ Date . now ( ) } -${ index } ` ,
93- cwd : process . cwd ( ) ,
97+ // These agents only provide enough rows to exercise sidebar overflow.
98+ // Keep them in an owned directory outside the repo so bulk cleanup does
99+ // not discover repository or shared temporary-directory lifecycle hooks.
100+ cwd,
94101 } ) ;
95102 await setAgentLatestEventViaAPI ( request , agent . id , {
96103 type : "working" ,
@@ -104,15 +111,22 @@ async function seedOverflowAgents(
104111}
105112
106113test . describe ( "Overflow layout" , ( ) => {
114+ let overflowCwd : string ;
115+
116+ test . beforeAll ( async ( ) => {
117+ overflowCwd = await mkdtemp ( join ( tmpdir ( ) , "dispatch-e2e-overflow-" ) ) ;
118+ } ) ;
119+
107120 test . afterAll ( async ( { request } ) => {
108121 await cleanupE2EAgents ( request ) ;
122+ await rm ( overflowCwd , { recursive : true , force : true } ) ;
109123 } ) ;
110124
111125 test ( "agents workspace keeps sidebar, media, and terminal overflow isolated" , async ( {
112126 page,
113127 request,
114128 } ) => {
115- const agents = await seedOverflowAgents ( request , 24 ) ;
129+ const agents = await seedOverflowAgents ( request , 24 , overflowCwd ) ;
116130 const focusAgent = agents [ 0 ] ! ;
117131
118132 await setAgentPinsViaDB (
0 commit comments