Browse Source

test: project operations

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
19ec22f10e
  1. 33
      scripts/playwright/pages/Dashboard/index.ts
  2. 28
      scripts/playwright/tests/projectOperations.spec.ts

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

@ -197,6 +197,39 @@ export class DashboardPage extends BasePage {
await project.locator(`td.ant-table-cell:has-text("${title}")`).click();
}
async renameProject({
title,
newTitle,
}: {
title?: string;
newTitle?: string;
}) {
const project = this.rootPage;
const projRow = await project.locator(`tr`, {
has: project.locator(`td.ant-table-cell:has-text("${title}")`),
});
await projRow.locator(".nc-action-btn").nth(0).click();
await project.locator("input.nc-metadb-project-name").fill(newTitle);
// press enter to save
await project.locator("input.nc-metadb-project-name").press("Enter");
}
async deleteProject({ title }: { title?: string }) {
const project = this.rootPage;
const projRow = await project.locator(`tr`, {
has: project.locator(`td.ant-table-cell:has-text("${title}")`),
});
await projRow.locator(".nc-action-btn").nth(1).click();
const deleteModal = await project.locator(".nc-modal-project-delete");
await deleteModal.locator('button:has-text("Yes")').click();
await this.rootPage.waitForTimeout(1000);
expect(
await project.locator(`td.ant-table-cell:has-text("${title}")`).count()
).toBe(0);
}
async validateProjectMenu(param: { role: string }) {
await this.rootPage.locator('[pw-data="nc-project-menu"]').click();
let pMenu = this.rootPage.locator(`.nc-dropdown-project-menu:visible`);

28
scripts/playwright/tests/projectOperations.spec.ts

@ -0,0 +1,28 @@
import { test } from "@playwright/test";
import { DashboardPage } from "../pages/Dashboard";
import setup from "../setup";
import { ToolbarPage } from "../pages/Dashboard/common/Toolbar";
test.describe("Project operations", () => {
let dashboard: DashboardPage;
let toolbar: ToolbarPage;
let context: any;
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
toolbar = dashboard.grid.toolbar;
});
test("rename, delete", async () => {
await dashboard.clickHome();
await dashboard.renameProject({
title: "externalREST0",
newTitle: "externalREST0x",
});
await dashboard.clickHome();
await dashboard.openProject({ title: "externalREST0x" });
await dashboard.clickHome();
await dashboard.deleteProject({ title: "externalREST0x" });
});
});
Loading…
Cancel
Save