diff --git a/scripts/playwright/pages/Dashboard/TreeView.ts b/scripts/playwright/pages/Dashboard/TreeView.ts index 94f5190309..f476e78966 100644 --- a/scripts/playwright/pages/Dashboard/TreeView.ts +++ b/scripts/playwright/pages/Dashboard/TreeView.ts @@ -101,8 +101,8 @@ export class TreeViewPage extends BasePage { ); } } else { - await expect( - await this.get().locator(`.nc-project-tree-tbl-${title}`).count() + await expect.poll( + async () => await this.get().locator(`.nc-project-tree-tbl-${title}`).count() ).toBe(0); } } diff --git a/scripts/playwright/pages/Dashboard/ViewSidebar/index.ts b/scripts/playwright/pages/Dashboard/ViewSidebar/index.ts index c07a74ebe8..0abde125c8 100644 --- a/scripts/playwright/pages/Dashboard/ViewSidebar/index.ts +++ b/scripts/playwright/pages/Dashboard/ViewSidebar/index.ts @@ -165,6 +165,11 @@ export class ViewSidebarPage extends BasePage { .locator(".ant-modal-content") .locator('button:has-text("Submit"):visible') .click(); + await this.waitForResponse({ + httpMethodsToMatch: ["POST"], + requestUrlPathToMatch: "/api/v1/db/meta/tables/", + uiAction: submitAction, + }); await this.toastWait({ message: "View created successfully" }); } diff --git a/scripts/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/scripts/playwright/pages/Dashboard/common/Toolbar/Filter.ts index c6dbc4ce40..24695c0b37 100644 --- a/scripts/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/scripts/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -105,12 +105,11 @@ export class ToolbarFilterPage extends BasePage { async resetFilter() { await this.toolbar.clickFilter(); - await this.get().locator(".nc-filter-item-remove-btn").click(); - // await this.waitForResponse({ - // uiAction: this.get().locator(".nc-filter-item-remove-btn").click(), - // httpMethodsToMatch: ["DELETE"], - // requestUrlPathToMatch: "/api/v1/db/meta/filters/", - // }); + await this.waitForResponse({ + uiAction: this.get().locator(".nc-filter-item-remove-btn").click(), + httpMethodsToMatch: ["DELETE"], + requestUrlPathToMatch: "/api/v1/db/meta/filters/", + }); await this.toolbar.clickFilter(); } } diff --git a/scripts/playwright/pages/ProjectsPage/index.ts b/scripts/playwright/pages/ProjectsPage/index.ts index d12a73c360..ed05f2357f 100644 --- a/scripts/playwright/pages/ProjectsPage/index.ts +++ b/scripts/playwright/pages/ProjectsPage/index.ts @@ -74,6 +74,10 @@ export class ProjectsPage extends BasePage { // Wait till the ant table is rendered await this.get().locator('thead.ant-table-thead >> th').nth(0).waitFor({state: 'visible'}); await expect(this.get().locator('thead.ant-table-thead >> th').nth(0)).toHaveText('Title'); + + // todo: remove this, all the above asserts are useless. + // The elements are actually invisible from screenshot but in dom level its visible. Lazy loading issue + await this.rootPage.waitForTimeout(1200); } async openProject( @@ -91,6 +95,10 @@ export class ProjectsPage extends BasePage { let project: any; + const openProjectUiAction = this.get().locator(`.ant-table-cell`,{ + hasText: title + }).click(); + await Promise.all([ this.rootPage.waitForResponse(async (res) => { let json:any = {} @@ -110,9 +118,7 @@ export class ProjectsPage extends BasePage { return isRequiredResponse; }), - this.get().locator(`.ant-table-cell`,{ - hasText: title - }).click() + openProjectUiAction ]); const dashboard = new DashboardPage(this.rootPage, project);