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 }) { async deleteTable({ title }: { title: string }) {
const tabCount = await this.dashboard.tabBar.locator('.ant-tabs-tab').count()
await this.get() await this.get()
.locator(`.nc-project-tree-tbl-${title}`) .locator(`.nc-project-tree-tbl-${title}`)
.click({ button: "right" }); .click({ button: "right" });
@ -93,7 +92,12 @@ export class TreeViewPage extends BasePage {
httpMethodsToMatch: ["DELETE"], httpMethodsToMatch: ["DELETE"],
requestUrlPathToMatch: `/api/v1/db/meta/tables/`, 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'); (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 project: any;
let sakilaTables, sakilaSqlViews; let sakilaTables, sakilaSqlViews;
// todo: Break the test into smaller tests
test.setTimeout(150000);
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
context = await setup({ page }); context = await setup({ page });
dashboard = new DashboardPage(page, context.project); 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 dashboard: DashboardPage;
let context: any; let context: any;
// todo: Break the test into smaller tests
test.setTimeout(150000);
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
context = await setup({ page }); context = await setup({ page });
dashboard = new DashboardPage(page, context.project); dashboard = new DashboardPage(page, context.project);
}); });
test.only("LTAR", async () => { test("LTAR", async () => {
// close 'Team & Auth' tab // close 'Team & Auth' tab
await dashboard.closeTab({ title: "Team & Auth" }); 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({ await dashboard.grid.toolbar.sort.addSort({
columnTitle: "Col1", columnTitle: "Col1",
isAscending: false, isAscending: false,
isLocallySaved: true
}); });
await dashboard.grid.toolbar.filter.addNew({ await dashboard.grid.toolbar.filter.addNew({
columnTitle: "Col1", columnTitle: "Col1",
opType: ">=", opType: ">=",
value: "5", value: "5",
isLocallySaved: true
}); });
await dashboard.grid.verifyRowCount({ count: 5 }); await dashboard.grid.verifyRowCount({ count: 5 });

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

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

Loading…
Cancel
Save