From 067863a06ea12236f2e3b973ad83bfb97d8ae502 Mon Sep 17 00:00:00 2001 From: Ben King <9087625+benfdking@users.noreply.github.com> Date: Wed, 30 Jul 2025 21:12:52 +0100 Subject: [PATCH] chore(vscode): reenabling tests - some of these were flaky but this should fix them and make them more reliable - as working on pieces that affect this bit of the codebase we want these tests working --- vscode/extension/tests/bad_setup.spec.ts | 2 +- vscode/extension/tests/utils.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/vscode/extension/tests/bad_setup.spec.ts b/vscode/extension/tests/bad_setup.spec.ts index 3f715e525a..b76eee2b3d 100644 --- a/vscode/extension/tests/bad_setup.spec.ts +++ b/vscode/extension/tests/bad_setup.spec.ts @@ -91,7 +91,7 @@ test('lineage, no sqlmesh found', async ({ // Checks that if you have another file open like somewhere else, it still checks the workspace first for a successful context // it's very flaky but runs when debugging // - the typing in of the file name is very flaky -test.skip('check that the LSP runs correctly by opening lineage when looking at another file before not in workspace', async ({ +test('check that the LSP runs correctly by opening lineage when looking at another file before not in workspace', async ({ page, sharedCodeServer, tempDir, diff --git a/vscode/extension/tests/utils.ts b/vscode/extension/tests/utils.ts index d75036b0ef..8aecae2f46 100644 --- a/vscode/extension/tests/utils.ts +++ b/vscode/extension/tests/utils.ts @@ -175,17 +175,19 @@ export const openFile = async (page: Page, file: string): Promise => { const maxRetries = 3 const retryDelay = 3000 + const fileName = path.basename(file) + for (let attempt = 0; attempt < maxRetries; attempt++) { try { await page.keyboard.press( process.platform === 'darwin' ? 'Meta+P' : 'Control+P', ) - await page.waitForSelector('input[aria-label="Search files by name"]', { - timeout: 5000, - }) + await page + .getByRole('textbox', { name: 'Search files by name' }) + .waitFor({ state: 'visible', timeout: 5000 }) await page.keyboard.type(file) const commandElement = await page.waitForSelector( - `a:has-text("${file}")`, + `a:has-text("${fileName}")`, { timeout: 5000 }, ) await commandElement.click()