Skip to content

Commit 39afadc

Browse files
committed
chore(vscode): fix test stability
1 parent ff16da1 commit 39afadc

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

vscode/extension/tests/quickfix.spec.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,22 @@ test('noselectstar quickfix', async ({ page, sharedCodeServer, tempDir }) => {
7070
await openProblemsView(page)
7171

7272
await page.getByRole('button', { name: 'Show fixes' }).click()
73-
await page
74-
.getByRole('menuitem', { name: 'Replace SELECT * with' })
75-
.first()
76-
.click()
73+
// Wait for the quick fix menu to appear and click the specific action within it.
74+
const quickFixMenu = page.getByRole('menu')
75+
await quickFixMenu.waitFor({ state: 'visible' })
76+
const replaceSelectStar = quickFixMenu.getByRole('menuitem', {
77+
name: /Replace SELECT \* with/i,
78+
})
79+
await replaceSelectStar.first().waitFor({ state: 'visible' })
80+
await replaceSelectStar.first().click()
7781

78-
// Wait for the quick fix to be applied
79-
await page.waitForTimeout(2_000)
82+
// Wait for the quick fix to be applied by polling the file content
83+
await expect
84+
.poll(async () => {
85+
const content = (await fs.readFile(modelPath)).toString('utf8')
86+
return content.includes('SELECT *')
87+
})
88+
.toBeFalsy()
8089

8190
// Assert that the model no longer contains SELECT * but SELECT id, customer_id, waiter_id, start_ts, end_ts, event_date
8291
const readUpdatedFile = (await fs.readFile(modelPath)).toString('utf8')

0 commit comments

Comments
 (0)