The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: E2E tests that are flaky due banner (#43062)
Ali Waseem571e0603c09f
diff --git a/e2e/studio/features/table-editor.spec.ts b/e2e/studio/features/table-editor.spec.tsindex e3a4429f71b..6cc06f681ba 100644--- a/e2e/studio/features/table-editor.spec.ts+++ b/e2e/studio/features/table-editor.spec.ts@@ -94,7 +94,10 @@ const deleteTable = async (page: Page, ref: string, tableName: string) => {}const deleteEnumIfExist = async (page: Page, ref: string, enumName: string) => {- await waitForApiResponse(page, 'pg-meta', ref, 'types')+ // Wait for the types page to fully load by checking for a known enum that always exists+ await expect(page.getByRole('cell', { name: 'feedback_vote', exact: true })).toBeVisible({+ timeout: 30_000,+ })// if enum (test) exists, delete it.const exists = (await page.getByRole('cell', { name: enumName, exact: true }).count()) > 0@@ -106,8 +109,11 @@ const deleteEnumIfExist = async (page: Page, ref: string, enumName: string) => {.click()await page.getByRole('menuitem', { name: 'Delete type' }).click()await page.getByRole('heading', { name: 'Confirm to delete enumerated' }).click()+ const deleteEnumPromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByRole('button', { name: 'Confirm delete' }).click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })+ await deleteEnumPromise}// Due to rate API rate limits run this test in serial mode on platform.@@ -179,8 +185,9 @@ testRunner('table editor', () => {.getByRole('button').nth(2).click()+ const schemaPromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=table-definition-')await page.getByRole('menuitem', { name: 'Copy table schema' }).click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=table-definition-') // wait for endpoint to generate schema+ await schemaPromise // wait for endpoint to generate schemaawait page.waitForTimeout(500)const copiedSchemaResult = await page.evaluate(() => navigator.clipboard.readText())expect(copiedSchemaResult).toBe(`create table public.pw_table_actions (@@ -197,8 +204,11 @@ testRunner('table editor', () => {.nth(2).click()await page.getByRole('menuitem', { name: 'Duplicate table' }).click()+ const duplicatePromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByRole('button', { name: 'Save' }).click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' }) // create duplicate table+ await duplicatePromise // create duplicate tableawait waitForTableToLoad(page, ref) // load tablesawait expect(page.getByLabel(`View ${tableNameActionsDuplicate}`, { exact: true })@@ -279,8 +289,9 @@ testRunner('table editor', () => {await page.locator('input[name="values.0.value"]').fill('value1')await page.getByRole('button', { name: 'Add value' }).click()await page.locator('input[name="values.1.value"]').fill('value2')+ const createTypePromise = waitForApiResponse(page, 'pg-meta', ref, 'types')await page.getByRole('button', { name: 'Create type' }).click()- await waitForApiResponse(page, 'pg-meta', ref, 'types')+ await createTypePromise// verify enum is createdawait expect(page.getByRole('cell', { name: enum_name, exact: true })).toBeVisible()@@ -355,8 +366,11 @@ testRunner('table editor', () => {await page.getByTestId('table-editor-insert-new-row').click()await page.getByRole('menuitem', { name: 'Insert row Insert a new row' }).click()await page.getByTestId('pw_column-input').fill(value)+ const insertPromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByTestId('action-bar-save-row').click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' }) // insert rows+ await insertPromise // insert rows}// verify row content@@ -373,8 +387,11 @@ testRunner('table editor', () => {await page.getByRole('menuitem', { name: 'Edit table' }).click()await page.getByTestId('table-name-input').fill(tableNameUpdated)await page.getByRole('textbox', { name: 'pw_column' }).fill(columnNameUpdated)+ const updateTablePromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=column-update', {+ method: 'POST',+ })await page.getByRole('button', { name: 'Save' }).click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=column-update', { method: 'POST' }) // update table+ await updateTablePromise // update tableawait waitForTableToLoad(page, ref) // load tablesawait expect(page.getByLabel(`View ${tableNameUpdated}`, { exact: true })).toBeVisible()await expect(page.getByLabel(`View ${tableNameGridEditor}`, { exact: true })).not.toBeVisible()@@ -557,8 +574,11 @@ testRunner('table editor', () => {await page.getByTestId('table-editor-insert-new-row').click()await page.getByRole('menuitem', { name: 'Insert row Insert a new row' }).click()await page.getByTestId(`${colName}-input`).fill(value)+ const insertPromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByTestId('action-bar-save-row').click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })+ await insertPromise}// Apply sorting@@ -773,15 +793,21 @@ testRunner('table editor', () => {await page.getByTestId('table-editor-insert-new-row').click()await page.getByRole('menuitem', { name: 'Insert row Insert a new row' }).click()await page.getByTestId(`${colName}-input`).fill('first_row_value')+ const insertFirstPromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByTestId('action-bar-save-row').click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })+ await insertFirstPromise// Insert second row with value 'second_row_value'await page.getByTestId('table-editor-insert-new-row').click()await page.getByRole('menuitem', { name: 'Insert row Insert a new row' }).click()await page.getByTestId(`${colName}-input`).fill('second_row_value')+ const insertSecondPromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByTestId('action-bar-save-row').click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })+ await insertSecondPromise// Wait for grid to be visibleawait expect(page.getByRole('grid')).toBeVisible()@@ -861,8 +887,11 @@ testRunner('table editor', () => {await page.getByRole('menuitem', { name: 'Insert row Insert a new row' }).click()await page.getByRole('combobox').click()await page.getByRole('option', { name: 'TRUE' }).click()+ const insertTruePromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByTestId('action-bar-save-row').click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })+ await insertTruePromiseawait expect(page.getByRole('gridcell', { name: 'TRUE' }),@@ -874,8 +903,11 @@ testRunner('table editor', () => {await page.getByRole('menuitem', { name: 'Insert row Insert a new row' }).click()await page.getByRole('combobox').click()await page.getByRole('option', { name: 'FALSE' }).click()+ const insertFalsePromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByTestId('action-bar-save-row').click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })+ await insertFalsePromise// Verify FALSE value is preservedawait expect(@@ -892,10 +924,10 @@ testRunner('table editor', () => {await expect(booleanEditor, 'Boolean editor should be visible').toBeVisible()// Change from false to true- await booleanEditor.selectOption('true')const updateTrueResponse = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {method: 'POST',})+ await booleanEditor.selectOption('true')await page.getByRole('columnheader', { name: 'id' }).click()await updateTrueResponse@@ -911,10 +943,10 @@ testRunner('table editor', () => {await trueCell.dblclick()await expect(booleanEditor, 'Boolean editor should be visible for second edit').toBeVisible()- await booleanEditor.selectOption('false')const updateFalseResponse = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {method: 'POST',})+ await booleanEditor.selectOption('false')await page.getByRole('columnheader', { name: 'id' }).click()await updateFalseResponse@@ -974,8 +1006,11 @@ testRunner('table editor', () => {await page.getByRole('menuitem', { name: 'Insert row Insert a new row' }).click()await page.getByRole('combobox').click()await page.getByRole('option', { name: 'TRUE' }).click()+ const insertTruePromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByTestId('action-bar-save-row').click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })+ await insertTruePromiseawait expect(page.getByRole('gridcell', { name: 'TRUE' }),@@ -987,8 +1022,11 @@ testRunner('table editor', () => {await page.getByRole('menuitem', { name: 'Insert row Insert a new row' }).click()await page.getByRole('combobox').click()await page.getByRole('option', { name: 'FALSE' }).click()+ const insertFalsePromise = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {+ method: 'POST',+ })await page.getByTestId('action-bar-save-row').click()- await waitForApiResponse(page, 'pg-meta', ref, 'query?key=', { method: 'POST' })+ await insertFalsePromiseawait expect(page.getByRole('gridcell', { name: 'FALSE' }),@@ -1002,11 +1040,10 @@ testRunner('table editor', () => {const booleanEditor = page.locator('#boolean-editor')await expect(booleanEditor, 'Boolean editor should be visible').toBeVisible()- await booleanEditor.selectOption('null')-const updateNullResponse = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {method: 'POST',})+ await booleanEditor.selectOption('null')await page.getByRole('columnheader', { name: 'id' }).click()await updateNullResponse@@ -1018,11 +1055,10 @@ testRunner('table editor', () => {const nullCellToFalse = page.getByRole('gridcell', { name: 'NULL' })await nullCellToFalse.dblclick()- await booleanEditor.selectOption('false')-const updateFalseResponse = waitForApiResponse(page, 'pg-meta', ref, 'query?key=', {method: 'POST',})+ await booleanEditor.selectOption('false')await page.getByRole('columnheader', { name: 'id' }).click()await updateFalseResponsediff --git a/e2e/studio/utils/test.ts b/e2e/studio/utils/test.tsindex 2970f398607..8e134c064d4 100644--- a/e2e/studio/utils/test.ts+++ b/e2e/studio/utils/test.ts@@ -1,6 +1,7 @@+import path from 'path'import { test as base } from '@playwright/test'import dotenv from 'dotenv'-import path from 'path'+import { env } from '../env.config.js'dotenv.config({@@ -18,4 +19,11 @@ export const test = base.extend<TestOptions>({env: env.STUDIO_URL,ref: env.PROJECT_REF ?? 'default',apiUrl: env.API_URL,+ page: async ({ page }, use) => {+ const ref = env.PROJECT_REF ?? 'default'+ await page.addInitScript((ref) => {+ localStorage.setItem(`table-editor-new-filter-banner-dismissed-${ref}`, JSON.stringify(true))+ }, ref)+ await use(page)+ },})