@@ -75,24 +75,27 @@ async function readSerializedData(): Promise<SerializedData | undefined> {
7575 * Opens the sample file, using the file picker when needed.
7676 */
7777async function openSampleFile ( ) : Promise < TextEditor > {
78- const editorView = new EditorView ( ) ;
78+ // Try the fast path first: the tab is already open.
7979 try {
80- return ( await editorView . openEditor ( SAMPLE_FILE_BASENAME ) ) as TextEditor ;
80+ return ( await new EditorView ( ) . openEditor ( SAMPLE_FILE_BASENAME ) ) as TextEditor ;
8181 } catch {
82- await VSBrowser . instance . openResources ( SAMPLE_FILE ) ;
82+ // Tab not open yet — ask VS Code to open the file and poll until the
83+ // tab appears. On CI (xvfb) the workspace may still be initialising,
84+ // so we re-issue openResources on every retry to be safe.
8385 await waitForCondition (
8486 async ( ) => {
8587 try {
86- await editorView . openEditor ( SAMPLE_FILE_BASENAME ) ;
88+ await VSBrowser . instance . openResources ( SAMPLE_FILE ) ;
89+ await new EditorView ( ) . openEditor ( SAMPLE_FILE_BASENAME ) ;
8790 return true ;
8891 } catch {
8992 return false ;
9093 }
9194 } ,
92- 20_000 ,
93- 500 ,
95+ 30_000 ,
96+ 1_000 ,
9497 ) ;
95- return ( await editorView . openEditor ( SAMPLE_FILE_BASENAME ) ) as TextEditor ;
98+ return ( await new EditorView ( ) . openEditor ( SAMPLE_FILE_BASENAME ) ) as TextEditor ;
9699 }
97100}
98101
@@ -212,15 +215,6 @@ describe("weAudit Command UI Tests", () => {
212215 await resetWorkspaceState ( workbench ) ;
213216 } ) ;
214217
215- after ( async function ( ) {
216- await resetWorkspaceState ( workbench ) ;
217- // Revert any unsaved editors to prevent "Save changes?" dialogs from
218- // blocking closeAllEditors.
219- await workbench . executeCommand ( "workbench.action.files.revertAll" ) ;
220- const editorView = new EditorView ( ) ;
221- await editorView . closeAllEditors ( ) ;
222- } ) ;
223-
224218 describe ( "Findings & Notes" , ( ) => {
225219 it ( "creates a finding with the provided title" , async function ( ) {
226220 const customTitle = `UI Finding ${ Date . now ( ) } ` ;
0 commit comments