diff --git a/tests/playwright/tests/db/01-webhook.spec.ts b/tests/playwright/tests/db/01-webhook.spec.ts index 7996142655..cf0dce6e4d 100644 --- a/tests/playwright/tests/db/01-webhook.spec.ts +++ b/tests/playwright/tests/db/01-webhook.spec.ts @@ -427,8 +427,8 @@ test.describe.serial('Webhook', () => { async function verifyBulkOperationTrigger(rsp, type) { for (let i = 0; i < rsp.length; i++) { expect(rsp[i].type).toBe(type); - expect(rsp[i].data.table_name).toBe('numberBased'); - expect(rsp[i].data.view_name).toBe('numberBased'); + expect(rsp[i].data.table_name).toBe('Test'); + expect(rsp[i].data.view_name).toBe('Test'); // only for insert, rows inserted will not be returned in response. just count if (type === 'records.after.bulkInsert') { @@ -476,8 +476,8 @@ test.describe.serial('Webhook', () => { try { project = await api.project.read(context.project.id); table = await api.base.tableCreate(context.project.id, project.bases?.[0].id, { - table_name: 'numberBased', - title: 'numberBased', + table_name: 'Test', + title: 'Test', columns: columns, }); } catch (e) { @@ -485,7 +485,7 @@ test.describe.serial('Webhook', () => { } await page.reload(); - await dashboard.treeView.openTable({ title: 'numberBased' }); + await dashboard.treeView.openTable({ title: 'Test' }); // create after insert webhook await webhook.create({ @@ -508,7 +508,6 @@ test.describe.serial('Webhook', () => { })); await api.dbTableRow.bulkCreate('noco', context.project.id, table.id, rowAttributesForInsert); await page.reload(); - // 50 records inserted, we expect 2 webhook responses let rsp = await getWebhookResponses({ request, count: 1 }); await verifyBulkOperationTrigger(rsp, 'records.after.bulkInsert'); diff --git a/tests/playwright/tests/db/accountLicense.spec.ts b/tests/playwright/tests/db/accountLicense.spec.ts index 9d9e6038e2..ec3ab37502 100644 --- a/tests/playwright/tests/db/accountLicense.spec.ts +++ b/tests/playwright/tests/db/accountLicense.spec.ts @@ -11,7 +11,7 @@ test.describe('Enterprise License', () => { let accountLicensePage: AccountLicensePage, accountPage: AccountPage, context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); accountPage = new AccountPage(page); accountLicensePage = new AccountLicensePage(accountPage); dashboard = new DashboardPage(page, context.project); diff --git a/tests/playwright/tests/db/accountTokenManagement.spec.ts b/tests/playwright/tests/db/accountTokenManagement.spec.ts index 8fbe1c305c..10de551fd9 100644 --- a/tests/playwright/tests/db/accountTokenManagement.spec.ts +++ b/tests/playwright/tests/db/accountTokenManagement.spec.ts @@ -10,7 +10,7 @@ test.describe('User roles', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); accountPage = new AccountPage(page); accountTokenPage = new AccountTokenPage(accountPage); }); diff --git a/tests/playwright/tests/db/accountUserManagement.spec.ts b/tests/playwright/tests/db/accountUserManagement.spec.ts index abc2b70671..45b4a3c3da 100644 --- a/tests/playwright/tests/db/accountUserManagement.spec.ts +++ b/tests/playwright/tests/db/accountUserManagement.spec.ts @@ -4,6 +4,7 @@ import { AccountUsersPage } from '../../pages/Account/Users'; import { ProjectsPage } from '../../pages/ProjectsPage'; import { SignupPage } from '../../pages/SignupPage'; import setup from '../../setup'; +import { getDefaultPwd } from '../utils/general'; const roleDb = [ { email: 'creator@nocodb.com', role: 'Organization Level Creator', url: '' }, @@ -19,7 +20,7 @@ test.describe('User roles', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); accountPage = new AccountPage(page); accountUsersPage = new AccountUsersPage(accountPage); @@ -68,7 +69,7 @@ test.describe('User roles', () => { await signupPage.signUp({ email: roleDb[roleIdx].email, - password: 'Password123.', + password: getDefaultPwd(), }); await projectsPage.checkProjectCreateButton({ diff --git a/tests/playwright/tests/db/accountUserSettings.spec.ts b/tests/playwright/tests/db/accountUserSettings.spec.ts index bfff8f510d..8386445d47 100644 --- a/tests/playwright/tests/db/accountUserSettings.spec.ts +++ b/tests/playwright/tests/db/accountUserSettings.spec.ts @@ -3,6 +3,7 @@ import { AccountPage } from '../../pages/Account'; import { AccountSettingsPage } from '../../pages/Account/Settings'; import { SignupPage } from '../../pages/SignupPage'; import setup from '../../setup'; +import { getDefaultPwd } from '../utils/general'; test.describe('App settings', () => { let accountSettingsPage: AccountSettingsPage; @@ -11,7 +12,7 @@ test.describe('App settings', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); accountPage = new AccountPage(page); accountSettingsPage = accountPage.settings; }); @@ -39,7 +40,7 @@ test.describe('App settings', () => { await signupPage.signUp({ email: 'test-user-1@nocodb.com', - password: 'Password123.', + password: getDefaultPwd(), expectedError: 'Not allowed to signup, contact super admin.', }); @@ -59,7 +60,7 @@ test.describe('App settings', () => { await signupPage.signUp({ email: 'test-user-1@nocodb.com', - password: 'Password123.', + password: getDefaultPwd(), }); }); }); diff --git a/tests/playwright/tests/db/authChangePassword.spec.ts b/tests/playwright/tests/db/authChangePassword.spec.ts index 08408c2ef2..82ec5be74f 100644 --- a/tests/playwright/tests/db/authChangePassword.spec.ts +++ b/tests/playwright/tests/db/authChangePassword.spec.ts @@ -6,6 +6,7 @@ import { SettingsPage, SettingTab } from '../../pages/Dashboard/Settings'; import { SignupPage } from '../../pages/SignupPage'; import { ProjectsPage } from '../../pages/ProjectsPage'; import { AccountPage } from '../../pages/Account'; +import { getDefaultPwd } from '../utils/general'; test.describe('Auth', () => { let context: any; @@ -16,7 +17,7 @@ test.describe('Auth', () => { let accountPage: AccountPage; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); signupPage = new SignupPage(page); projectsPage = new ProjectsPage(page); @@ -41,7 +42,7 @@ test.describe('Auth', () => { await dashboard.rootPage.goto(url); await signupPage.signUp({ email: 'user-1@nocodb.com', - password: 'Password123.', + password: getDefaultPwd(), }); await projectsPage.openPasswordChangeModal(); @@ -56,7 +57,7 @@ test.describe('Auth', () => { // New pass and repeat pass mismatch await accountPage.users.changePasswordPage.changePassword({ - oldPass: 'Password123.', + oldPass: getDefaultPwd(), newPass: '123456789', repeatPass: '987654321', networkValidation: false, @@ -65,7 +66,7 @@ test.describe('Auth', () => { // All good await accountPage.users.changePasswordPage.changePassword({ - oldPass: 'Password123.', + oldPass: getDefaultPwd(), newPass: 'NewPasswordConfigured', repeatPass: 'NewPasswordConfigured', networkValidation: true, diff --git a/tests/playwright/tests/db/baseShare.spec.ts b/tests/playwright/tests/db/baseShare.spec.ts index e60707f4c8..e9d83a5be1 100644 --- a/tests/playwright/tests/db/baseShare.spec.ts +++ b/tests/playwright/tests/db/baseShare.spec.ts @@ -4,6 +4,7 @@ import setup from '../../setup'; import { ToolbarPage } from '../../pages/Dashboard/common/Toolbar'; import { LoginPage } from '../../pages/LoginPage'; import { ProjectsPage } from '../../pages/ProjectsPage'; +import { getDefaultPwd } from '../utils/general'; test.describe('Shared base', () => { let dashboard: DashboardPage; @@ -47,7 +48,7 @@ test.describe('Shared base', () => { } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); projectPage = new ProjectsPage(page); toolbar = dashboard.grid.toolbar; @@ -77,7 +78,7 @@ test.describe('Shared base', () => { await loginPage.signIn({ email: 'user@nocodb.com', - password: 'Password123.', + password: getDefaultPwd(), withoutPrefix: true, }); diff --git a/tests/playwright/tests/db/cellSelection.spec.ts b/tests/playwright/tests/db/cellSelection.spec.ts index 5603796794..5b59c533aa 100644 --- a/tests/playwright/tests/db/cellSelection.spec.ts +++ b/tests/playwright/tests/db/cellSelection.spec.ts @@ -8,102 +8,91 @@ test.describe('Verify cell selection', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; + await dashboard.closeAllTabs(); }); - test('#1 when range is selected, it has correct number of selected cells', async () => { + test('Suite-1', async () => { + // #1 when range is selected, it has correct number of selected cells await dashboard.treeView.openTable({ title: 'Customer' }); await grid.selectRange({ start: { index: 0, columnHeader: 'FirstName' }, end: { index: 2, columnHeader: 'Email' }, }); - expect(await grid.selectedCount()).toBe(9); - }); + await dashboard.closeAllTabs(); - test('#2 when copied with clipboard, it copies correct text', async () => { + // #2 when copied with clipboard, it copies correct text await dashboard.treeView.openTable({ title: 'Customer' }); await grid.selectRange({ start: { index: 0, columnHeader: 'FirstName' }, end: { index: 1, columnHeader: 'LastName' }, }); - expect(await grid.copyWithKeyboard()).toBe('MARY \t SMITH\n' + ' PATRICIA \t JOHNSON\n'); - }); + await dashboard.closeAllTabs(); - test('#3 when copied with mouse, it copies correct text', async () => { + // #3 when copied with mouse, it copies correct text await dashboard.treeView.openTable({ title: 'Customer' }); await grid.selectRange({ start: { index: 0, columnHeader: 'FirstName' }, end: { index: 1, columnHeader: 'LastName' }, }); - expect(await grid.copyWithMouse({ index: 0, columnHeader: 'FirstName' })).toBe( 'MARY \t SMITH\n' + ' PATRICIA \t JOHNSON\n' ); + await dashboard.closeAllTabs(); }); - // FIXME: this is edge case, better be moved to integration tests - test('#4 when cell inside selection range is clicked, it clears previous selection', async () => { + test('Suite-2', async ({ page }) => { + // #4 when cell inside selection range is clicked, it clears previous selection await dashboard.treeView.openTable({ title: 'Country' }); await grid.selectRange({ start: { index: 0, columnHeader: 'Country' }, end: { index: 2, columnHeader: 'City List' }, }); - expect(await grid.selectedCount()).toBe(9); - await grid.cell.get({ index: 0, columnHeader: 'Country' }).click(); - expect(await grid.selectedCount()).toBe(1); expect(await grid.cell.verifyCellActiveSelected({ index: 0, columnHeader: 'Country' })); - }); + await dashboard.closeAllTabs(); - // FIXME: this is edge case, better be moved to integration tests - test('#5 when cell outside selection range is clicked, it clears previous selection', async () => { + // #5 when cell outside selection range is clicked, it clears previous selection await dashboard.treeView.openTable({ title: 'Country' }); await grid.selectRange({ start: { index: 0, columnHeader: 'Country' }, end: { index: 2, columnHeader: 'City List' }, }); - expect(await grid.selectedCount()).toBe(9); - await grid.cell.get({ index: 5, columnHeader: 'Country' }).click(); - expect(await grid.selectedCount()).toBe(1); expect(await grid.cell.verifyCellActiveSelected({ index: 5, columnHeader: 'Country' })); - }); + await dashboard.closeAllTabs(); - // FIXME: this is edge case, better be moved to integration tests - test('#6 when selection ends on locked field, it still works as expected', async () => { + // #6 when selection ends on locked field, it still works as expected await dashboard.treeView.openTable({ title: 'Country' }); await dashboard.grid.toolbar.fields.toggleShowSystemFields(); await grid.selectRange({ start: { index: 2, columnHeader: 'City List' }, end: { index: 0, columnHeader: 'Country' }, }); - expect(await grid.selectedCount()).toBe(12); - await grid.cell.get({ index: 1, columnHeader: 'Country' }).click(); - expect(await grid.selectedCount()).toBe(1); expect(await grid.cell.verifyCellActiveSelected({ index: 1, columnHeader: 'Country' })); - }); + await dashboard.grid.toolbar.fields.toggleShowSystemFields(); + await dashboard.closeAllTabs(); - // FIXME: this is edge case, better be moved to integration tests - test('#7 when navigated with keyboard, only active cell is affected', async ({ page }) => { + // #7 when navigated with keyboard, only active cell is affected await dashboard.treeView.openTable({ title: 'Country' }); await grid.selectRange({ start: { index: 0, columnHeader: 'Country' }, end: { index: 2, columnHeader: 'City List' }, }); - await page.keyboard.press('ArrowRight'); expect(await grid.selectedCount()).toBe(1); expect(await grid.cell.verifyCellActiveSelected({ index: 0, columnHeader: 'LastUpdate' })); + await dashboard.closeAllTabs(); }); }); diff --git a/tests/playwright/tests/db/columnAttachments.spec.ts b/tests/playwright/tests/db/columnAttachments.spec.ts index 0d6a3590dc..7593457cde 100644 --- a/tests/playwright/tests/db/columnAttachments.spec.ts +++ b/tests/playwright/tests/db/columnAttachments.spec.ts @@ -10,7 +10,7 @@ test.describe('Attachment column', () => { let accountLicensePage: AccountLicensePage, accountPage: AccountPage, context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); accountPage = new AccountPage(page); accountLicensePage = new AccountLicensePage(accountPage); diff --git a/tests/playwright/tests/db/columnBarcode.spec.ts b/tests/playwright/tests/db/columnBarcode.spec.ts index 1570e0185a..783ce1eae5 100644 --- a/tests/playwright/tests/db/columnBarcode.spec.ts +++ b/tests/playwright/tests/db/columnBarcode.spec.ts @@ -14,7 +14,7 @@ test.describe('Virtual Columns', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; }); diff --git a/tests/playwright/tests/db/columnCheckbox.spec.ts b/tests/playwright/tests/db/columnCheckbox.spec.ts index 23334c80d6..b0e1d94c50 100644 --- a/tests/playwright/tests/db/columnCheckbox.spec.ts +++ b/tests/playwright/tests/db/columnCheckbox.spec.ts @@ -2,6 +2,9 @@ import { test } from '@playwright/test'; import { DashboardPage } from '../../pages/Dashboard'; import setup from '../../setup'; import { ToolbarPage } from '../../pages/Dashboard/common/Toolbar'; +import { UITypes } from 'nocodb-sdk'; +import { Api } from 'nocodb-sdk'; +let api: Api; test.describe('Checkbox - cell, filter, sort', () => { let dashboard: DashboardPage, toolbar: ToolbarPage; @@ -37,23 +40,61 @@ test.describe('Checkbox - cell, filter, sort', () => { } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; + + api = new Api({ + baseURL: `http://localhost:8080/`, + headers: { + 'xc-auth': context.token, + }, + }); + + const columns = [ + { + column_name: 'Id', + title: 'Id', + uidt: UITypes.ID, + }, + { + column_name: 'Title', + title: 'Title', + uidt: UITypes.SingleLineText, + }, + ]; + + try { + const project = await api.project.read(context.project.id); + const table = await api.base.tableCreate(context.project.id, project.bases?.[0].id, { + table_name: 'Sheet-1', + title: 'Sheet-1', + columns: columns, + }); + + const rowAttributes = []; + for (let i = 0; i < 6; i++) { + const row = { + Id: i + 1, + Title: `1${String.fromCharCode(97 + i)}`, + }; + rowAttributes.push(row); + } + + await api.dbTableRow.bulkCreate('noco', context.project.id, table.id, rowAttributes); + } catch (e) { + console.error(e); + } + + // page reload + await page.reload(); }); test('Checkbox', async () => { // close 'Team & Auth' tab await dashboard.closeTab({ title: 'Team & Auth' }); - await dashboard.treeView.createTable({ title: 'Sheet1' }); - - await dashboard.grid.addNewRow({ index: 0, value: '1a' }); - await dashboard.grid.addNewRow({ index: 1, value: '1b' }); - await dashboard.grid.addNewRow({ index: 2, value: '1c' }); - await dashboard.grid.addNewRow({ index: 3, value: '1d' }); - await dashboard.grid.addNewRow({ index: 4, value: '1e' }); - await dashboard.grid.addNewRow({ index: 5, value: '1f' }); + await dashboard.treeView.openTable({ title: 'Sheet-1' }); // Create Checkbox column await dashboard.grid.column.create({ diff --git a/tests/playwright/tests/db/columnDateTime.spec.ts b/tests/playwright/tests/db/columnDateTime.spec.ts index d63b03b1e7..7647dea6b3 100644 --- a/tests/playwright/tests/db/columnDateTime.spec.ts +++ b/tests/playwright/tests/db/columnDateTime.spec.ts @@ -61,7 +61,7 @@ test.describe('DateTime Column', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/columnDuration.spec.ts b/tests/playwright/tests/db/columnDuration.spec.ts index 885fe9b268..6998c55062 100644 --- a/tests/playwright/tests/db/columnDuration.spec.ts +++ b/tests/playwright/tests/db/columnDuration.spec.ts @@ -45,7 +45,7 @@ test.describe.skip('Duration column', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/columnFormula.spec.ts b/tests/playwright/tests/db/columnFormula.spec.ts index e97803624b..4aabefe37e 100644 --- a/tests/playwright/tests/db/columnFormula.spec.ts +++ b/tests/playwright/tests/db/columnFormula.spec.ts @@ -141,7 +141,7 @@ test.describe('Virtual Columns', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/columnGeoData.spec.ts b/tests/playwright/tests/db/columnGeoData.spec.ts index 9cc27561fb..29e35ce5e7 100644 --- a/tests/playwright/tests/db/columnGeoData.spec.ts +++ b/tests/playwright/tests/db/columnGeoData.spec.ts @@ -9,7 +9,7 @@ test.describe('Geo Data column', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; }); diff --git a/tests/playwright/tests/db/columnLinkToAnotherRecord.spec.ts b/tests/playwright/tests/db/columnLinkToAnotherRecord.spec.ts index 3253f115f8..1be725e05d 100644 --- a/tests/playwright/tests/db/columnLinkToAnotherRecord.spec.ts +++ b/tests/playwright/tests/db/columnLinkToAnotherRecord.spec.ts @@ -10,7 +10,7 @@ test.describe('LTAR create & update', () => { test.setTimeout(150000); test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/columnLookupRollup.spec.ts b/tests/playwright/tests/db/columnLookupRollup.spec.ts index e08940b6bf..236b94d5ed 100644 --- a/tests/playwright/tests/db/columnLookupRollup.spec.ts +++ b/tests/playwright/tests/db/columnLookupRollup.spec.ts @@ -7,7 +7,7 @@ test.describe('Virtual columns', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/columnMenuOperations.spec.ts b/tests/playwright/tests/db/columnMenuOperations.spec.ts index cf01f9a313..f80b3fc482 100644 --- a/tests/playwright/tests/db/columnMenuOperations.spec.ts +++ b/tests/playwright/tests/db/columnMenuOperations.spec.ts @@ -43,7 +43,7 @@ test.describe('Column menu operations', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/columnMultiSelect.spec.ts b/tests/playwright/tests/db/columnMultiSelect.spec.ts index 60e8fcabcb..029830a155 100644 --- a/tests/playwright/tests/db/columnMultiSelect.spec.ts +++ b/tests/playwright/tests/db/columnMultiSelect.spec.ts @@ -9,7 +9,7 @@ test.describe('Multi select', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; diff --git a/tests/playwright/tests/db/columnQrCode.spec.ts b/tests/playwright/tests/db/columnQrCode.spec.ts index 527effe1c1..603601c686 100644 --- a/tests/playwright/tests/db/columnQrCode.spec.ts +++ b/tests/playwright/tests/db/columnQrCode.spec.ts @@ -14,7 +14,7 @@ test.describe('Virtual Columns', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; }); diff --git a/tests/playwright/tests/db/columnRating.spec.ts b/tests/playwright/tests/db/columnRating.spec.ts index 3c50d319a8..d11916fdee 100644 --- a/tests/playwright/tests/db/columnRating.spec.ts +++ b/tests/playwright/tests/db/columnRating.spec.ts @@ -37,7 +37,7 @@ test.describe('Rating - cell, filter, sort', () => { } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; }); diff --git a/tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts b/tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts index 99a70262d3..eecae61ed4 100644 --- a/tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts +++ b/tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts @@ -8,7 +8,7 @@ test.describe('Relational Columns', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/columnSingleSelect.spec.ts b/tests/playwright/tests/db/columnSingleSelect.spec.ts index 935dcf9310..9e5302f5fc 100644 --- a/tests/playwright/tests/db/columnSingleSelect.spec.ts +++ b/tests/playwright/tests/db/columnSingleSelect.spec.ts @@ -9,7 +9,7 @@ test.describe('Single select', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; diff --git a/tests/playwright/tests/db/erd.spec.ts b/tests/playwright/tests/db/erd.spec.ts index bd332dc524..0000b64df1 100644 --- a/tests/playwright/tests/db/erd.spec.ts +++ b/tests/playwright/tests/db/erd.spec.ts @@ -21,7 +21,7 @@ test.describe('Erd', () => { test.slow(); test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); if (isPg(context)) { diff --git a/tests/playwright/tests/db/expandedFormUrl.spec.ts b/tests/playwright/tests/db/expandedFormUrl.spec.ts index fc1ed91fa8..78b7b28bf0 100644 --- a/tests/playwright/tests/db/expandedFormUrl.spec.ts +++ b/tests/playwright/tests/db/expandedFormUrl.spec.ts @@ -10,7 +10,7 @@ test.describe('Expanded form URL', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/filters.spec.ts b/tests/playwright/tests/db/filters.spec.ts index b30c2bfb9a..714201072b 100644 --- a/tests/playwright/tests/db/filters.spec.ts +++ b/tests/playwright/tests/db/filters.spec.ts @@ -89,7 +89,6 @@ async function verifyFilter(param: { return; } - await toolbar.clickFilter(); await toolbar.filter.add({ title: param.column, operation: param.opType, @@ -97,16 +96,13 @@ async function verifyFilter(param: { value: param.value, locallySaved: false, dataType: param?.dataType, + openModal: true, }); - await toolbar.clickFilter(); // verify filtered rows await validateRowArray({ rowCount: param.result.rowCount, }); - - // Reset filter - await toolbar.filter.reset(); } // Number based filters @@ -206,6 +202,8 @@ test.describe('Filter Tests: Numerical', () => { }, ]; + await toolbar.clickFilter(); + await toolbar.filter.clickAddFilter(); for (let i = 0; i < filterList.length; i++) { await verifyFilter({ column: dataType, @@ -218,7 +216,7 @@ test.describe('Filter Tests: Numerical', () => { } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; @@ -305,6 +303,8 @@ test.describe('Filter Tests: Numerical', () => { } catch (e) { console.error(e); } + + await page.reload(); }); test('Filter: Number', async () => { @@ -405,6 +405,8 @@ test.describe('Filter Tests: Text based', () => { }, ]; + await toolbar.clickFilter(); + await toolbar.filter.clickAddFilter(); for (let i = 0; i < filterList.length; i++) { await verifyFilter({ column: dataType, @@ -416,7 +418,7 @@ test.describe('Filter Tests: Text based', () => { } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; @@ -485,6 +487,7 @@ test.describe('Filter Tests: Text based', () => { } catch (e) { console.error(e); } + await page.reload(); }); test('Filter: Single Line Text', async () => { @@ -577,6 +580,8 @@ test.describe('Filter Tests: Select based', () => { }, ]; + await toolbar.clickFilter(); + await toolbar.filter.clickAddFilter(); for (let i = 0; i < filterList.length; i++) { await verifyFilter({ column: dataType, @@ -587,8 +592,9 @@ test.describe('Filter Tests: Select based', () => { }); } } + test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; @@ -641,6 +647,7 @@ test.describe('Filter Tests: Select based', () => { } catch (e) { console.error(e); } + await page.reload(); }); test('Filter: Single Select', async () => { @@ -933,7 +940,7 @@ test.describe('Filter Tests: Date based', () => { } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; @@ -978,6 +985,7 @@ test.describe('Filter Tests: Date based', () => { } catch (e) { console.error(e); } + await page.reload(); }); test('Date : filters-1', async () => { @@ -1018,6 +1026,8 @@ test.describe('Filter Tests: AddOn', () => { }, ]; + await toolbar.clickFilter(); + await toolbar.filter.clickAddFilter(); for (let i = 0; i < filterList.length; i++) { await verifyFilter({ column: dataType, @@ -1029,7 +1039,7 @@ test.describe('Filter Tests: AddOn', () => { } } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; @@ -1080,6 +1090,7 @@ test.describe('Filter Tests: AddOn', () => { } catch (e) { console.error(e); } + await page.reload(); }); test('Filter: Checkbox', async () => { @@ -1108,6 +1119,8 @@ test.describe('Filter Tests: Link to another record, Lookup, Rollup', () => { { op: 'is not blank', value: null, rowCount: 109 }, ]; + await toolbar.clickFilter(); + await toolbar.filter.clickAddFilter(); for (let i = 0; i < filterList.length; i++) { await verifyFilter({ column: 'City List', @@ -1144,6 +1157,8 @@ test.describe('Filter Tests: Link to another record, Lookup, Rollup', () => { { op: 'is not blank', value: null, rowCount: 599 }, ]; + await toolbar.clickFilter(); + await toolbar.filter.clickAddFilter(); for (let i = 0; i < filterList.length; i++) { await verifyFilter({ column: 'Lookup', @@ -1181,6 +1196,8 @@ test.describe('Filter Tests: Link to another record, Lookup, Rollup', () => { { op: 'is not blank', value: null, rowCount: 598 }, ]; + await toolbar.clickFilter(); + await toolbar.filter.clickAddFilter(); for (let i = 0; i < filterList.length; i++) { await verifyFilter({ column: 'Lookup', @@ -1193,7 +1210,7 @@ test.describe('Filter Tests: Link to another record, Lookup, Rollup', () => { } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; @@ -1237,7 +1254,7 @@ test.describe('Filter Tests: Toggle button', () => { */ test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; }); diff --git a/tests/playwright/tests/db/keyboardShortcuts.spec.ts b/tests/playwright/tests/db/keyboardShortcuts.spec.ts index 98312bf2c5..1e73cb5243 100644 --- a/tests/playwright/tests/db/keyboardShortcuts.spec.ts +++ b/tests/playwright/tests/db/keyboardShortcuts.spec.ts @@ -11,7 +11,7 @@ test.describe('Verify shortcuts', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; }); diff --git a/tests/playwright/tests/db/language.spec.ts b/tests/playwright/tests/db/language.spec.ts index 949e949bc6..d027457e8e 100644 --- a/tests/playwright/tests/db/language.spec.ts +++ b/tests/playwright/tests/db/language.spec.ts @@ -47,7 +47,7 @@ test.describe('Common', () => { let projectsPage: ProjectsPage; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); projectsPage = new ProjectsPage(page); }); diff --git a/tests/playwright/tests/db/metaSync.spec.ts b/tests/playwright/tests/db/metaSync.spec.ts index e830ac99e6..a0f3f9ee55 100644 --- a/tests/playwright/tests/db/metaSync.spec.ts +++ b/tests/playwright/tests/db/metaSync.spec.ts @@ -11,7 +11,7 @@ test.describe('Meta sync', () => { let dbExec; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); settings = dashboard.settings; diff --git a/tests/playwright/tests/db/mobileMode.spec.ts b/tests/playwright/tests/db/mobileMode.spec.ts index 3b82f02677..997c3b958a 100644 --- a/tests/playwright/tests/db/mobileMode.spec.ts +++ b/tests/playwright/tests/db/mobileMode.spec.ts @@ -11,7 +11,7 @@ test.describe('Mobile Mode', () => { let form: FormPage; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); form = dashboard.form; toolbar = dashboard.grid.toolbar; diff --git a/tests/playwright/tests/db/pagination.spec.ts b/tests/playwright/tests/db/pagination.spec.ts index 7939e320b2..45b7040c88 100644 --- a/tests/playwright/tests/db/pagination.spec.ts +++ b/tests/playwright/tests/db/pagination.spec.ts @@ -7,7 +7,7 @@ test.describe('Grid pagination', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/rolesCreate.spec.ts b/tests/playwright/tests/db/rolesCreate.spec.ts index 740503758f..9b6c244e1e 100644 --- a/tests/playwright/tests/db/rolesCreate.spec.ts +++ b/tests/playwright/tests/db/rolesCreate.spec.ts @@ -4,6 +4,7 @@ import setup from '../../setup'; import { SettingsPage, SettingTab } from '../../pages/Dashboard/Settings'; import { SignupPage } from '../../pages/SignupPage'; import { ProjectsPage } from '../../pages/ProjectsPage'; +import { getDefaultPwd } from '../utils/general'; const roleDb = [ { email: 'creator@nocodb.com', role: 'creator', url: '' }, @@ -20,7 +21,7 @@ test.describe('User roles', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); settings = dashboard.settings; signupPage = new SignupPage(page); @@ -110,7 +111,7 @@ test.describe('User roles', () => { await dashboard.rootPage.goto(roleDb[roleIdx].url); await signupPage.signUp({ email: roleDb[roleIdx].email, - password: 'Password123.', + password: getDefaultPwd(), }); await projectsPage.openProject({ diff --git a/tests/playwright/tests/db/rolesPreview.spec.ts b/tests/playwright/tests/db/rolesPreview.spec.ts index acee19aa6e..16a9349767 100644 --- a/tests/playwright/tests/db/rolesPreview.spec.ts +++ b/tests/playwright/tests/db/rolesPreview.spec.ts @@ -16,7 +16,7 @@ test.describe('Preview Mode', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; settings = dashboard.settings; diff --git a/tests/playwright/tests/db/rolesSuperUser.spec.ts b/tests/playwright/tests/db/rolesSuperUser.spec.ts index ec2c8c7e10..f5fd01aeab 100644 --- a/tests/playwright/tests/db/rolesSuperUser.spec.ts +++ b/tests/playwright/tests/db/rolesSuperUser.spec.ts @@ -7,7 +7,7 @@ test.describe('Super user', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/tableColumnOperation.spec.ts b/tests/playwright/tests/db/tableColumnOperation.spec.ts index 4b58919550..39fdc99de5 100644 --- a/tests/playwright/tests/db/tableColumnOperation.spec.ts +++ b/tests/playwright/tests/db/tableColumnOperation.spec.ts @@ -8,7 +8,7 @@ test.describe('Table Column Operations', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: true }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; diff --git a/tests/playwright/tests/db/tableOperations.spec.ts b/tests/playwright/tests/db/tableOperations.spec.ts index a38ec0cd8b..2751ffc5cb 100644 --- a/tests/playwright/tests/db/tableOperations.spec.ts +++ b/tests/playwright/tests/db/tableOperations.spec.ts @@ -8,7 +8,7 @@ test.describe('Table Operations', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); settings = dashboard.settings; }); diff --git a/tests/playwright/tests/db/toolbarOperations.spec.ts b/tests/playwright/tests/db/toolbarOperations.spec.ts index 75d3a11ed7..8ad08d58e1 100644 --- a/tests/playwright/tests/db/toolbarOperations.spec.ts +++ b/tests/playwright/tests/db/toolbarOperations.spec.ts @@ -16,7 +16,7 @@ test.describe('Toolbar operations (GRID)', () => { } test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; }); diff --git a/tests/playwright/tests/db/viewForm.spec.ts b/tests/playwright/tests/db/viewForm.spec.ts index 3c2e7d56e2..6aca59fcfb 100644 --- a/tests/playwright/tests/db/viewForm.spec.ts +++ b/tests/playwright/tests/db/viewForm.spec.ts @@ -15,7 +15,7 @@ test.describe('Form view', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); form = dashboard.form; accountPage = new AccountPage(page); diff --git a/tests/playwright/tests/db/viewFormShareSurvey.spec.ts b/tests/playwright/tests/db/viewFormShareSurvey.spec.ts index 6d0b74ee4b..b05528155d 100644 --- a/tests/playwright/tests/db/viewFormShareSurvey.spec.ts +++ b/tests/playwright/tests/db/viewFormShareSurvey.spec.ts @@ -9,7 +9,7 @@ test.describe('Share form', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/viewGridShare.spec.ts b/tests/playwright/tests/db/viewGridShare.spec.ts index 63fe94da44..6464426587 100644 --- a/tests/playwright/tests/db/viewGridShare.spec.ts +++ b/tests/playwright/tests/db/viewGridShare.spec.ts @@ -10,7 +10,7 @@ test.describe('Shared view', () => { let sharedLink: string; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/viewKanban.spec.ts b/tests/playwright/tests/db/viewKanban.spec.ts index 433d3f79ee..6231f9636e 100644 --- a/tests/playwright/tests/db/viewKanban.spec.ts +++ b/tests/playwright/tests/db/viewKanban.spec.ts @@ -12,7 +12,7 @@ test.describe('View', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); toolbar = toolbar = dashboard.kanban.toolbar; diff --git a/tests/playwright/tests/db/viewMap.spec.ts b/tests/playwright/tests/db/viewMap.spec.ts index 6315237852..d2ca547f17 100644 --- a/tests/playwright/tests/db/viewMap.spec.ts +++ b/tests/playwright/tests/db/viewMap.spec.ts @@ -15,7 +15,7 @@ test.describe('Map View', () => { const longitudeInShortDecimalLength = '30.5234'; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.map.toolbar; diff --git a/tests/playwright/tests/db/viewMenu.spec.ts b/tests/playwright/tests/db/viewMenu.spec.ts index 0cadbc718c..5a9f93471e 100644 --- a/tests/playwright/tests/db/viewMenu.spec.ts +++ b/tests/playwright/tests/db/viewMenu.spec.ts @@ -8,7 +8,7 @@ test.describe('Grid view locked', () => { let context: any; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); }); diff --git a/tests/playwright/tests/db/views.spec.ts b/tests/playwright/tests/db/views.spec.ts index 0390ba3200..2ee1add7b9 100644 --- a/tests/playwright/tests/db/views.spec.ts +++ b/tests/playwright/tests/db/views.spec.ts @@ -9,7 +9,7 @@ test.describe('Views CRUD Operations', () => { let toolbar: ToolbarPage; test.beforeEach(async ({ page }) => { - context = await setup({ page }); + context = await setup({ page, isEmptyProject: false }); dashboard = new DashboardPage(page, context.project); toolbar = dashboard.grid.toolbar; }); diff --git a/tests/playwright/tests/utils/general.ts b/tests/playwright/tests/utils/general.ts index 2bb3bdf035..56a9e1a2b3 100644 --- a/tests/playwright/tests/utils/general.ts +++ b/tests/playwright/tests/utils/general.ts @@ -19,6 +19,14 @@ async function getTextExcludeIconText(selector) { return text.trim(); } +async function getIconText(selector) { + // List of icons + const icons = await selector.locator('.material-symbols-outlined'); + + await icons.nth(0).waitFor(); + return await icons.nth(0).textContent(); +} + function isSubset(obj, potentialSubset) { for (const prop in potentialSubset) { // eslint-disable-next-line no-prototype-builtins @@ -38,4 +46,8 @@ function isSubset(obj, potentialSubset) { return true; } -export { getTextExcludeIconText, isSubset }; +function getDefaultPwd() { + return 'Password123.'; +} + +export { getTextExcludeIconText, isSubset, getIconText, getDefaultPwd };