Skip to content

Commit 80b68b7

Browse files
authored
chore(vscode): make the e2e tests more robust (#4664)
1 parent 63fd842 commit 80b68b7

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

vscode/extension/tests/utils.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,31 @@ export const startVSCode = async (
5858
const window = await electronApp.firstWindow()
5959
await window.waitForLoadState('domcontentloaded')
6060
await window.waitForLoadState('networkidle')
61+
await clickExplorerTab(window)
62+
6163
return {
6264
window,
6365
close: async () => {
6466
await electronApp.close()
65-
await fs.removeSync(userDataDir)
67+
await fs.remove(userDataDir)
6668
},
6769
}
6870
}
71+
72+
/**
73+
* Click on the Explorer tab in the VS Code activity bar if the Explorer tab is not already active.
74+
* This is necessary because the Explorer tab may not be visible if the user has not opened it yet.
75+
*/
76+
export const clickExplorerTab = async (page: Page): Promise<void> => {
77+
const isExplorerActive = await page.locator("text='Explorer'").isVisible()
78+
if (!isExplorerActive) {
79+
// Wait for the activity bar to be loaded
80+
await page.waitForSelector('.actions-container[role="tablist"]')
81+
82+
// Click on the Explorer tab using the codicon class
83+
await page.click('.codicon-explorer-view-icon')
84+
85+
// Wait a bit for the explorer view to activate
86+
await page.locator("text='Explorer'").waitFor({ state: 'visible' })
87+
}
88+
}

0 commit comments

Comments
 (0)