@@ -27,7 +27,7 @@ const invisibleJavaFilePath = path.join("src", "App.java");
2727
2828describe ( "Command Tests" , function ( ) {
2929
30- this . timeout ( 2 * 60 * 1000 /*ms*/ ) ;
30+ this . timeout ( 5 * 60 * 1000 /*ms*/ ) ;
3131 const mavenProjectTmpFolders : string [ ] = [ ] ;
3232 let currentProjectPath : string | undefined ;
3333 let statusBar : StatusBar ;
@@ -65,15 +65,23 @@ describe("Command Tests", function() {
6565 if ( language === 'Java' ) {
6666 break ;
6767 }
68+ await sleep ( 500 ) ;
6869 }
69- while ( true ) {
70+ // Wait until the language server is no longer indexing.
71+ // Use a max wait to avoid infinite loops if the status UI changes between VS Code versions.
72+ const maxWaitMs = 3 * 60 * 1000 ;
73+ const startTime = Date . now ( ) ;
74+ while ( Date . now ( ) - startTime < maxWaitMs ) {
7075 try {
7176 const languageStatus = await statusBar . findElement ( By . xpath ( '//*[@id="status.languageStatus"]' ) ) ;
7277 await languageStatus . click ( ) ;
73- await languageStatus . findElement ( By . xpath ( `//div[contains(@class, 'context-view')]//div[contains(@class, 'hover-language-status')]//span[contains(@class, 'codicon-thumbsup')]` ) ) ;
78+ // Accept either codicon-thumbsup (older VS Code) or codicon-pass (newer VS Code)
79+ await languageStatus . findElement ( By . xpath (
80+ `//div[contains(@class, 'context-view')]//div[contains(@class, 'hover-language-status')]//*[contains(@class, 'codicon-thumbsup') or contains(@class, 'codicon-pass')]`
81+ ) ) ;
7482 break ;
7583 } catch ( e ) {
76- await sleep ( 100 ) ;
84+ await sleep ( 1000 ) ;
7785 }
7886 }
7987 }
@@ -85,9 +93,14 @@ describe("Command Tests", function() {
8593 } ) ;
8694
8795 after ( async function ( ) {
88- mavenProjectTmpFolders . forEach ( mavenProjectTmpFolder => {
89- fse . rmSync ( mavenProjectTmpFolder , { force : true , recursive : true } ) ;
90- } ) ;
96+ for ( const mavenProjectTmpFolder of mavenProjectTmpFolders ) {
97+ try {
98+ fse . rmSync ( mavenProjectTmpFolder , { force : true , recursive : true } ) ;
99+ } catch ( e ) {
100+ // Ignore EBUSY and other cleanup errors on Windows when VS Code still holds file locks
101+ console . warn ( `Warning: failed to clean up temp folder ${ mavenProjectTmpFolder } : ${ e } ` ) ;
102+ }
103+ }
91104 } ) ;
92105
93106
0 commit comments