Browse Source

refactor: meta path corrections in tests

pull/6644/head
Pranav C 1 year ago
parent
commit
75c9b7e3eb
  1. 6
      packages/nocodb/tests/unit/factory/base.ts
  2. 4
      packages/nocodb/tests/unit/factory/column.ts
  3. 2
      packages/nocodb/tests/unit/factory/table.ts
  4. 10
      packages/nocodb/tests/unit/factory/view.ts
  5. 2
      tests/playwright/pages/Account/AppStore.ts
  6. 8
      tests/playwright/pages/Dashboard/Form/index.ts
  7. 2
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  8. 2
      tests/playwright/pages/Dashboard/Settings/Miscellaneous.ts
  9. 2
      tests/playwright/pages/Dashboard/ShareProjectButton/index.ts
  10. 4
      tests/playwright/pages/Dashboard/Sidebar/index.ts
  11. 6
      tests/playwright/pages/Dashboard/TreeView.ts
  12. 2
      tests/playwright/pages/Dashboard/ViewSidebar/index.ts
  13. 4
      tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts
  14. 12
      tests/playwright/pages/ProjectsPage/index.ts
  15. 6
      tests/playwright/pages/WorkspacePage/ContainerPage.ts
  16. 2
      tests/playwright/tests/db/features/swagger.spec.ts

6
packages/nocodb/tests/unit/factory/base.ts

@ -59,7 +59,7 @@ const defaultSharedBaseValue = {
const createSharedBase = async (app, token, base, sharedBaseArgs = {}) => {
await request(app)
.post(`/api/v1/meta/bases/${base.id}/shared`)
.post(`//api/v1/db/meta/bases/${base.id}/shared`)
.set('xc-auth', token)
.send({
...defaultSharedBaseValue,
@ -69,7 +69,7 @@ const createSharedBase = async (app, token, base, sharedBaseArgs = {}) => {
const createSakilaProject = async (context) => {
const response = await request(context.app)
.post('/api/v1/meta/bases/')
.post('//api/v1/db/meta/bases/')
.set('xc-auth', context.token)
.send(sakilaProjectConfig(context));
@ -81,7 +81,7 @@ const createProject = async (
baseArgs: ProjectArgs = defaultProjectValue,
) => {
const response = await request(context.app)
.post('/api/v1/meta/bases/')
.post('//api/v1/db/meta/bases/')
.set('xc-auth', context.token)
.send({
...baseArgs,

4
packages/nocodb/tests/unit/factory/column.ts

@ -164,7 +164,7 @@ const customColumns = function (type: string, options: any = {}) {
const createColumn = async (context, table, columnAttr) => {
await request(context.app)
.post(`/api/v1/meta/tables/${table.id}/columns`)
.post(`//api/v1/db/meta/tables/${table.id}/columns`)
.set('xc-auth', context.token)
.send({
...columnAttr,
@ -373,7 +373,7 @@ const updateViewColumn = async (
{ view, column, attr }: { column: Column; view: View; attr: any },
) => {
const res = await request(context.app)
.patch(`/api/v1/meta/views/${view.id}/columns/${column.id}`)
.patch(`//api/v1/db/meta/views/${view.id}/columns/${column.id}`)
.set('xc-auth', context.token)
.send({
...attr,

2
packages/nocodb/tests/unit/factory/table.ts

@ -12,7 +12,7 @@ const defaultTableValue = (context) => ({
const createTable = async (context, base, args = {}) => {
const defaultValue = defaultTableValue(context);
const response = await request(context.app)
.post(`/api/v1/meta/bases/${base.id}/tables`)
.post(`//api/v1/db/meta/bases/${base.id}/tables`)
.set('xc-auth', context.token)
.send({ ...defaultValue, ...args });

10
packages/nocodb/tests/unit/factory/view.ts

@ -31,7 +31,7 @@ const createView = async (
};
const response = await request(context.app)
.post(`/api/v1/meta/tables/${table.id}/${viewTypeStr(type)}`)
.post(`//api/v1/db/meta/tables/${table.id}/${viewTypeStr(type)}`)
.set('xc-auth', context.token)
.send({
title,
@ -53,7 +53,7 @@ const getView = async (
{ table, name }: { table: Model; name: string },
) => {
const response = await request(context.app)
.get(`/api/v1/meta/tables/${table.id}/views`)
.get(`//api/v1/db/meta/tables/${table.id}/views`)
.set('xc-auth', context.token);
if (response.status !== 200) {
throw new Error('List Views', response.body.message);
@ -85,7 +85,7 @@ const updateView = async (
if (filter.length) {
for (let i = 0; i < filter.length; i++) {
await request(context.app)
.post(`/api/v1/meta/views/${view.id}/filters`)
.post(`//api/v1/db/meta/views/${view.id}/filters`)
.set('xc-auth', context.token)
.send(filter[i])
.expect(200);
@ -95,7 +95,7 @@ const updateView = async (
if (sort.length) {
for (let i = 0; i < sort.length; i++) {
await request(context.app)
.post(`/api/v1/meta/views/${view.id}/sorts`)
.post(`//api/v1/db/meta/views/${view.id}/sorts`)
.set('xc-auth', context.token)
.send(sort[i])
.expect(200);
@ -113,7 +113,7 @@ const updateView = async (
).id;
// configure view to hide selected fields
await request(context.app)
.patch(`/api/v1/meta/views/${view.id}/columns/${viewColumnId}`)
.patch(`//api/v1/db/meta/views/${view.id}/columns/${viewColumnId}`)
.set('xc-auth', context.token)
.send({ show: false })
.expect(200);

2
tests/playwright/pages/Account/AppStore.ts

@ -13,7 +13,7 @@ export class AccountAppStorePage extends BasePage {
await this.waitForResponse({
uiAction: () => this.rootPage.goto('/#/account/apps', { waitUntil: 'networkidle' }),
httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: 'api/v1/meta/plugins',
requestUrlPathToMatch: '/api/v1/db/meta/plugins',
});
}

8
tests/playwright/pages/Dashboard/Form/index.ts

@ -164,7 +164,7 @@ export class FormPage extends BasePage {
await this.formHeading.fill(param.title);
await this.formSubHeading.click();
},
requestUrlPathToMatch: 'api/v1/meta/forms',
requestUrlPathToMatch: '/api/v1/db/meta/forms',
httpMethodsToMatch: ['PATCH'],
});
await this.waitForResponse({
@ -173,7 +173,7 @@ export class FormPage extends BasePage {
await this.formSubHeading.fill(param.subtitle);
await this.formHeading.click();
},
requestUrlPathToMatch: 'api/v1/meta/forms',
requestUrlPathToMatch: '/api/v1/db/meta/forms',
httpMethodsToMatch: ['PATCH'],
});
}
@ -208,7 +208,7 @@ export class FormPage extends BasePage {
const waitForResponse = async (action: () => Promise<any>) =>
await this.waitForResponse({
uiAction: action,
requestUrlPathToMatch: 'api/v1/meta/form-columns',
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
@ -272,7 +272,7 @@ export class FormPage extends BasePage {
await this.afterSubmitMsg.click();
await this.afterSubmitMsg.fill(param.message);
},
requestUrlPathToMatch: 'api/v1/meta/forms',
requestUrlPathToMatch: '/api/v1/db/meta/forms',
httpMethodsToMatch: ['PATCH'],
});
}

2
tests/playwright/pages/Dashboard/Grid/Column/index.ts

@ -337,7 +337,7 @@ export class ColumnPageObject extends BasePage {
await this.waitForResponse({
uiAction: async () => await this.rootPage.locator('li[role="menuitem"]:has-text("Hide Field"):visible').click(),
requestUrlPathToMatch: 'api/v1/meta/views',
requestUrlPathToMatch: '/api/v1/db/meta/views',
httpMethodsToMatch: ['PATCH'],
});

2
tests/playwright/pages/Dashboard/Settings/Miscellaneous.ts

@ -25,7 +25,7 @@ export class MiscSettingsPage extends BasePage {
async clickShowNullEmptyFilters() {
await this.waitForResponse({
uiAction: () => this.get().locator('input[type="checkbox"]').last().click(),
requestUrlPathToMatch: 'api/v1/meta/bases',
requestUrlPathToMatch: '/api/v1/db/meta/bases',
httpMethodsToMatch: ['PATCH'],
});
}

2
tests/playwright/pages/Dashboard/ShareProjectButton/index.ts

@ -108,7 +108,7 @@ export class ShareProjectButtonPage extends BasePage {
await this.waitForResponse({
uiAction: () => this.rootPage.getByTestId('docs-base-share-public-toggle').click(),
httpMethodsToMatch: ['PATCH'],
requestUrlPathToMatch: `/api/v1/meta/bases`,
requestUrlPathToMatch: `//api/v1/db/meta/bases`,
});
}

4
tests/playwright/pages/Dashboard/Sidebar/index.ts

@ -74,7 +74,7 @@ export class SidebarPage extends BasePage {
await this.waitForResponse({
uiAction: () => this.dashboard.get().getByTestId('docs-create-proj-dlg-create-btn').click(),
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: `api/v1/meta/bases/`,
requestUrlPathToMatch: `/api/v1/db/meta/bases/`,
});
if (type === ProjectTypes.DOCUMENTATION) {
@ -121,7 +121,7 @@ export class SidebarPage extends BasePage {
this.rootPage.locator('.ant-modal-content').locator('button.ant-btn.ant-btn-primary').click();
await this.waitForResponse({
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: '/api/v1/meta/tables/',
requestUrlPathToMatch: '//api/v1/db/meta/tables/',
uiAction: submitAction,
responseJsonMatcher: json => json.title === title,
});

6
tests/playwright/pages/Dashboard/TreeView.ts

@ -143,7 +143,7 @@ export class TreeViewPage extends BasePage {
await this.waitForResponse({
uiAction: () => this.dashboard.get().locator('button:has-text("Create Table")').click(),
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: `/api/v1/meta/bases/`,
requestUrlPathToMatch: `//api/v1/db/meta/bases/`,
responseJsonMatcher: json => json.title === title && json.type === 'table',
});
@ -179,7 +179,7 @@ export class TreeViewPage extends BasePage {
return await this.dashboard.get().locator('button:has-text("Delete Table")').click();
},
httpMethodsToMatch: ['DELETE'],
requestUrlPathToMatch: `/api/v1/meta/tables/`,
requestUrlPathToMatch: `//api/v1/db/meta/tables/`,
});
await (await this.rootPage.locator('.nc-container').last().elementHandle())?.waitForElementState('stable');
@ -253,7 +253,7 @@ export class TreeViewPage extends BasePage {
await this.waitForResponse({
uiAction: async () => await this.rootPage.getByRole('button', { name: 'Confirm' }).click(),
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: `/api/v1/meta/duplicate/`,
requestUrlPathToMatch: `//api/v1/db/meta/duplicate/`,
});
await this.get().locator(`[data-testid="nc-tbl-title-${title} copy"]`).waitFor();
}

2
tests/playwright/pages/Dashboard/ViewSidebar/index.ts

@ -163,7 +163,7 @@ export class ViewSidebarPage extends BasePage {
this.rootPage.locator('.ant-modal-content').locator('button:has-text("Create a View"):visible').click();
await this.waitForResponse({
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: '/api/v1/meta/tables/',
requestUrlPathToMatch: '//api/v1/db/meta/tables/',
uiAction: submitAction,
});
// await this.verifyToast({ message: 'View created successfully' });

4
tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts

@ -351,7 +351,7 @@ export class ToolbarFilterPage extends BasePage {
await this.waitForResponse({
uiAction: async () => await this.get().locator('.nc-filter-item-remove-btn').click(),
httpMethodsToMatch: ['DELETE'],
requestUrlPathToMatch: '/api/v1/meta/filters/',
requestUrlPathToMatch: '//api/v1/db/meta/filters/',
});
} else {
await this.get().locator('.nc-filter-item-remove-btn').click();
@ -367,7 +367,7 @@ export class ToolbarFilterPage extends BasePage {
await this.waitForResponse({
uiAction: async () => await this.get().locator('.nc-filter-item-remove-btn').click(),
httpMethodsToMatch: ['DELETE'],
requestUrlPathToMatch: '/api/v1/meta/filters/',
requestUrlPathToMatch: '//api/v1/db/meta/filters/',
});
} else {
await this.get().locator('.nc-filter-item-remove-btn').click();

12
tests/playwright/pages/ProjectsPage/index.ts

@ -41,7 +41,7 @@ export class ProjectsPage extends BasePage {
await this.waitForResponse({
uiAction: createProjectSubmitAction,
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: '/api/v1/meta/bases/',
requestUrlPathToMatch: '//api/v1/db/meta/bases/',
});
// wait for dashboard to render
@ -89,7 +89,7 @@ export class ProjectsPage extends BasePage {
await this.waitForResponse({
uiAction: dupeProjectSubmitAction,
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: 'api/v1/meta/duplicate/',
requestUrlPathToMatch: '/api/v1/db/meta/duplicate/',
});
// wait for duplicate create completed and render kebab
await this.get().locator(`[data-testid="p-three-dot-${name} copy"]`).waitFor();
@ -103,7 +103,7 @@ export class ProjectsPage extends BasePage {
const reloadUiAction = () => this.get().locator('[data-testid="bases-reload-button"]').click();
await this.waitForResponse({
uiAction: reloadUiAction,
requestUrlPathToMatch: '/api/v1/meta/bases',
requestUrlPathToMatch: '//api/v1/db/meta/bases',
httpMethodsToMatch: ['GET'],
});
}
@ -145,7 +145,7 @@ export class ProjectsPage extends BasePage {
}
const isRequiredResponse =
res.request().url().includes('/api/v1/meta/bases') &&
res.request().url().includes('//api/v1/db/meta/bases') &&
['GET'].includes(res.request().method()) &&
json?.title === title;
@ -180,7 +180,7 @@ export class ProjectsPage extends BasePage {
await this.waitForResponse({
uiAction: deleteProjectAction,
httpMethodsToMatch: ['DELETE'],
requestUrlPathToMatch: '/api/v1/meta/bases/',
requestUrlPathToMatch: '//api/v1/db/meta/bases/',
});
await this.get().locator('.ant-table-row', { hasText: title }).waitFor({ state: 'hidden' });
@ -212,7 +212,7 @@ export class ProjectsPage extends BasePage {
const submitAction = () => base.locator('input.nc-metadb-base-name').press('Enter');
await this.waitForResponse({
uiAction: submitAction,
requestUrlPathToMatch: 'api/v1/meta/bases/',
requestUrlPathToMatch: '/api/v1/db/meta/bases/',
httpMethodsToMatch: ['PATCH'],
});
}

6
tests/playwright/pages/WorkspacePage/ContainerPage.ts

@ -140,7 +140,7 @@ export class ContainerPage extends BasePage {
await this.waitForResponse({
uiAction: () => this.rootPage.locator('.nc-metadb-base-name').press('Enter'),
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: `api/v1/meta/bases`,
requestUrlPathToMatch: `/api/v1/db/meta/bases`,
});
}
@ -154,7 +154,7 @@ export class ContainerPage extends BasePage {
await this.waitForResponse({
uiAction: () => row.locator('td.ant-table-cell').nth(0).locator('input').press('Enter'),
httpMethodsToMatch: ['PATCH'],
requestUrlPathToMatch: `api/v1/meta/bases/`,
requestUrlPathToMatch: `/api/v1/db/meta/bases/`,
});
}
@ -185,7 +185,7 @@ export class ContainerPage extends BasePage {
await this.waitForResponse({
uiAction: () => this.rootPage.locator('.ant-modal-content').locator('button:has-text("Delete")').click(),
httpMethodsToMatch: ['DELETE'],
requestUrlPathToMatch: `api/v1/meta/bases/`,
requestUrlPathToMatch: `/api/v1/db/meta/bases/`,
});
}

2
tests/playwright/tests/db/features/swagger.spec.ts

@ -17,7 +17,7 @@ test.describe('Swagger', () => {
test('Create column', async () => {
// access swagger link
const link = `http://localhost:8080/api/v1/meta/bases/${context.base.id}/swagger`;
const link = `http://localhost:8080//api/v1/db/meta/bases/${context.base.id}/swagger`;
await dashboard.rootPage.goto(link);
const swagger = dashboard.rootPage;

Loading…
Cancel
Save