Browse Source

chore: reorder class objects

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3848/head
Raju Udava 2 years ago committed by Muhammed Mustafa
parent
commit
a65a1e6c8e
  1. 118
      scripts/playwright/pages/Dashboard/ExpandedForm/index.ts
  2. 71
      scripts/playwright/pages/Dashboard/Grid/Column/LTAR/ChildList.ts
  3. 51
      scripts/playwright/pages/Dashboard/Grid/Column/LTAR/LinkRecord.ts
  4. 4
      scripts/playwright/pages/Dashboard/index.ts

118
scripts/playwright/pages/Dashboard/ExpandedForm/index.ts

@ -1,5 +1,5 @@
// playwright-dev-page.ts // playwright-dev-page.ts
import { expect, Locator } from "@playwright/test"; import { Locator } from "@playwright/test";
import BasePage from "../../Base"; import BasePage from "../../Base";
import { DashboardPage } from ".."; import { DashboardPage } from "..";
@ -40,119 +40,3 @@ export class ExpandedFormPage extends BasePage {
.waitFor({ state: "hidden" }); .waitFor({ state: "hidden" });
} }
} }
export class ChildList extends BasePage {
readonly dashboard: DashboardPage;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.dashboard = dashboard;
}
async verify({
cardTitle,
linkField,
}: {
cardTitle: string[];
linkField: string;
}) {
// DOM element validation
// title: Child list
// button: Link to 'City'
// icon: reload
expect(await this.get().locator(`.ant-modal-title`).innerText()).toBe(
`Child list`
);
expect(
await this.get()
.locator(`button:has-text("Link to '${linkField}'")`)
.isVisible()
).toBeTruthy();
expect(
await this.get().locator(`[data-cy="nc-child-list-reload"]`).isVisible()
).toBeTruthy();
// child list body validation (card count, card title)
const cardCount = cardTitle.length;
await this.get().locator(".ant-modal-content").waitFor();
{
let childList = this.get().locator(`.ant-card`);
const childCards = await childList.count();
await expect(childCards).toEqual(cardCount);
for (let i = 0; i < cardCount; i++) {
expect(await childList.nth(i).textContent()).toContain(cardTitle[i]);
// icon: unlink
// icon: delete
expect(
await childList
.nth(i)
.locator(`[data-cy="nc-child-list-icon-unlink"]`)
.isVisible()
).toBeTruthy();
expect(
await childList
.nth(i)
.locator(`[data-cy="nc-child-list-icon-delete"]`)
.isVisible()
).toBeTruthy();
}
}
}
async close() {
await this.get().locator(`.ant-modal-close-x`).click();
await this.get().waitFor({ state: "hidden" });
}
get() {
return this.dashboard.get().locator(`.nc-modal-child-list`);
}
}
export class LinkRecord extends BasePage {
readonly dashboard: DashboardPage;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.dashboard = dashboard;
}
async verify(cardTitle?: string[]) {
await this.dashboard.get().locator(".nc-modal-link-record").waitFor();
let linkRecord = await this.get();
// DOM element validation
// title: Link Record
// button: Add new record
// icon: reload
expect(await this.get().locator(`.ant-modal-title`).innerText()).toBe(
`Link record`
);
expect(
await linkRecord.locator(`button:has-text("Add new record")`).isVisible()
).toBeTruthy();
expect(await linkRecord.locator(`.nc-reload`).isVisible()).toBeTruthy();
// placeholder: Filter query
expect(
await linkRecord.locator(`[placeholder="Filter query"]`).isVisible()
).toBeTruthy();
{
let childList = linkRecord.locator(`.ant-card`);
const childCards = await childList.count();
await expect(childCards).toEqual(cardTitle.length);
for (let i = 0; i < cardTitle.length; i++) {
expect(await childList.nth(i).textContent()).toContain(cardTitle[i]);
}
}
}
async close() {
await this.get().locator(`.ant-modal-close-x`).click();
await this.get().waitFor({ state: "hidden" });
}
get() {
return this.dashboard.get().locator(`.nc-modal-link-record`);
}
}

71
scripts/playwright/pages/Dashboard/Grid/Column/LTAR/ChildList.ts

@ -0,0 +1,71 @@
import BasePage from "../../../../Base";
import { DashboardPage } from "../../../index";
import { expect } from "@playwright/test";
export class ChildList extends BasePage {
readonly dashboard: DashboardPage;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.dashboard = dashboard;
}
async verify({
cardTitle,
linkField,
}: {
cardTitle: string[];
linkField: string;
}) {
// DOM element validation
// title: Child list
// button: Link to 'City'
// icon: reload
expect(await this.get().locator(`.ant-modal-title`).innerText()).toBe(
`Child list`
);
expect(
await this.get()
.locator(`button:has-text("Link to '${linkField}'")`)
.isVisible()
).toBeTruthy();
expect(
await this.get().locator(`[data-cy="nc-child-list-reload"]`).isVisible()
).toBeTruthy();
// child list body validation (card count, card title)
const cardCount = cardTitle.length;
await this.get().locator(".ant-modal-content").waitFor();
{
let childList = this.get().locator(`.ant-card`);
const childCards = await childList.count();
await expect(childCards).toEqual(cardCount);
for (let i = 0; i < cardCount; i++) {
expect(await childList.nth(i).textContent()).toContain(cardTitle[i]);
// icon: unlink
// icon: delete
expect(
await childList
.nth(i)
.locator(`[data-cy="nc-child-list-icon-unlink"]`)
.isVisible()
).toBeTruthy();
expect(
await childList
.nth(i)
.locator(`[data-cy="nc-child-list-icon-delete"]`)
.isVisible()
).toBeTruthy();
}
}
}
async close() {
await this.get().locator(`.ant-modal-close-x`).click();
await this.get().waitFor({ state: "hidden" });
}
get() {
return this.dashboard.get().locator(`.nc-modal-child-list`);
}
}

51
scripts/playwright/pages/Dashboard/Grid/Column/LTAR/LinkRecord.ts

@ -0,0 +1,51 @@
import BasePage from "../../../../Base";
import { DashboardPage } from "../../../index";
import { expect } from "@playwright/test";
export class LinkRecord extends BasePage {
readonly dashboard: DashboardPage;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.dashboard = dashboard;
}
async verify(cardTitle?: string[]) {
await this.dashboard.get().locator(".nc-modal-link-record").waitFor();
let linkRecord = await this.get();
// DOM element validation
// title: Link Record
// button: Add new record
// icon: reload
expect(await this.get().locator(`.ant-modal-title`).innerText()).toBe(
`Link record`
);
expect(
await linkRecord.locator(`button:has-text("Add new record")`).isVisible()
).toBeTruthy();
expect(await linkRecord.locator(`.nc-reload`).isVisible()).toBeTruthy();
// placeholder: Filter query
expect(
await linkRecord.locator(`[placeholder="Filter query"]`).isVisible()
).toBeTruthy();
{
let childList = linkRecord.locator(`.ant-card`);
const childCards = await childList.count();
await expect(childCards).toEqual(cardTitle.length);
for (let i = 0; i < cardTitle.length; i++) {
expect(await childList.nth(i).textContent()).toContain(cardTitle[i]);
}
}
}
async close() {
await this.get().locator(`.ant-modal-close-x`).click();
await this.get().waitFor({ state: "hidden" });
}
get() {
return this.dashboard.get().locator(`.nc-modal-link-record`);
}
}

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

@ -2,7 +2,9 @@
import { Locator, Page, expect } from "@playwright/test"; import { Locator, Page, expect } from "@playwright/test";
import BasePage from "../Base"; import BasePage from "../Base";
import { GridPage } from "./Grid"; import { GridPage } from "./Grid";
import { ExpandedFormPage, ChildList, LinkRecord } from "./ExpandedForm"; import { ExpandedFormPage } from "./ExpandedForm";
import { ChildList } from "./Grid/Column/LTAR/ChildList";
import { LinkRecord } from "./Grid/Column/LTAR/LinkRecord";
import { TreeViewPage } from "./TreeView"; import { TreeViewPage } from "./TreeView";
import { SettingsPage } from "./Settings"; import { SettingsPage } from "./Settings";
import { ViewSidebarPage } from "./ViewSidebar"; import { ViewSidebarPage } from "./ViewSidebar";

Loading…
Cancel
Save