Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(e2e): avoid response-listener race in SQL editor flaky test (#47698)

Ali Waseem8f5ba52e2c06
diff --git a/e2e/studio/features/sql-editor.spec.ts b/e2e/studio/features/sql-editor.spec.ts
index 44f2a6500ca..1c7b02f5e0a 100644
--- a/e2e/studio/features/sql-editor.spec.ts
+++ b/e2e/studio/features/sql-editor.spec.ts
@@ -145,10 +145,14 @@ test.describe('SQL Editor', () => {
await page.locator('.view-lines').click()
await page.keyboard.press('ControlOrMeta+KeyA')
await page.keyboard.type(`select length('hello');`)
+
+ const secondSqlMutationPromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {
+ method: 'POST',
+ })
await page.getByTestId('sql-run-button').click()
+ await secondSqlMutationPromise
// verify the result is updated.
- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })
await expect(page.getByRole('gridcell', { name: '5' })).toBeVisible()
await expect(page.getByText('Loading...')).not.toBeVisible()