Browse Source

feat(testing): Fixed gallery expandedFormUrl

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
a044482c26
  1. 12
      scripts/playwright/pages/Dashboard/Gallery/index.ts
  2. 20
      scripts/playwright/tests/expandedFormUrl.spec.ts

12
scripts/playwright/pages/Dashboard/Gallery/index.ts

@ -33,18 +33,6 @@ export class GalleryPage extends BasePage {
return;
}
// kludge: move toolbar outside grid scope
async fields({ title }: { title: string }) {
await this.rootPage.locator(`.nc-fields-menu-btn`).click();
await this.rootPage.waitForTimeout(1000);
await this.rootPage
.locator(`[pw-data="nc-fields-menu-${title}"]`)
.locator('input[type="checkbox"]')
.click();
await this.rootPage.waitForTimeout(1000);
await this.rootPage.locator(`.nc-fields-menu-btn`).click();
}
// todo: Wait for render to complete
async waitLoading() {
await this.rootPage.waitForTimeout(1000);

20
scripts/playwright/tests/expandedFormUrl.spec.ts

@ -1,5 +1,7 @@
import { expect, test } from "@playwright/test";
import { DashboardPage } from "../pages/Dashboard";
import { GalleryPage } from "../pages/Dashboard/Gallery";
import { GridPage } from "../pages/Dashboard/Grid";
import setup from "../setup";
test.describe("Expanded form URL", () => {
@ -11,18 +13,16 @@ test.describe("Expanded form URL", () => {
dashboard = new DashboardPage(page, context.project);
});
function viewTest(viewType: string) {
test(viewType, async () => {
async function viewTest(viewType: string) {
// close 'Team & Auth' tab
await dashboard.closeTab({ title: "Team & Auth" });
await dashboard.treeView.openTable({ title: "Country" });
let viewObj;
let viewObj: GridPage | GalleryPage = dashboard.grid;
if (viewType === "grid") {
viewObj = dashboard.grid;
} else if (viewType === "gallery") {
viewObj = dashboard.gallery;
await viewObj.fields({ title: "City List" });
}
if (viewType === "grid") {
@ -31,6 +31,8 @@ test.describe("Expanded form URL", () => {
await dashboard.viewSidebar.createGalleryView({
title: "CountryExpand",
});
await viewObj.toolbar.clickFields();
await viewObj.toolbar.fields.click({ title: "City List" });
}
// expand row & verify URL
@ -92,9 +94,13 @@ test.describe("Expanded form URL", () => {
url: "rowId=1",
});
await dashboard.expandedForm.cancel();
});
}
viewTest("grid");
// viewTest("gallery");
test("Grid", async () => {
await viewTest("grid");
});
test("Gallery", async () => {
await viewTest("gallery");
});
});

Loading…
Cancel
Save