Skip to content

Commit d28ace3

Browse files
committed
prevent getQuickOpenElements() issues
related to microsoft#34203
1 parent 36a5928 commit d28ace3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/smoke/src/areas/quickopen/quickopen.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ export class QuickOpen {
1313
static QUICK_OPEN_FOCUSED_ELEMENT = `${QuickOpen.QUICK_OPEN} .quick-open-tree .monaco-tree-row.focused .monaco-highlighted-label`;
1414
static QUICK_OPEN_ENTRY_SELECTOR = 'div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties .monaco-tree-row .quick-open-entry';
1515

16-
constructor(readonly spectron: SpectronApplication) {
17-
}
16+
constructor(readonly spectron: SpectronApplication) { }
1817

1918
async openQuickOpen(): Promise<void> {
2019
await this.spectron.command('workbench.action.quickOpen');
@@ -89,12 +88,13 @@ export class QuickOpen {
8988
}
9089

9190
private async getQuickOpenElements(): Promise<string[]> {
92-
return await this.spectron.webclient.selectorExecute(QuickOpen.QUICK_OPEN_ENTRY_SELECTOR,
91+
const result = await this.spectron.webclient.selectorExecute(QuickOpen.QUICK_OPEN_ENTRY_SELECTOR,
9392
div => (Array.isArray(div) ? div : [div]).map(element => {
9493
const name = element.querySelector('.label-name') as HTMLElement;
95-
9694
return name.textContent;
9795
})
9896
);
97+
98+
return Array.isArray(result) ? result : [];
9999
}
100100
}

0 commit comments

Comments
 (0)