@@ -524,30 +524,34 @@ export async function clearCommandPalette() {
524524export async function waitForDashboardToLoad ( section : any ) : Promise < void > {
525525 const wait = getWaitHelper ( ) ;
526526 logger . info ( 'Waiting for Liberty Dashboard to load' ) ;
527-
528- // Re-fetch the section on every iteration — same stale-reference fix as
529- // getDashboardItem. The captured section reference goes stale on mac Previous
530- // during workspace activation and getVisibleItems() throws forever.
527+
528+ // Expand the section
529+ await waitForSuccess ( async ( ) => {
530+ await section . expand ( ) ;
531+ } ) ;
532+
533+ // Wait for section container to become stable after expansion
534+ await wait . sleep ( 2000 ) ;
535+
536+ // Wait for items to appear with retry on ElementNotInteractableError
531537 await wait . forCondition ( async ( ) => {
532538 try {
533- const freshSection = await getDashboardSection ( new SideBarView ( ) ) ;
534- await freshSection . expand ( ) ;
535- const items = await freshSection . getVisibleItems ( ) ;
539+ const items = await section . getVisibleItems ( ) ;
536540 if ( items && items . length > 0 ) {
537541 logger . info ( `Dashboard loaded with ${ items . length } items` ) ;
538542 return true ;
539543 }
540544 } catch ( error : any ) {
541- if ( error . name === ' ElementNotInteractableError' ||
542- error . name === 'StaleElementReferenceError ' ) {
545+ // Retry on ElementNotInteractableError
546+ if ( error . name === 'ElementNotInteractableError ' ) {
543547 logger . info ( 'Container not yet interactable, retrying...' ) ;
544548 return ;
545549 }
546550 throw error ;
547551 }
548552 return ;
549553 } , {
550- timeout : 120000 ,
554+ timeout : 240000 , // 4 minutes — aligns with the 275s test timeout
551555 pollInterval : 5000 ,
552556 message : 'Dashboard items did not load'
553557 } ) ;
0 commit comments