From a1eceefcb36aedddd6a15f1737d934d449b75ed8 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 11 Oct 2023 06:25:52 +0000 Subject: [PATCH] refactor: test corrections --- packages/nocodb/tests/unit/factory/row.ts | 10 +++++----- .../pages/Dashboard/Import/ImportTemplate.ts | 2 +- tests/playwright/pages/Dashboard/TreeView.ts | 2 +- tests/playwright/pages/Dashboard/common/Cell/index.ts | 4 ++-- .../pages/Dashboard/common/Toolbar/Fields.ts | 2 +- tests/playwright/tests/db/features/undo-redo.spec.ts | 4 ++-- tests/playwright/tests/db/general/groupCRUD.spec.ts | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/nocodb/tests/unit/factory/row.ts b/packages/nocodb/tests/unit/factory/row.ts index e0c8b048c1..286c0bed9f 100644 --- a/packages/nocodb/tests/unit/factory/row.ts +++ b/packages/nocodb/tests/unit/factory/row.ts @@ -200,7 +200,7 @@ const rowMixedValue = (column: ColumnType, index: number) => { const getRow = async (context, { base, table, id }) => { const response = await request(context.app) - .get(`/api/v1/data/noco/${base.id}/${table.id}/${id}`) + .get(`/api/v1/db/data/noco/${base.id}/${table.id}/${id}`) .set('xc-auth', context.token); if (response.status !== 200) { @@ -240,7 +240,7 @@ const getOneRow = async ( { base, table }: { base: Base; table: Model }, ) => { const response = await request(context.app) - .get(`/api/v1/data/noco/${base.id}/${table.id}/find-one`) + .get(`/api/v1/db/data/noco/${base.id}/${table.id}/find-one`) .set('xc-auth', context.token); return response.body; @@ -281,7 +281,7 @@ const createRow = async ( const rowData = generateDefaultRowAttributes({ columns, index }); const response = await request(context.app) - .post(`/api/v1/data/noco/${base.id}/${table.id}`) + .post(`/api/v1/db/data/noco/${base.id}/${table.id}`) .set('xc-auth', context.token) .send(rowData); @@ -301,7 +301,7 @@ const createBulkRows = async ( }, ) => { await request(context.app) - .post(`/api/v1/data/bulk/noco/${base.id}/${table.id}`) + .post(`/api/v1/db/data/bulk/noco/${base.id}/${table.id}`) .set('xc-auth', context.token) .send(values) .expect(200); @@ -340,7 +340,7 @@ const createChildRow = async ( await request(context.app) .post( - `/api/v1/data/noco/${base.id}/${table.id}/${rowId}/${type}/${column.title}/${childRowId}`, + `/api/v1/db/data/noco/${base.id}/${table.id}/${rowId}/${type}/${column.title}/${childRowId}`, ) .set('xc-auth', context.token); diff --git a/tests/playwright/pages/Dashboard/Import/ImportTemplate.ts b/tests/playwright/pages/Dashboard/Import/ImportTemplate.ts index 731c991c5e..ff2f201d3b 100644 --- a/tests/playwright/pages/Dashboard/Import/ImportTemplate.ts +++ b/tests/playwright/pages/Dashboard/Import/ImportTemplate.ts @@ -61,7 +61,7 @@ export class ImportTemplatePage extends BasePage { await this.get().locator('button:has-text("Back"):visible').waitFor(); await this.waitForResponse({ - requestUrlPathToMatch: '/api/v1/data/bulk/', + requestUrlPathToMatch: '/api/v1/db/auth/bulk/', httpMethodsToMatch: ['POST'], uiAction: () => this.get().locator('button:has-text("Import"):visible').click(), }); diff --git a/tests/playwright/pages/Dashboard/TreeView.ts b/tests/playwright/pages/Dashboard/TreeView.ts index b975052863..d1e16f8084 100644 --- a/tests/playwright/pages/Dashboard/TreeView.ts +++ b/tests/playwright/pages/Dashboard/TreeView.ts @@ -109,7 +109,7 @@ export class TreeViewPage extends BasePage { }, }), httpMethodsToMatch: ['GET'], - requestUrlPathToMatch: `/api/v1/data/noco/`, + requestUrlPathToMatch: `/api/v1/db/auth/noco/`, responseJsonMatcher: json => json.pageInfo, }); await this.dashboard.waitForTabRender({ title, mode }); diff --git a/tests/playwright/pages/Dashboard/common/Cell/index.ts b/tests/playwright/pages/Dashboard/common/Cell/index.ts index 6c06bd2572..799a481093 100644 --- a/tests/playwright/pages/Dashboard/common/Cell/index.ts +++ b/tests/playwright/pages/Dashboard/common/Cell/index.ts @@ -90,7 +90,7 @@ export class CellPageObject extends BasePage { // await this.get({ index, columnHeader }).hover(); await this.waitForResponse({ uiAction: () => this.get({ index, columnHeader }).locator('.nc-datatype-link').click(), - requestUrlPathToMatch: '/api/v1/data/noco/', + requestUrlPathToMatch: '/api/v1/db/auth/noco/', httpMethodsToMatch: ['GET'], }); } @@ -371,7 +371,7 @@ export class CellPageObject extends BasePage { await this.waitForResponse({ uiAction: () => this.rootPage.locator(`[data-testid="nc-child-list-item"]`).last().click({ force: true, timeout: 3000 }), - requestUrlPathToMatch: '/api/v1/data/noco/', + requestUrlPathToMatch: '/api/v1/db/auth/noco/', httpMethodsToMatch: ['GET'], }); diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts index 8b0a018447..edf4a07531 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts @@ -80,7 +80,7 @@ export class ToolbarFieldsPage extends BasePage { // await this.toolbar.clickFields(); // await this.waitForResponse({ // uiAction: () => this.get().locator(`button.nc-switch`).first().click(), - // requestUrlPathToMatch: isLocallySaved ? '/api/v1/public/' : '/api/v1/data/noco/', + // requestUrlPathToMatch: isLocallySaved ? '/api/v1/db/public/' : '/api/v1/db/data/noco/', // httpMethodsToMatch: ['GET'], // }); // await this.toolbar.clickFields(); diff --git a/tests/playwright/tests/db/features/undo-redo.spec.ts b/tests/playwright/tests/db/features/undo-redo.spec.ts index 40acb40f45..7296699b2a 100644 --- a/tests/playwright/tests/db/features/undo-redo.spec.ts +++ b/tests/playwright/tests/db/features/undo-redo.spec.ts @@ -32,7 +32,7 @@ async function undo({ page, dashboard }: { page: Page; dashboard: DashboardPage await dashboard.grid.waitForResponse({ uiAction: async () => await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'), httpMethodsToMatch: ['GET'], - requestUrlPathToMatch: `/api/v1/data/noco/`, + requestUrlPathToMatch: `/api/v1/db/auth/noco/`, responseJsonMatcher: json => json.pageInfo, }); } else { @@ -593,7 +593,7 @@ test.describe('Undo Redo - LTAR', () => { await dashboard.grid.waitForResponse({ uiAction: async () => await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'), httpMethodsToMatch: ['GET'], - requestUrlPathToMatch: `/api/v1/data/noco/`, + requestUrlPathToMatch: `/api/v1/db/auth/noco/`, responseJsonMatcher: json => json.pageInfo, }); await verifyRecords(values); diff --git a/tests/playwright/tests/db/general/groupCRUD.spec.ts b/tests/playwright/tests/db/general/groupCRUD.spec.ts index 03f3e6331a..94fd43d26d 100644 --- a/tests/playwright/tests/db/general/groupCRUD.spec.ts +++ b/tests/playwright/tests/db/general/groupCRUD.spec.ts @@ -15,7 +15,7 @@ async function undo({ page, dashboard }: { page: Page; dashboard: DashboardPage await dashboard.grid.waitForResponse({ uiAction: () => page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'), httpMethodsToMatch: ['GET'], - requestUrlPathToMatch: `/api/v1/data/noco/`, + requestUrlPathToMatch: `/api/v1/db/auth/noco/`, responseJsonMatcher: json => json.pageInfo, }); } else {