Browse Source

feat(testing): Improved flakyness

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
49eb1f9049
  1. 8
      scripts/playwright/pages/Dashboard/TreeView.ts
  2. 3
      scripts/playwright/tests/erd.spec.ts
  3. 5
      scripts/playwright/tests/linkToAnotherRecord.spec.ts
  4. 2
      scripts/playwright/tests/metaSync.spec.ts
  5. 9
      scripts/playwright/tests/toolbarOperations.spec.ts

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

@ -79,7 +79,6 @@ export class TreeViewPage extends BasePage {
}
async deleteTable({ title }: { title: string }) {
const tabCount = await this.dashboard.tabBar.locator('.ant-tabs-tab').count()
await this.get()
.locator(`.nc-project-tree-tbl-${title}`)
.click({ button: "right" });
@ -93,7 +92,12 @@ export class TreeViewPage extends BasePage {
httpMethodsToMatch: ["DELETE"],
requestUrlPathToMatch: `/api/v1/db/meta/tables/`,
});
await expect.poll(async () => await this.dashboard.tabBar.locator('.ant-tabs-tab').count()).toBe(tabCount - 1);
await expect.poll(async () =>
await this.dashboard.tabBar.locator('.ant-tabs-tab', {
hasText: title
}).isVisible()
).toBe(false);
(await this.rootPage.locator('.nc-container').last().elementHandle())?.waitForElementState('stable');
}

3
scripts/playwright/tests/erd.spec.ts

@ -13,6 +13,9 @@ test.describe("Erd", () => {
let project: any;
let sakilaTables, sakilaSqlViews;
// todo: Break the test into smaller tests
test.setTimeout(150000);
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);

5
scripts/playwright/tests/linkToAnotherRecord.spec.ts

@ -6,12 +6,15 @@ test.describe("LTAR create & update", () => {
let dashboard: DashboardPage;
let context: any;
// todo: Break the test into smaller tests
test.setTimeout(150000);
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
});
test.only("LTAR", async () => {
test("LTAR", async () => {
// close 'Team & Auth' tab
await dashboard.closeTab({ title: "Team & Auth" });

2
scripts/playwright/tests/metaSync.spec.ts

@ -237,12 +237,14 @@ test.describe("Meta sync", () => {
await dashboard.grid.toolbar.sort.addSort({
columnTitle: "Col1",
isAscending: false,
isLocallySaved: true
});
await dashboard.grid.toolbar.filter.addNew({
columnTitle: "Col1",
opType: ">=",
value: "5",
isLocallySaved: true
});
await dashboard.grid.verifyRowCount({ count: 5 });

9
scripts/playwright/tests/toolbarOperations.spec.ts

@ -34,7 +34,6 @@ test.describe("Toolbar operations (GRID)", () => {
});
// hide column
console.log("hide column");
await toolbar.fields.toggle({ title: "LastUpdate" });
await dashboard.grid.column.verify({
title: "LastUpdate",
@ -42,7 +41,6 @@ test.describe("Toolbar operations (GRID)", () => {
});
// un-hide column
console.log("un-hide column");
await toolbar.fields.toggle({ title: "LastUpdate" });
await dashboard.grid.column.verify({
title: "LastUpdate",
@ -51,26 +49,23 @@ test.describe("Toolbar operations (GRID)", () => {
await validateFirstRow("Afghanistan");
// Sort column
console.log("sort column");
await toolbar.sort.addSort({ columnTitle: "Country", isAscending: false });
await toolbar.sort.addSort({ columnTitle: "Country", isAscending: false, isLocallySaved: true });
await validateFirstRow("Zambia");
// reset sort
console.log("reset sort");
await toolbar.sort.resetSort();
await validateFirstRow("Afghanistan");
// Filter column
console.log("filter column");
await toolbar.filter.addNew({
columnTitle: "Country",
value: "India",
opType: "is equal",
isLocallySaved: true
});
await validateFirstRow("India");
// Reset filter
console.log("reset filter");
await toolbar.filter.resetFilter();
await validateFirstRow("Afghanistan");

Loading…
Cancel
Save