Browse Source

refactor: test corrections

pull/6644/head
Pranav C 12 months 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 getRow = async (context, { base, table, id }) => {
const response = await request(context.app) 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); .set('xc-auth', context.token);
if (response.status !== 200) { if (response.status !== 200) {
@ -240,7 +240,7 @@ const getOneRow = async (
{ base, table }: { base: Base; table: Model }, { base, table }: { base: Base; table: Model },
) => { ) => {
const response = await request(context.app) 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); .set('xc-auth', context.token);
return response.body; return response.body;
@ -281,7 +281,7 @@ const createRow = async (
const rowData = generateDefaultRowAttributes({ columns, index }); const rowData = generateDefaultRowAttributes({ columns, index });
const response = await request(context.app) 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) .set('xc-auth', context.token)
.send(rowData); .send(rowData);
@ -301,7 +301,7 @@ const createBulkRows = async (
}, },
) => { ) => {
await request(context.app) 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) .set('xc-auth', context.token)
.send(values) .send(values)
.expect(200); .expect(200);
@ -340,7 +340,7 @@ const createChildRow = async (
await request(context.app) await request(context.app)
.post( .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); .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.get().locator('button:has-text("Back"):visible').waitFor();
await this.waitForResponse({ await this.waitForResponse({
requestUrlPathToMatch: '/api/v1/data/bulk/', requestUrlPathToMatch: '/api/v1/db/auth/bulk/',
httpMethodsToMatch: ['POST'], httpMethodsToMatch: ['POST'],
uiAction: () => this.get().locator('button:has-text("Import"):visible').click(), 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'], httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: `/api/v1/data/noco/`, requestUrlPathToMatch: `/api/v1/db/auth/noco/`,
responseJsonMatcher: json => json.pageInfo, responseJsonMatcher: json => json.pageInfo,
}); });
await this.dashboard.waitForTabRender({ title, mode }); 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.get({ index, columnHeader }).hover();
await this.waitForResponse({ await this.waitForResponse({
uiAction: () => this.get({ index, columnHeader }).locator('.nc-datatype-link').click(), uiAction: () => this.get({ index, columnHeader }).locator('.nc-datatype-link').click(),
requestUrlPathToMatch: '/api/v1/data/noco/', requestUrlPathToMatch: '/api/v1/db/auth/noco/',
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
}); });
} }
@ -371,7 +371,7 @@ export class CellPageObject extends BasePage {
await this.waitForResponse({ await this.waitForResponse({
uiAction: () => uiAction: () =>
this.rootPage.locator(`[data-testid="nc-child-list-item"]`).last().click({ force: true, timeout: 3000 }), 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'], 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.toolbar.clickFields();
// await this.waitForResponse({ // await this.waitForResponse({
// uiAction: () => this.get().locator(`button.nc-switch`).first().click(), // 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'], // httpMethodsToMatch: ['GET'],
// }); // });
// await this.toolbar.clickFields(); // 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({ await dashboard.grid.waitForResponse({
uiAction: async () => await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'), uiAction: async () => await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'),
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: `/api/v1/data/noco/`, requestUrlPathToMatch: `/api/v1/db/auth/noco/`,
responseJsonMatcher: json => json.pageInfo, responseJsonMatcher: json => json.pageInfo,
}); });
} else { } else {
@ -593,7 +593,7 @@ test.describe('Undo Redo - LTAR', () => {
await dashboard.grid.waitForResponse({ await dashboard.grid.waitForResponse({
uiAction: async () => await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'), uiAction: async () => await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'),
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: `/api/v1/data/noco/`, requestUrlPathToMatch: `/api/v1/db/auth/noco/`,
responseJsonMatcher: json => json.pageInfo, responseJsonMatcher: json => json.pageInfo,
}); });
await verifyRecords(values); 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({ await dashboard.grid.waitForResponse({
uiAction: () => page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'), uiAction: () => page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'),
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: `/api/v1/data/noco/`, requestUrlPathToMatch: `/api/v1/db/auth/noco/`,
responseJsonMatcher: json => json.pageInfo, responseJsonMatcher: json => json.pageInfo,
}); });
} else { } else {

Loading…
Cancel
Save