Browse Source

fix: playwright AddNewRow waiting issue

pull/7348/head
Ramesh Mane 9 months ago
parent
commit
76fe191ff8
  1. 8
      tests/playwright/pages/Dashboard/Grid/Group.ts
  2. 11
      tests/playwright/pages/Dashboard/Grid/index.ts

8
tests/playwright/pages/Dashboard/Grid/Group.ts

@ -110,6 +110,14 @@ export class GroupPageObject extends BasePage {
await this.get({ indexMap }).locator('.nc-grid-add-new-row').click(); await this.get({ indexMap }).locator('.nc-grid-add-new-row').click();
const rowCount = index + 1; const rowCount = index + 1;
const isRowSaving = this.get({ indexMap }).getByTestId(`row-save-spinner-${rowCount}`);
// if required field is present then isRowSaving will be hidden (not present in DOM)
await isRowSaving?.waitFor({ state: 'hidden' });
// fallback
await this.rootPage.waitForTimeout(400);
await expect(this.get({ indexMap }).locator('.nc-grid-row')).toHaveCount(rowCount); await expect(this.get({ indexMap }).locator('.nc-grid-row')).toHaveCount(rowCount);
await this._fillRow({ indexMap, index, columnHeader, value: rowValue }); await this._fillRow({ indexMap, index, columnHeader, value: rowValue });

11
tests/playwright/pages/Dashboard/Grid/index.ts

@ -123,10 +123,15 @@ export class GridPage extends BasePage {
await this.get().locator('.nc-grid-add-new-cell').click(); await this.get().locator('.nc-grid-add-new-cell').click();
// wait for insert row response
await this.rootPage.waitForTimeout(1000);
const rowCount = index + 1; const rowCount = index + 1;
const isRowSaving = this.rootPage.getByTestId(`row-save-spinner-${rowCount}`);
// if required field is present then isRowSaving will be hidden (not present in DOM)
await isRowSaving?.waitFor({ state: 'hidden' });
// fallback
await this.rootPage.waitForTimeout(400);
await expect(this.get().locator('.nc-grid-row')).toHaveCount(rowCount); await expect(this.get().locator('.nc-grid-row')).toHaveCount(rowCount);
await this._fillRow({ index, columnHeader, value: rowValue }); await this._fillRow({ index, columnHeader, value: rowValue });

Loading…
Cancel
Save