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 {
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);
}
}

5
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" });
}

11
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();
}
}

12
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);

Loading…
Cancel
Save