diff --git a/tests/playwright/pages/Dashboard/Form/index.ts b/tests/playwright/pages/Dashboard/Form/index.ts index f775a4006f..628d550918 100644 --- a/tests/playwright/pages/Dashboard/Form/index.ts +++ b/tests/playwright/pages/Dashboard/Form/index.ts @@ -146,8 +146,24 @@ export class FormPage extends BasePage { } async configureHeader(param: { subtitle: string; title: string }) { - await this.formHeading.fill(param.title); - await this.formSubHeading.fill(param.subtitle); + await this.waitForResponse({ + uiAction: async () => { + await this.formHeading.click(); + await this.formHeading.fill(param.title); + await this.formSubHeading.click(); + }, + requestUrlPathToMatch: 'api/v1/db/meta/forms', + httpMethodsToMatch: ['PATCH'], + }); + await this.waitForResponse({ + uiAction: async () => { + await this.formSubHeading.click(); + await this.formSubHeading.fill(param.subtitle); + await this.formHeading.click(); + }, + requestUrlPathToMatch: 'api/v1/db/meta/forms', + httpMethodsToMatch: ['PATCH'], + }); } async verifyHeader(param: { subtitle: string; title: string }) { @@ -177,14 +193,21 @@ export class FormPage extends BasePage { label: string; helpText: string; }) { + const waitForResponse = async (action: () => Promise) => + await this.waitForResponse({ + uiAction: action, + requestUrlPathToMatch: 'api/v1/db/meta/form-columns', + httpMethodsToMatch: ['PATCH'], + }); + await this.get() .locator(`.nc-form-drag-${field.replace(' ', '')}`) .locator('div[data-testid="nc-form-input-label"]') .click(); - await this.getFormFieldsInputLabel().fill(label); - await this.getFormFieldsInputHelpText().fill(helpText); + await waitForResponse(() => this.getFormFieldsInputLabel().fill(label)); + await waitForResponse(() => this.getFormFieldsInputHelpText().fill(helpText)); if (required) { - await this.getFormFieldsRequired().click(); + await waitForResponse(() => this.getFormFieldsRequired().click()); } await this.formHeading.click(); } @@ -241,7 +264,14 @@ export class FormPage extends BasePage { } async configureSubmitMessage(param: { message: string }) { - await this.afterSubmitMsg.fill(param.message); + await this.waitForResponse({ + uiAction: async () => { + await this.afterSubmitMsg.click(); + await this.afterSubmitMsg.fill(param.message); + }, + requestUrlPathToMatch: 'api/v1/db/meta/forms', + httpMethodsToMatch: ['PATCH'], + }); } submitAnotherForm() { diff --git a/tests/playwright/pages/Dashboard/Grid/Group.ts b/tests/playwright/pages/Dashboard/Grid/Group.ts index b595f53c17..3135657ce5 100644 --- a/tests/playwright/pages/Dashboard/Grid/Group.ts +++ b/tests/playwright/pages/Dashboard/Grid/Group.ts @@ -100,15 +100,16 @@ export class GroupPageObject extends BasePage { const addNewRowBtn = this.get({ indexMap }).locator('.nc-grid-add-new-row'); await addNewRowBtn.scrollIntoViewIfNeeded(); await (await addNewRowBtn.elementHandle()).waitForElementState('stable'); - await this.rootPage.waitForTimeout(100); - const rowCount = await this.get({ indexMap }).locator('.nc-grid-row').count(); + await this.rootPage.waitForTimeout(200); + await this.rootPage.waitForLoadState('networkidle'); + await this.rootPage.waitForTimeout(200); + await this.rootPage.waitForLoadState('domcontentloaded'); await this.get({ indexMap }).locator('.nc-grid-add-new-row').click(); - // add delay for UI to render (can wait for count to stabilize by reading it multiple times) - await this.rootPage.waitForTimeout(100); - expect(await this.get({ indexMap }).locator('.nc-grid-row').count()).toBe(rowCount + 1); + const rowCount = index + 1; + await expect(this.get({ indexMap }).locator('.nc-grid-row')).toHaveCount(rowCount); await this._fillRow({ indexMap, index, columnHeader, value: rowValue }); diff --git a/tests/playwright/pages/Dashboard/Grid/index.ts b/tests/playwright/pages/Dashboard/Grid/index.ts index dc92c0a358..919cf28d0a 100644 --- a/tests/playwright/pages/Dashboard/Grid/index.ts +++ b/tests/playwright/pages/Dashboard/Grid/index.ts @@ -115,15 +115,16 @@ export class GridPage extends BasePage { if (index !== 0) await this.get().locator('.nc-grid-row').nth(0).waitFor({ state: 'attached' }); await (await this.get().locator('.nc-grid-add-new-cell').elementHandle())?.waitForElementState('stable'); - await this.rootPage.waitForTimeout(100); - const rowCount = await this.get().locator('.nc-grid-row').count(); + await this.rootPage.waitForTimeout(200); + await this.rootPage.waitForLoadState('networkidle'); + await this.rootPage.waitForTimeout(200); + await this.rootPage.waitForLoadState('domcontentloaded'); await this.get().locator('.nc-grid-add-new-cell').click(); - // add delay for UI to render (can wait for count to stabilize by reading it multiple times) - await this.rootPage.waitForTimeout(100); - await expect(this.get().locator('.nc-grid-row')).toHaveCount(rowCount + 1); + const rowCount = index + 1; + await expect(this.get().locator('.nc-grid-row')).toHaveCount(rowCount); await this._fillRow({ index, columnHeader, value: rowValue }); diff --git a/tests/playwright/tests/db/features/metaLTAR.spec.ts b/tests/playwright/tests/db/features/metaLTAR.spec.ts index d997a2f277..c4d74f0869 100644 --- a/tests/playwright/tests/db/features/metaLTAR.spec.ts +++ b/tests/playwright/tests/db/features/metaLTAR.spec.ts @@ -56,7 +56,10 @@ test.describe.serial('Test table', () => { grid = dashboard.grid; // create a new xcdb project + await dashboard.rootPage.waitForTimeout(650); const xcdb = await createXcdb(context); + await dashboard.rootPage.waitForTimeout(650); + await dashboard.rootPage.reload(); await dashboard.treeView.openProject({ title: 'xcdb', context });