From 50670511011758c277f9fc2c1f79e2f735486ddc Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 13 Oct 2022 13:54:04 +0530 Subject: [PATCH] test: toolbar- add new row button verification Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../pages/Dashboard/Grid/Toolbar/index.ts | 2 +- .../tests/tableColumnOperation.spec.ts | 84 +++++++++++-------- 2 files changed, 52 insertions(+), 34 deletions(-) diff --git a/scripts/playwright/pages/Dashboard/Grid/Toolbar/index.ts b/scripts/playwright/pages/Dashboard/Grid/Toolbar/index.ts index fae2a2c6ad..a28d97b423 100644 --- a/scripts/playwright/pages/Dashboard/Grid/Toolbar/index.ts +++ b/scripts/playwright/pages/Dashboard/Grid/Toolbar/index.ts @@ -39,6 +39,6 @@ export class ToolbarPage extends BasePage { } async clickAddNewRow() { - await this.get().locator(`.nc-toolbar-btn.nc-add-new-row-btn")`).click(); + await this.get().locator(`.nc-toolbar-btn.nc-add-new-row-btn`).click(); } } diff --git a/scripts/playwright/tests/tableColumnOperation.spec.ts b/scripts/playwright/tests/tableColumnOperation.spec.ts index 7397667c59..46c1910b95 100644 --- a/scripts/playwright/tests/tableColumnOperation.spec.ts +++ b/scripts/playwright/tests/tableColumnOperation.spec.ts @@ -1,53 +1,71 @@ -import { test } from '@playwright/test'; -import { DashboardPage } from '../pages/Dashboard'; -import { GridPage } from '../pages/Dashboard/Grid'; -import setup from '../setup'; +import { test } from "@playwright/test"; +import { DashboardPage } from "../pages/Dashboard"; +import { GridPage } from "../pages/Dashboard/Grid"; +import setup from "../setup"; - -test.describe('Table Column Operations', () => { +test.describe.only("Table Column Operations", () => { let grid: GridPage, dashboard: DashboardPage; let context: any; - test.beforeEach(async ({page}) => { + test.beforeEach(async ({ page }) => { context = await setup({ page }); dashboard = new DashboardPage(page, context.project); grid = dashboard.grid; - await dashboard.treeView.createTable({title: "sheet1"}); - }) + await dashboard.treeView.createTable({ title: "sheet1" }); + }); + + test("Create column", async () => { + await grid.column.create({ title: "column_name_a" }); + await grid.column.verify({ title: "column_name_a" }); - test('Create column', async () => { - await grid.column.create({title: "column_name_a"}); - await grid.column.verify({title: "column_name_a"}); + await grid.column.openEdit({ title: "column_name_a" }); + await grid.column.fillTitle({ title: "column_name_b" }); + await grid.column.selectType({ type: "LongText" }); + await grid.column.save({ isUpdated: true }); + await grid.column.verify({ title: "column_name_b" }); - await grid.column.openEdit({title: "column_name_a"}); - await grid.column.fillTitle({title: "column_name_b"}); - await grid.column.selectType({type: "LongText"}); - await grid.column.save({isUpdated: true}); - await grid.column.verify({title: "column_name_b"}); + await grid.column.delete({ title: "column_name_b" }); + await grid.column.verify({ title: "column_name_b", isDeleted: true }); - await grid.column.delete({title: "column_name_b"}); - await grid.column.verify({title: "column_name_b", isDeleted: true}); + await grid.addNewRow({ index: 0 }); + await grid.verifyRow({ index: 0 }); - await grid.addNewRow({index: 0}); - await grid.verifyRow({index: 0}) - - await grid.openExpandedRow({index: 0}); - await dashboard.expandedForm.fillField({columnTitle: "Title", value: "value_a"}); + await grid.openExpandedRow({ index: 0 }); + await dashboard.expandedForm.fillField({ + columnTitle: "Title", + value: "value_a", + }); await dashboard.expandedForm.save(); - await grid.cell.verify({index: 0, columnHeader: "Title", value: "value_a"}); + await grid.cell.verify({ + index: 0, + columnHeader: "Title", + value: "value_a", + }); await grid.deleteRow(0); - await grid.verifyRowDoesNotExist({index: 0}); + await grid.verifyRowDoesNotExist({ index: 0 }); - await grid.addNewRow({index: 0}); - await grid.addNewRow({index: 1}); - await grid.addNewRow({index: 2}); - await grid.addNewRow({index: 3}); - await grid.addNewRow({index: 4}); + await grid.addNewRow({ index: 0 }); + await grid.addNewRow({ index: 1 }); + await grid.addNewRow({ index: 2 }); + await grid.addNewRow({ index: 3 }); + await grid.addNewRow({ index: 4 }); await grid.deleteAll(); - await grid.verifyRowDoesNotExist({index: 0}); - }); + await grid.verifyRowDoesNotExist({ index: 0 }); + // add new row using toolbar button + await grid.toolbar.clickAddNewRow(); + await dashboard.expandedForm.fillField({ + columnTitle: "Title", + value: "value_a", + }); + await dashboard.expandedForm.save(); + await grid.cell.verify({ + index: 0, + columnHeader: "Title", + value: "value_a", + }); + }); });