From ffedc970d7b8d39d5fc921104cc5a6cafd1a80bc Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:39 +0000 Subject: [PATCH 01/11] test: wait for page to stabalise after table creation --- tests/playwright/pages/Dashboard/TreeView.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/playwright/pages/Dashboard/TreeView.ts b/tests/playwright/pages/Dashboard/TreeView.ts index cc226a0537..6bcc1429ff 100644 --- a/tests/playwright/pages/Dashboard/TreeView.ts +++ b/tests/playwright/pages/Dashboard/TreeView.ts @@ -162,6 +162,10 @@ export class TreeViewPage extends BasePage { // Tab render is slow for playwright await this.dashboard.waitForTabRender({ title, mode }); + + // Some of the tests are flaky due to immediate operations on the table + // Tab render above is no more valid + await this.rootPage.waitForTimeout(1000); } async verifyTable({ title, index, exists = true }: { title: string; index?: number; exists?: boolean }) { From 0234b950c745ac9ab2543b771f701f3028f33355 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:39 +0000 Subject: [PATCH 02/11] test: replace addRecord call using API --- tests/playwright/pages/Dashboard/TreeView.ts | 4 -- .../db/columns/columnMultiSelect.spec.ts | 37 ++++++++++++++++++- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/tests/playwright/pages/Dashboard/TreeView.ts b/tests/playwright/pages/Dashboard/TreeView.ts index 6bcc1429ff..cc226a0537 100644 --- a/tests/playwright/pages/Dashboard/TreeView.ts +++ b/tests/playwright/pages/Dashboard/TreeView.ts @@ -162,10 +162,6 @@ export class TreeViewPage extends BasePage { // Tab render is slow for playwright await this.dashboard.waitForTabRender({ title, mode }); - - // Some of the tests are flaky due to immediate operations on the table - // Tab render above is no more valid - await this.rootPage.waitForTimeout(1000); } async verifyTable({ title, index, exists = true }: { title: string; index?: number; exists?: boolean }) { diff --git a/tests/playwright/tests/db/columns/columnMultiSelect.spec.ts b/tests/playwright/tests/db/columns/columnMultiSelect.spec.ts index e4fc5ba98e..bb9c764bd7 100644 --- a/tests/playwright/tests/db/columns/columnMultiSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnMultiSelect.spec.ts @@ -5,10 +5,18 @@ import setup, { unsetup } from '../../../setup'; import { ToolbarPage } from '../../../pages/Dashboard/common/Toolbar'; import { Api } from 'nocodb-sdk'; let api: Api; +const addRecordUsingAPI = async (context: any, tableId: string, rowAttributes: any) => { + try { + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, rowAttributes); + } catch (e) { + console.error(e); + } +}; test.describe('Multi select', () => { let dashboard: DashboardPage, grid: GridPage; let context: any; + let tableId: string; test.beforeEach(async ({ page }) => { context = await setup({ page, isEmptyProject: true }); @@ -22,7 +30,25 @@ test.describe('Multi select', () => { columnTitle: 'MultiSelect', options: ['Option 1', 'Option 2'], }); - await grid.addNewRow({ index: 0, value: 'Row 0' }); + + api = new Api({ + baseURL: `http://localhost:8080/`, + headers: { + 'xc-auth': context.token, + }, + }); + + const tables = await api.dbTable.list(context.base.id); + tableId = tables.list.find((table: any) => table.title === 'sheet1').id; + await addRecordUsingAPI(context, tableId, [ + { + Id: 1, + Title: `Row 0`, + }, + ]); + + // page reload + await page.reload(); }); test.afterEach(async () => { @@ -56,7 +82,14 @@ test.describe('Multi select', () => { multiSelect: true, }); - await grid.addNewRow({ index: 1, value: 'Row 1' }); + await addRecordUsingAPI(context, tableId, [ + { + Id: 2, + Title: `Row 1`, + }, + ]); + await grid.rootPage.reload(); + await grid.cell.selectOption.select({ index: 1, columnHeader: 'MultiSelect', From 7a0465e80adfc02c77b4ef39b3ea527f89a32f83 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:40 +0000 Subject: [PATCH 03/11] fix: replace UI record insert with API --- .../tests/db/columns/columnUserSelect.spec.ts | 49 +++++++++++++++++-- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts index 1dd6fc71d6..1bfa0b32b4 100644 --- a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts @@ -59,17 +59,20 @@ async function beforeEachInit({ page }: { page: any }) { } } - return { dashboard, context }; + return { dashboard, context, api }; } test.describe('User single select', () => { let dashboard: DashboardPage, grid: GridPage, topbar: TopbarPage; let context: any; + let api: Api; + let tableId: string; test.beforeEach(async ({ page }) => { const initRsp = await beforeEachInit({ page: page }); context = initRsp.context; dashboard = initRsp.dashboard; + api = initRsp.api; grid = dashboard.grid; topbar = dashboard.grid.topbar; @@ -77,7 +80,16 @@ test.describe('User single select', () => { await grid.column.create({ title: 'User', type: 'User' }); - await grid.addNewRow({ index: 0, value: 'Row 0' }); + // await grid.addNewRow({ index: 0, value: 'Row 0' }); + const tables = await api.dbTable.list(context.base.id); + tableId = tables.list.find((table: any) => table.title === 'sheet1').id; + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { + Id: 1, + Title: `Row 0`, + }, + ]); + await page.reload(); }); test.afterEach(async () => { @@ -102,7 +114,15 @@ test.describe('User single select', () => { }); // Add new row and verify default value is added in new cell - await grid.addNewRow({ index: 1, value: 'Row 1' }); + // await grid.addNewRow({ index: 1, value: 'Row 1' }); + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { + Id: 2, + Title: `Row 1`, + }, + ]); + await grid.rootPage.reload(); + await grid.cell.userOption.verify({ index: 1, columnHeader: 'User', @@ -130,9 +150,18 @@ test.describe('User single select', () => { }); test('Field operations - duplicate column, convert to SingleLineText', async () => { + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { Id: 2, Title: `Row 1` }, + { Id: 3, Title: `Row 2` }, + { Id: 4, Title: `Row 3` }, + { Id: 5, Title: `Row 4` }, + { Id: 6, Title: `Row 5` }, + ]); + await grid.rootPage.reload(); + for (let i = 0; i <= 4; i++) { await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); - await grid.addNewRow({ index: i + 1, value: `Row ${i + 1}` }); + // await grid.addNewRow({ index: i + 1, value: `Row ${i + 1}` }); } await grid.column.duplicateColumn({ @@ -164,10 +193,20 @@ test.describe('User single select', () => { multiSelect: false, }); + // add 5 rows + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { Id: 2, Title: `Row 1` }, + { Id: 3, Title: `Row 2` }, + { Id: 4, Title: `Row 3` }, + { Id: 5, Title: `Row 4` }, + { Id: 6, Title: `Row 5` }, + ]); + await grid.rootPage.reload(); + // Edit, refresh and verify for (let i = 0; i <= 4; i++) { await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); - await grid.addNewRow({ index: i + 1, value: `Row ${i + 1}` }); + // await grid.addNewRow({ index: i + 1, value: `Row ${i + 1}` }); } // refresh page From 36ead4b22d49bbb1a1b5cc596948d36b20c648f3 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:40 +0000 Subject: [PATCH 04/11] test: typo fix --- tests/playwright/tests/db/columns/columnUserSelect.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts index 1bfa0b32b4..a3f94afeeb 100644 --- a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts @@ -76,7 +76,7 @@ test.describe('User single select', () => { grid = dashboard.grid; topbar = dashboard.grid.topbar; - await dashboard.treeView.createTable({ title: 'Sheet1', baseTitle: context.base.title }); + await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); await grid.column.create({ title: 'User', type: 'User' }); From 31ef33254fbedc7c3ff2cbd8fb49997d496a279b Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:40 +0000 Subject: [PATCH 05/11] test: replace UI add record with API --- .../tests/db/columns/columnUserSelect.spec.ts | 70 +++++++++++++++++-- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts index a3f94afeeb..c59ddf0e49 100644 --- a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts @@ -314,11 +314,14 @@ test.describe('User single select - filter, sort & GroupBy', () => { let dashboard: DashboardPage, grid: GridPage, toolbar: ToolbarPage; let context: any; + let api: Api; + let tableId: string; test.beforeEach(async ({ page }) => { const initRsp = await beforeEachInit({ page: page }); context = initRsp.context; dashboard = initRsp.dashboard; + api = initRsp.api; grid = dashboard.grid; toolbar = dashboard.grid.toolbar; @@ -326,8 +329,19 @@ test.describe('User single select - filter, sort & GroupBy', () => { await grid.column.create({ title: 'User', type: 'User' }); + const tables = await api.dbTable.list(context.base.id); + tableId = tables.list.find((table: any) => table.title === 'sheet1').id; + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { Id: 1, Title: `0` }, + { Id: 2, Title: `1` }, + { Id: 3, Title: `2` }, + { Id: 4, Title: `3` }, + { Id: 5, Title: `4` }, + ]); + await page.reload(); + for (let i = 0; i <= 4; i++) { - await grid.addNewRow({ index: i, value: `${i}` }); + // await grid.addNewRow({ index: i, value: `${i}` }); await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); } }); @@ -437,11 +451,14 @@ test.describe('User single select - filter, sort & GroupBy', () => { test.describe('User multiple select', () => { let dashboard: DashboardPage, grid: GridPage, topbar: TopbarPage; let context: any; + let api: Api; + let tableId: string; test.beforeEach(async ({ page }) => { const initRsp = await beforeEachInit({ page: page }); context = initRsp.context; dashboard = initRsp.dashboard; + api = initRsp.api; grid = dashboard.grid; topbar = dashboard.grid.topbar; @@ -449,6 +466,9 @@ test.describe('User multiple select', () => { await grid.column.create({ title: 'User', type: 'User' }); await grid.column.userOption.allowMultipleUser({ columnTitle: 'User', allowMultiple: true }); + + const tables = await api.dbTable.list(context.base.id); + tableId = tables.list.find((table: any) => table.title === 'Sheet1').id; }); test.afterEach(async () => { @@ -456,7 +476,9 @@ test.describe('User multiple select', () => { }); test('Verify the default option count, select default value and verify', async () => { - await grid.addNewRow({ index: 0, value: 'Row 0' }); + // await grid.addNewRow({ index: 0, value: 'Row 0' }); + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [{ Id: 1, Title: `Row 0` }]); + await grid.rootPage.reload(); if (!isEE()) { await grid.column.userOption.verifyDefaultValueOptionCount({ columnTitle: 'User', totalCount: 5 }); @@ -475,7 +497,10 @@ test.describe('User multiple select', () => { }); // Add new row and verify default value is added in new cell - await grid.addNewRow({ index: 1, value: 'Row 1' }); + // await grid.addNewRow({ index: 1, value: 'Row 1' }); + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [{ Id: 2, Title: `Row 1` }]); + await grid.rootPage.reload(); + await grid.cell.userOption.verify({ index: 1, columnHeader: 'User', @@ -491,9 +516,18 @@ test.describe('User multiple select', () => { }); test('Field operations - duplicate column, convert to SingleLineText', async () => { + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { Id: 1, Title: `Row 0` }, + { Id: 2, Title: `Row 1` }, + { Id: 3, Title: `Row 2` }, + { Id: 4, Title: `Row 3` }, + { Id: 5, Title: `Row 4` }, + ]); + await grid.rootPage.reload(); + let counter = 1; for (let i = 0; i <= 4; i++) { - await grid.addNewRow({ index: i, value: `Row ${i}` }); + // await grid.addNewRow({ index: i, value: `Row ${i}` }); await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: true }); await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[counter], multiSelect: true }); @@ -536,10 +570,19 @@ test.describe('User multiple select', () => { }); test('Cell Operation - edit, copy-paste and delete', async () => { + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { Id: 1, Title: `Row 0` }, + { Id: 2, Title: `Row 1` }, + { Id: 3, Title: `Row 2` }, + { Id: 4, Title: `Row 3` }, + { Id: 5, Title: `Row 4` }, + ]); + await grid.rootPage.reload(); + // Edit, refresh and verify let counter = 1; for (let i = 0; i <= 4; i++) { - await grid.addNewRow({ index: i, value: `Row ${i}` }); + // await grid.addNewRow({ index: i, value: `Row ${i}` }); await grid.cell.userOption.select({ index: i, @@ -656,11 +699,14 @@ test.describe('User multiple select - filter, sort & GroupBy', () => { let dashboard: DashboardPage, grid: GridPage, toolbar: ToolbarPage; let context: any; + let api: Api; + let tableId: string; test.beforeEach(async ({ page }) => { const initRsp = await beforeEachInit({ page: page }); context = initRsp.context; dashboard = initRsp.dashboard; + api = initRsp.api; grid = dashboard.grid; toolbar = dashboard.grid.toolbar; @@ -669,9 +715,21 @@ test.describe('User multiple select - filter, sort & GroupBy', () => { await grid.column.create({ title: 'User', type: 'User' }); await grid.column.userOption.allowMultipleUser({ columnTitle: 'User', allowMultiple: true }); + const tables = await api.dbTable.list(context.base.id); + tableId = tables.list.find((table: any) => table.title === 'sheet1').id; + + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { Id: 1, Title: `0` }, + { Id: 2, Title: `1` }, + { Id: 3, Title: `2` }, + { Id: 4, Title: `3` }, + { Id: 5, Title: `4` }, + ]); + await grid.rootPage.reload(); + let counter = 2; for (let i = 0; i <= 4; i++) { - await grid.addNewRow({ index: i, value: `${i}` }); + // await grid.addNewRow({ index: i, value: `${i}` }); await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: true }); if (i !== 0) { await grid.cell.userOption.select({ From 30e79b1a28dc777cc777fafafc5022e8f7803f81 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:40 +0000 Subject: [PATCH 06/11] test: fix single select record insert using api --- tests/playwright/setup/index.ts | 4 ++- .../db/columns/columnMultiSelect.spec.ts | 16 ++-------- .../db/columns/columnSingleSelect.spec.ts | 32 ++++++++++++++++--- .../tests/db/columns/columnUserSelect.spec.ts | 8 +---- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/tests/playwright/setup/index.ts b/tests/playwright/setup/index.ts index 0b96820a16..f67022df7b 100644 --- a/tests/playwright/setup/index.ts +++ b/tests/playwright/setup/index.ts @@ -155,6 +155,7 @@ export interface NcContext { workspace: WorkspaceType; defaultProjectTitle: string; defaultTableTitle: string; + api: Api; } selectors.setTestIdAttribute('data-testid'); @@ -344,7 +345,7 @@ async function localInit({ // get current user information const user = await api.auth.me(); - return { data: { base, user, workspace, token }, status: 200 }; + return { data: { base, user, workspace, token, api }, status: 200 }; } catch (e) { console.error(`Error resetting base: ${process.env.TEST_PARALLEL_INDEX}`, e); return { data: {}, status: 500 }; @@ -477,6 +478,7 @@ const setup = async ({ workspace, defaultProjectTitle: 'Getting Started', defaultTableTitle: 'Features', + api: response?.data?.api, } as NcContext; }; diff --git a/tests/playwright/tests/db/columns/columnMultiSelect.spec.ts b/tests/playwright/tests/db/columns/columnMultiSelect.spec.ts index bb9c764bd7..1b81f11289 100644 --- a/tests/playwright/tests/db/columns/columnMultiSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnMultiSelect.spec.ts @@ -31,23 +31,11 @@ test.describe('Multi select', () => { options: ['Option 1', 'Option 2'], }); - api = new Api({ - baseURL: `http://localhost:8080/`, - headers: { - 'xc-auth': context.token, - }, - }); + api = context.api; const tables = await api.dbTable.list(context.base.id); tableId = tables.list.find((table: any) => table.title === 'sheet1').id; - await addRecordUsingAPI(context, tableId, [ - { - Id: 1, - Title: `Row 0`, - }, - ]); - - // page reload + await addRecordUsingAPI(context, tableId, [{ Id: 1, Title: `Row 0` }]); await page.reload(); }); diff --git a/tests/playwright/tests/db/columns/columnSingleSelect.spec.ts b/tests/playwright/tests/db/columns/columnSingleSelect.spec.ts index 74df46ddcc..ff9de479dc 100644 --- a/tests/playwright/tests/db/columns/columnSingleSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnSingleSelect.spec.ts @@ -3,15 +3,19 @@ import { DashboardPage } from '../../../pages/Dashboard'; import { GridPage } from '../../../pages/Dashboard/Grid'; import setup, { unsetup } from '../../../setup'; import { ToolbarPage } from '../../../pages/Dashboard/common/Toolbar'; +import { Api } from 'nocodb-sdk'; test.describe('Single select', () => { let dashboard: DashboardPage, grid: GridPage; let context: any; + let api: Api; + let tableId: string; test.beforeEach(async ({ page }) => { context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.base); grid = dashboard.grid; + api = context.api; await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); @@ -20,7 +24,11 @@ test.describe('Single select', () => { columnTitle: 'SingleSelect', options: ['Option 1', 'Option 2'], }); - await grid.addNewRow({ index: 0, value: 'Row 0' }); + + const tables = await api.dbTable.list(context.base.id); + tableId = tables.list.find((table: any) => table.title === 'sheet1').id; + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [{ Id: 1, Title: `Row 0` }]); + await page.reload(); }); test.afterEach(async () => { @@ -120,12 +128,15 @@ test.describe('Single select - filter & sort', () => { let dashboard: DashboardPage, grid: GridPage, toolbar: ToolbarPage; let context: any; + let api: Api; + let tableId: string; test.beforeEach(async ({ page }) => { context = await setup({ page }); dashboard = new DashboardPage(page, context.base); toolbar = dashboard.grid.toolbar; grid = dashboard.grid; + api = context.api; await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); @@ -134,10 +145,21 @@ test.describe('Single select - filter & sort', () => { columnTitle: 'SingleSelect', options: ['foo', 'bar', 'baz'], }); - await grid.addNewRow({ index: 0, value: '1' }); - await grid.addNewRow({ index: 1, value: '2' }); - await grid.addNewRow({ index: 2, value: '3' }); - await grid.addNewRow({ index: 3, value: '4' }); + + const tables = await api.dbTable.list(context.base.id); + tableId = tables.list.find((table: any) => table.title === 'sheet1').id; + await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ + { Id: 1, Title: '1' }, + { Id: 2, Title: '2' }, + { Id: 3, Title: '3' }, + { Id: 4, Title: '4' }, + ]); + await page.reload(); + + // await grid.addNewRow({ index: 0, value: '1' }); + // await grid.addNewRow({ index: 1, value: '2' }); + // await grid.addNewRow({ index: 2, value: '3' }); + // await grid.addNewRow({ index: 3, value: '4' }); await grid.cell.selectOption.select({ index: 1, columnHeader: 'SingleSelect', option: 'foo', multiSelect: false }); await grid.cell.selectOption.select({ index: 2, columnHeader: 'SingleSelect', option: 'bar', multiSelect: false }); diff --git a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts index c59ddf0e49..c8ed51fa42 100644 --- a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts @@ -33,13 +33,7 @@ async function beforeEachInit({ page }: { page: any }) { if (isEE()) { workspacePage = new WorkspacePage(page); collaborationPage = workspacePage.collaboration; - - api = new Api({ - baseURL: `http://localhost:8080/`, - headers: { - 'xc-auth': context.token, - }, - }); + api = context.api; for (let i = 0; i < roleDb.length; i++) { try { From 4321c0f9ef311022402f61fe488f9c0260fdf4a0 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:41 +0000 Subject: [PATCH 07/11] test: leave a time gap between date & time config --- .../playwright/pages/Dashboard/Grid/Column/index.ts | 4 ++++ .../tests/db/columns/columnSingleSelect.spec.ts | 5 ----- .../tests/db/columns/columnUserSelect.spec.ts | 12 ------------ 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/tests/playwright/pages/Dashboard/Grid/Column/index.ts b/tests/playwright/pages/Dashboard/Grid/Column/index.ts index 42811b0975..8371479e9b 100644 --- a/tests/playwright/pages/Dashboard/Grid/Column/index.ts +++ b/tests/playwright/pages/Dashboard/Grid/Column/index.ts @@ -321,6 +321,10 @@ export class ColumnPageObject extends BasePage { // Date Format await this.get().locator('.nc-date-select').click(); await this.rootPage.locator('.ant-select-item').locator(`text="${dateFormat}"`).click(); + + // allow UI to update + await this.rootPage.waitForTimeout(500); + // Time Format await this.get().locator('.nc-time-select').click(); await this.rootPage.locator('.ant-select-item').locator(`text="${timeFormat}"`).click(); diff --git a/tests/playwright/tests/db/columns/columnSingleSelect.spec.ts b/tests/playwright/tests/db/columns/columnSingleSelect.spec.ts index ff9de479dc..97d098dcef 100644 --- a/tests/playwright/tests/db/columns/columnSingleSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnSingleSelect.spec.ts @@ -156,11 +156,6 @@ test.describe('Single select - filter & sort', () => { ]); await page.reload(); - // await grid.addNewRow({ index: 0, value: '1' }); - // await grid.addNewRow({ index: 1, value: '2' }); - // await grid.addNewRow({ index: 2, value: '3' }); - // await grid.addNewRow({ index: 3, value: '4' }); - await grid.cell.selectOption.select({ index: 1, columnHeader: 'SingleSelect', option: 'foo', multiSelect: false }); await grid.cell.selectOption.select({ index: 2, columnHeader: 'SingleSelect', option: 'bar', multiSelect: false }); await grid.cell.selectOption.select({ index: 3, columnHeader: 'SingleSelect', option: 'baz', multiSelect: false }); diff --git a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts index c8ed51fa42..5a02640249 100644 --- a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts @@ -74,7 +74,6 @@ test.describe('User single select', () => { await grid.column.create({ title: 'User', type: 'User' }); - // await grid.addNewRow({ index: 0, value: 'Row 0' }); const tables = await api.dbTable.list(context.base.id); tableId = tables.list.find((table: any) => table.title === 'sheet1').id; await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ @@ -108,7 +107,6 @@ test.describe('User single select', () => { }); // Add new row and verify default value is added in new cell - // await grid.addNewRow({ index: 1, value: 'Row 1' }); await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ { Id: 2, @@ -155,7 +153,6 @@ test.describe('User single select', () => { for (let i = 0; i <= 4; i++) { await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); - // await grid.addNewRow({ index: i + 1, value: `Row ${i + 1}` }); } await grid.column.duplicateColumn({ @@ -200,7 +197,6 @@ test.describe('User single select', () => { // Edit, refresh and verify for (let i = 0; i <= 4; i++) { await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); - // await grid.addNewRow({ index: i + 1, value: `Row ${i + 1}` }); } // refresh page @@ -335,7 +331,6 @@ test.describe('User single select - filter, sort & GroupBy', () => { await page.reload(); for (let i = 0; i <= 4; i++) { - // await grid.addNewRow({ index: i, value: `${i}` }); await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); } }); @@ -470,7 +465,6 @@ test.describe('User multiple select', () => { }); test('Verify the default option count, select default value and verify', async () => { - // await grid.addNewRow({ index: 0, value: 'Row 0' }); await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [{ Id: 1, Title: `Row 0` }]); await grid.rootPage.reload(); @@ -491,7 +485,6 @@ test.describe('User multiple select', () => { }); // Add new row and verify default value is added in new cell - // await grid.addNewRow({ index: 1, value: 'Row 1' }); await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [{ Id: 2, Title: `Row 1` }]); await grid.rootPage.reload(); @@ -521,8 +514,6 @@ test.describe('User multiple select', () => { let counter = 1; for (let i = 0; i <= 4; i++) { - // await grid.addNewRow({ index: i, value: `Row ${i}` }); - await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: true }); await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[counter], multiSelect: true }); @@ -576,8 +567,6 @@ test.describe('User multiple select', () => { // Edit, refresh and verify let counter = 1; for (let i = 0; i <= 4; i++) { - // await grid.addNewRow({ index: i, value: `Row ${i}` }); - await grid.cell.userOption.select({ index: i, columnHeader: 'User', @@ -723,7 +712,6 @@ test.describe('User multiple select - filter, sort & GroupBy', () => { let counter = 2; for (let i = 0; i <= 4; i++) { - // await grid.addNewRow({ index: i, value: `${i}` }); await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: true }); if (i !== 0) { await grid.cell.userOption.select({ From 2efb1dbcae5f95573d0433329d5375ce70ed07a9 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:41 +0000 Subject: [PATCH 08/11] fix: date time edit modal handling --- tests/playwright/pages/Dashboard/Grid/Column/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/playwright/pages/Dashboard/Grid/Column/index.ts b/tests/playwright/pages/Dashboard/Grid/Column/index.ts index 8371479e9b..da7fe10b91 100644 --- a/tests/playwright/pages/Dashboard/Grid/Column/index.ts +++ b/tests/playwright/pages/Dashboard/Grid/Column/index.ts @@ -328,11 +328,19 @@ export class ColumnPageObject extends BasePage { // Time Format await this.get().locator('.nc-time-select').click(); await this.rootPage.locator('.ant-select-item').locator(`text="${timeFormat}"`).click(); + + // allow UI to update + await this.rootPage.waitForTimeout(500); + break; case 'Date': await this.get().locator('.nc-date-select').click(); - await this.rootPage.locator('.nc-date-select').pressSequentially(dateFormat); + await this.rootPage.locator('.nc-date-select').pressSequentially(dateFormat, { delay: 100 }); await this.rootPage.locator('.ant-select-item').locator(`text="${dateFormat}"`).click(); + + // allow UI to update + await this.rootPage.waitForTimeout(500); + break; default: break; From b0d84c63ba828aba5b4816ae93ee455e802e9ce8 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 06:45:41 +0000 Subject: [PATCH 09/11] test: misc flakes --- tests/playwright/pages/Dashboard/BulkUpdate/index.ts | 2 +- tests/playwright/pages/Dashboard/ExpandedForm/index.ts | 3 +++ tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/playwright/pages/Dashboard/BulkUpdate/index.ts b/tests/playwright/pages/Dashboard/BulkUpdate/index.ts index f48865a894..4eb7b3e48e 100644 --- a/tests/playwright/pages/Dashboard/BulkUpdate/index.ts +++ b/tests/playwright/pages/Dashboard/BulkUpdate/index.ts @@ -183,7 +183,7 @@ export class BulkUpdatePage extends BasePage { uiAction: saveRowAction, requestUrlPathToMatch: 'api/v1/db/data/noco/', httpMethodsToMatch: ['GET'], - responseJsonMatcher: json => json['pageInfo'], + // responseJsonMatcher: json => json['pageInfo'], }); } diff --git a/tests/playwright/pages/Dashboard/ExpandedForm/index.ts b/tests/playwright/pages/Dashboard/ExpandedForm/index.ts index dad5affa5c..5b3758b5fa 100644 --- a/tests/playwright/pages/Dashboard/ExpandedForm/index.ts +++ b/tests/playwright/pages/Dashboard/ExpandedForm/index.ts @@ -127,8 +127,11 @@ export class ExpandedFormPage extends BasePage { await this.verifyToast({ message: `updated successfully.` }); await this.rootPage.locator('[data-testid="grid-load-spinner"]').waitFor({ state: 'hidden' }); + // removing focus from toast + await this.rootPage.waitForTimeout(1000); await this.rootPage.locator('.nc-modal').click(); + await this.rootPage.waitForTimeout(1000); await this.get().locator('.nc-expanded-form-header').locator('.nc-expand-form-close-btn').click(); await this.get().waitFor({ state: 'hidden' }); } diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index 8670da0a08..6bd3274a3e 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -131,7 +131,7 @@ export class ToolbarFilterPage extends BasePage { skipWaitingResponse = true; const selectedField = await getTextExcludeIconText( - this.rootPage.locator('.nc-filter-field-select .ant-select-selection-item') + this.rootPage.locator('.nc-filter-field-select .ant-select-selection-item').first() ); if (selectedField !== title) { await this.rootPage.locator('.nc-filter-field-select').last().click(); From d2b89b381a69b1dff48a45a8db52cbbe28cb69b4 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 15:50:24 +0530 Subject: [PATCH 10/11] test: fix EE case for API prep Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- tests/playwright/tests/db/columns/columnUserSelect.spec.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts index 5a02640249..3af44e91c3 100644 --- a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts +++ b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts @@ -25,15 +25,14 @@ const roleDb = [ async function beforeEachInit({ page }: { page: any }) { let workspacePage: WorkspacePage; let collaborationPage: CollaborationPage; - let api: Api; const context: any = await setup({ page, isEmptyProject: true }); const dashboard: DashboardPage = new DashboardPage(page, context.base); + const api = context.api; if (isEE()) { workspacePage = new WorkspacePage(page); collaborationPage = workspacePage.collaboration; - api = context.api; for (let i = 0; i < roleDb.length; i++) { try { From 586043d47c42da92987fe9ff734a73e3282dfacb Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 3 May 2024 16:28:22 +0530 Subject: [PATCH 11/11] test: force click user dropdown to override tooltip Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index 6bd3274a3e..a39431fa92 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -332,7 +332,7 @@ export class ToolbarFilterPage extends BasePage { .locator(`.nc-dropdown-user-select-cell`) .getByTestId('select-option-User-filter') .getByText(v[i]) - .click(); + .click({ force: true }); } } break;