@@ -134,14 +134,14 @@ suite("Markdown Discovery and Preview E2E Tests", () => {
134134
135135 assert . ok ( readmeItem !== undefined && isCommandItem ( readmeItem . data ) , "Should find README.md with task" ) ;
136136
137- const initialEditorCount = vscode . window . visibleTextEditors . length ;
137+ const initialTabCount = vscode . window . tabGroups . all . flatMap ( ( g ) => g . tabs ) . length ;
138138
139139 await vscode . commands . executeCommand ( "commandtree.openPreview" , readmeItem ) ;
140140
141141 await sleep ( 2000 ) ;
142142
143- const finalEditorCount = vscode . window . visibleTextEditors . length ;
144- assert . ok ( finalEditorCount >= initialEditorCount , "Preview should open a new editor or reuse existing " ) ;
143+ const finalTabCount = vscode . window . tabGroups . all . flatMap ( ( g ) => g . tabs ) . length ;
144+ assert . ok ( finalTabCount > initialTabCount , "Preview should open a new tab " ) ;
145145 } ) ;
146146
147147 test ( "run command on markdown item opens preview" , async function ( ) {
@@ -159,14 +159,14 @@ suite("Markdown Discovery and Preview E2E Tests", () => {
159159
160160 assert . ok ( guideItem !== undefined && isCommandItem ( guideItem . data ) , "Should find guide.md with task" ) ;
161161
162- const initialEditorCount = vscode . window . visibleTextEditors . length ;
162+ const initialTabCount = vscode . window . tabGroups . all . flatMap ( ( g ) => g . tabs ) . length ;
163163
164164 await vscode . commands . executeCommand ( "commandtree.run" , guideItem ) ;
165165
166166 await sleep ( 2000 ) ;
167167
168- const finalEditorCount = vscode . window . visibleTextEditors . length ;
169- assert . ok ( finalEditorCount >= initialEditorCount , "Running markdown item should open preview" ) ;
168+ const finalTabCount = vscode . window . tabGroups . all . flatMap ( ( g ) => g . tabs ) . length ;
169+ assert . ok ( finalTabCount > initialTabCount , "Running markdown item should open preview" ) ;
170170
171171 // Verify markdown uses preview, not terminal (exercises TaskRunner.runMarkdownPreview routing)
172172 const markdownTerminals = vscode . window . terminals . filter ( ( t ) => t . name . includes ( "guide.md" ) ) ;
0 commit comments