Browse Source

feat(testing): Improved stabilty

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
56cd193626
  1. 4
      scripts/playwright/pages/Dashboard/TreeView.ts
  2. 5
      scripts/playwright/pages/Dashboard/ViewSidebar/index.ts
  3. 11
      scripts/playwright/pages/Dashboard/common/Toolbar/Filter.ts
  4. 12
      scripts/playwright/pages/ProjectsPage/index.ts

4
scripts/playwright/pages/Dashboard/TreeView.ts

@ -101,8 +101,8 @@ export class TreeViewPage extends BasePage {
); );
} }
} else { } else {
await expect( await expect.poll(
await this.get().locator(`.nc-project-tree-tbl-${title}`).count() async () => await this.get().locator(`.nc-project-tree-tbl-${title}`).count()
).toBe(0); ).toBe(0);
} }
} }

5
scripts/playwright/pages/Dashboard/ViewSidebar/index.ts

@ -165,6 +165,11 @@ export class ViewSidebarPage extends BasePage {
.locator(".ant-modal-content") .locator(".ant-modal-content")
.locator('button:has-text("Submit"):visible') .locator('button:has-text("Submit"):visible')
.click(); .click();
await this.waitForResponse({
httpMethodsToMatch: ["POST"],
requestUrlPathToMatch: "/api/v1/db/meta/tables/",
uiAction: submitAction,
});
await this.toastWait({ message: "View created successfully" }); await this.toastWait({ message: "View created successfully" });
} }

11
scripts/playwright/pages/Dashboard/common/Toolbar/Filter.ts

@ -105,12 +105,11 @@ export class ToolbarFilterPage extends BasePage {
async resetFilter() { async resetFilter() {
await this.toolbar.clickFilter(); await this.toolbar.clickFilter();
await this.get().locator(".nc-filter-item-remove-btn").click(); await this.waitForResponse({
// await this.waitForResponse({ uiAction: this.get().locator(".nc-filter-item-remove-btn").click(),
// uiAction: this.get().locator(".nc-filter-item-remove-btn").click(), httpMethodsToMatch: ["DELETE"],
// httpMethodsToMatch: ["DELETE"], requestUrlPathToMatch: "/api/v1/db/meta/filters/",
// requestUrlPathToMatch: "/api/v1/db/meta/filters/", });
// });
await this.toolbar.clickFilter(); await this.toolbar.clickFilter();
} }
} }

12
scripts/playwright/pages/ProjectsPage/index.ts

@ -74,6 +74,10 @@ export class ProjectsPage extends BasePage {
// Wait till the ant table is rendered // Wait till the ant table is rendered
await this.get().locator('thead.ant-table-thead >> th').nth(0).waitFor({state: 'visible'}); 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'); 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( async openProject(
@ -91,6 +95,10 @@ export class ProjectsPage extends BasePage {
let project: any; let project: any;
const openProjectUiAction = this.get().locator(`.ant-table-cell`,{
hasText: title
}).click();
await Promise.all([ await Promise.all([
this.rootPage.waitForResponse(async (res) => { this.rootPage.waitForResponse(async (res) => {
let json:any = {} let json:any = {}
@ -110,9 +118,7 @@ export class ProjectsPage extends BasePage {
return isRequiredResponse; return isRequiredResponse;
}), }),
this.get().locator(`.ant-table-cell`,{ openProjectUiAction
hasText: title
}).click()
]); ]);
const dashboard = new DashboardPage(this.rootPage, project); const dashboard = new DashboardPage(this.rootPage, project);

Loading…
Cancel
Save