@@ -285,16 +285,15 @@ define(function (require, exports, module) {
285285 CommandManager . execute ( Commands . FILE_OPEN , { fullPath : testFilePath } ) ,
286286 "Open test file"
287287 ) ;
288- } , 5000 ) ;
288+ } , 30000 ) ;
289289
290290 afterAll ( async function ( ) {
291- // Close all files without prompting to save
292- await testWindow . closeAllFiles ( ) ;
293-
294- testWindow = null ;
291+ // closeTestWindow closes the files and parks the project before deleting fixtures.
292+ // Browser IndexedDB cleanup needs the same budget as other integration teardown.
295293 await SpecRunnerUtils . closeTestWindow ( ) ;
296294 await SpecRunnerUtils . deletePathAsync ( testFolder , true ) ;
297- } , 5000 ) ;
295+ testWindow = null ;
296+ } , 30000 ) ;
298297
299298 /**
300299 * Helper function to check if a tab for a specific file exists in the tab bar
@@ -2745,47 +2744,47 @@ define(function (require, exports, module) {
27452744 describe ( "Tab Bar Scrolling" , function ( ) {
27462745 let longTestFilePaths = [ ] ;
27472746
2748- beforeEach ( async function ( ) {
2749- // Create multiple test files to ensure scrolling is needed
2750- longTestFilePaths = [ ] ;
2747+ beforeAll ( async function ( ) {
2748+ // These files are read-only fixtures; create them once rather than rewriting
2749+ // the same 15 files and notifying filesystem watchers before every scroll test.
27512750 for ( let i = 1 ; i <= 15 ; i ++ ) {
27522751 const filePath = testFolder + `/scroll-test-file-${ i } .js` ;
27532752 longTestFilePaths . push ( filePath ) ;
27542753 await jsPromise (
27552754 SpecRunnerUtils . createTextFile ( filePath , `// Test file ${ i } for scrolling` , FileSystem )
27562755 ) ;
27572756 }
2757+ } , 30000 ) ;
27582758
2759- // Open all files to create many tabs
2760- for ( let filePath of longTestFilePaths ) {
2761- await awaitsForDone (
2762- CommandManager . execute ( Commands . FILE_OPEN , { fullPath : filePath } ) ,
2763- `Open ${ filePath } `
2764- ) ;
2759+ beforeEach ( async function ( ) {
2760+ await testWindow . closeAllFiles ( ) ;
2761+ MainViewManager . setLayoutScheme ( 1 , 1 ) ;
2762+ PreferencesManager . set ( "tabBar.options" , { showTabBar : true , numberOfTabs : - 1 } ) ;
2763+ await awaitsForDone (
2764+ CommandManager . execute ( Commands . FILE_OPEN , { fullPath : longTestFilePaths [ 0 ] } ) ,
2765+ "Open the scrolling fixture's active editor"
2766+ ) ;
2767+ // Working-set entries create real tabs without loading and linting 14 more
2768+ // editors. These cases exercise tab scrolling, not document activation.
2769+ for ( const filePath of longTestFilePaths . slice ( 1 ) ) {
2770+ MainViewManager . addToWorkingSet ( "first-pane" , FileSystem . getFileForPath ( filePath ) ) ;
27652771 }
27662772
2767- // Wait for tabs to be rendered
2773+ // Require actual overflow so no scrolling assertion can pass without scrolling.
27682774 await awaitsFor (
27692775 function ( ) {
2770- return getTabCount ( ) >= 15 ;
2776+ const tabBar = $ ( "#phoenix-tab-bar" ) [ 0 ] ;
2777+ return getTabCount ( ) === longTestFilePaths . length && tabBar &&
2778+ tabBar . scrollWidth > tabBar . clientWidth ;
27712779 } ,
2772- "All tabs to be created"
2780+ "All scrolling tabs to be created and overflow "
27732781 ) ;
2782+ $ ( "#phoenix-tab-bar" ) . scrollLeft ( 0 ) ;
27742783 } ) ;
27752784
27762785 afterEach ( async function ( ) {
2777- // Close all test files
2778- for ( let filePath of longTestFilePaths ) {
2779- const fileObj = FileSystem . getFileForPath ( filePath ) ;
2780- try {
2781- await awaitsForDone (
2782- CommandManager . execute ( Commands . FILE_CLOSE , { file : fileObj } ) ,
2783- `Close ${ filePath } `
2784- ) ;
2785- } catch ( e ) {
2786- // Ignore errors if file is already closed
2787- }
2788- }
2786+ await testWindow . closeAllFiles ( ) ;
2787+ MainViewManager . setLayoutScheme ( 1 , 1 ) ;
27892788 } ) ;
27902789
27912790 it ( "should scroll tab bar horizontally when mouse wheel is scrolled" , function ( ) {
@@ -2879,13 +2878,7 @@ define(function (require, exports, module) {
28792878
28802879 // Open multiple files in second pane to enable scrolling
28812880 for ( let i = 1 ; i < 8 ; i ++ ) {
2882- await awaitsForDone (
2883- CommandManager . execute ( Commands . FILE_OPEN , {
2884- fullPath : longTestFilePaths [ i ] ,
2885- paneId : "second-pane"
2886- } ) ,
2887- `Open file ${ i } in second pane`
2888- ) ;
2881+ MainViewManager . addToWorkingSet ( "second-pane" , FileSystem . getFileForPath ( longTestFilePaths [ i ] ) ) ;
28892882 }
28902883
28912884 // Wait for tabs to be rendered in second pane
@@ -2920,14 +2913,9 @@ define(function (require, exports, module) {
29202913 const $tabBar = $ ( "#phoenix-tab-bar" ) ;
29212914 expect ( $tabBar . length ) . toBe ( 1 ) ;
29222915
2923- // Ensure the tab bar is scrollable by checking if scrollWidth > clientWidth
2924- if ( $tabBar [ 0 ] . scrollWidth <= $tabBar [ 0 ] . clientWidth ) {
2925- // Skip test if tab bar is not scrollable
2926- return ;
2927- }
2928-
29292916 // Set initial scroll position to middle to allow scrolling in both directions
29302917 const maxScroll = $tabBar [ 0 ] . scrollWidth - $tabBar [ 0 ] . clientWidth ;
2918+ expect ( maxScroll ) . toBeGreaterThan ( 200 ) ;
29312919 const midScroll = Math . floor ( maxScroll / 2 ) ;
29322920 $tabBar . scrollLeft ( midScroll ) ;
29332921
0 commit comments