Skip to content

Commit ebf48ce

Browse files
Siddharth SaladiSiddharth Saladi
authored andcommitted
stale references
1 parent 796ea4c commit ebf48ce

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

src/test/utils/testUtils.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -524,35 +524,31 @@ export async function clearCommandPalette() {
524524
export async function waitForDashboardToLoad(section: any): Promise<void> {
525525
const wait = getWaitHelper();
526526
logger.info('Waiting for Liberty Dashboard to load');
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
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.
537531
await wait.forCondition(async () => {
538532
try {
539-
const items = await section.getVisibleItems();
533+
const freshSection = await getDashboardSection(new SideBarView());
534+
await freshSection.expand();
535+
const items = await freshSection.getVisibleItems();
540536
if (items && items.length > 0) {
541537
logger.info(`Dashboard loaded with ${items.length} items`);
542538
return true;
543539
}
544540
} catch (error: any) {
545-
// Retry on ElementNotInteractableError
546-
if (error.name === 'ElementNotInteractableError') {
541+
if (error.name === 'ElementNotInteractableError' ||
542+
error.name === 'StaleElementReferenceError') {
547543
logger.info('Container not yet interactable, retrying...');
548544
return;
549545
}
550546
throw error;
551547
}
552548
return;
553549
}, {
554-
timeout: 120000, // 2 minutes max
555-
pollInterval: 5000, // check every 5 seconds
550+
timeout: 120000,
551+
pollInterval: 5000,
556552
message: 'Dashboard items did not load'
557553
});
558554
}

0 commit comments

Comments
 (0)