Browse Source

refactor: test corrections

pull/6644/head
Pranav C 1 year ago
parent
commit
a1eceefcb3
  1. 10
      packages/nocodb/tests/unit/factory/row.ts
  2. 2
      tests/playwright/pages/Dashboard/Import/ImportTemplate.ts
  3. 2
      tests/playwright/pages/Dashboard/TreeView.ts
  4. 4
      tests/playwright/pages/Dashboard/common/Cell/index.ts
  5. 2
      tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts
  6. 4
      tests/playwright/tests/db/features/undo-redo.spec.ts
  7. 2
      tests/playwright/tests/db/general/groupCRUD.spec.ts

10
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);

2
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(),
});

2
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 });

4
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'],
});

2
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();

4
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);

2
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 {

Loading…
Cancel
Save