diff --git a/cmuxTests/WorkspaceContentViewVisibilityTests.swift b/cmuxTests/WorkspaceContentViewVisibilityTests.swift index f2f4e856af08..61c22b3ee865 100644 --- a/cmuxTests/WorkspaceContentViewVisibilityTests.swift +++ b/cmuxTests/WorkspaceContentViewVisibilityTests.swift @@ -264,6 +264,22 @@ final class WorkspaceContentViewVisibilityTests { #expect(counts.contentViewBody > 0) #expect(counts.workspaceContentBody > 0) #expect(counts.verticalTabsSidebarBody > 0) + // Setup work keeps publishing after the first render: the selected + // workspace's directory reaches the file explorer a few runloop turns + // later, and that store change re-evaluates ContentView. On a loaded + // runner it landed inside the toggle's window (PR run 36016958288 logged + // "ContentView: _fileExplorerStore changed."), so measure only once the + // window has gone quiet. + var quietRounds = 0 + for _ in 0..<100 where quietRounds < 3 { + counts.reset() + await Self.drainMainRunLoop(for: window) + let settled = counts.contentViewBody == 0 + && counts.workspaceContentBody == 0 + && counts.verticalTabsSidebarBody == 0 + quietRounds = settled ? quietRounds + 1 : 0 + } + try #require(quietRounds >= 3, "The window must stop re-evaluating chrome bodies before the toggle is measured") counts.reset() counts.isMeasuringInvalidations = true defer { counts.isMeasuringInvalidations = false }