Browse Source

test: make wait for network rsp optional

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/6546/head
Raju Udava 1 year ago
parent
commit
5ec0870b19
  1. 19
      tests/playwright/pages/Dashboard/TreeView.ts
  2. 2
      tests/playwright/tests/db/columns/columnLinkToAnotherRecord.spec.ts

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

@ -124,11 +124,13 @@ export class TreeViewPage extends BasePage {
skipOpeningModal,
mode,
baseTitle,
wait = true,
}: {
title: string;
skipOpeningModal?: boolean;
mode?: string;
baseTitle: string;
wait?: boolean;
}) {
if (!skipOpeningModal) {
await this.get().getByTestId(`nc-sidebar-base-title-${baseTitle}`).hover();
@ -140,12 +142,17 @@ export class TreeViewPage extends BasePage {
await this.dashboard.get().getByPlaceholder('Enter table name').fill(title);
await this.waitForResponse({
uiAction: () => this.dashboard.get().locator('button:has-text("Create Table")').click(),
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: `/api/v1/meta/bases/`,
responseJsonMatcher: json => json.title === title && json.type === 'table',
});
if (wait) {
await this.waitForResponse({
uiAction: () => this.dashboard.get().locator('button:has-text("Create Table")').click(),
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: `/api/v1/meta/bases/`,
responseJsonMatcher: json => json.title === title && json.type === 'table',
});
} else {
await this.dashboard.get().locator('button:has-text("Create Table")').click();
await this.rootPage.waitForTimeout(1000);
}
// Tab render is slow for playwright
await this.dashboard.waitForTabRender({ title, mode });

2
tests/playwright/tests/db/columns/columnLinkToAnotherRecord.spec.ts

@ -22,7 +22,7 @@ test.describe('LTAR create & update', () => {
await dashboard.treeView.createTable({ title: 'Sheet1', baseTitle: context.base.title });
// subsequent table creation fails; hence delay
await dashboard.rootPage.waitForTimeout(1000);
await dashboard.treeView.createTable({ title: 'Sheet2', baseTitle: context.base.title });
await dashboard.treeView.createTable({ title: 'Sheet2', baseTitle: context.base.title, wait: false });
await dashboard.treeView.openTable({ title: 'Sheet1' });
await dashboard.grid.addNewRow({ index: 0, value: '1a' });

Loading…
Cancel
Save