Browse Source

test(playwright): test for column duplicate

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4547/head
Pranav C 2 years ago
parent
commit
c5804b1dd0
  1. 8
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  2. 69
      tests/playwright/tests/columnDuplicate.spec.ts

8
tests/playwright/pages/Dashboard/Grid/Column/index.ts

@ -213,6 +213,14 @@ export class ColumnPageObject extends BasePage {
} }
} }
async duplicateColumn({ title, expectedTitle = `${title}_copy` }: { title: string; expectedTitle?: string }) {
await this.grid.get().locator(`th[data-title="${title}"] .nc-ui-dt-dropdown`).click();
await this.rootPage.locator('li[role="menuitem"]:has-text("Duplicate"):visible').click();
await this.verifyToast({ message: 'Column duplicated successfully' });
await this.grid.get().locator(`th[data-title="${expectedTitle}"]`).isVisible();
}
async save({ isUpdated }: { isUpdated?: boolean } = {}) { async save({ isUpdated }: { isUpdated?: boolean } = {}) {
await this.waitForResponse({ await this.waitForResponse({
uiAction: this.get().locator('button:has-text("Save")').click(), uiAction: this.get().locator('button:has-text("Save")').click(),

69
tests/playwright/tests/columnDuplicate.spec.ts

@ -0,0 +1,69 @@
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import setup from '../setup';
const columns = [
{
title: 'SingleLineText',
type: 'SingleLineText',
},
{
title: 'LongText',
type: 'LongText',
},
// todo: Number column creation not works
// {
// title: 'Number',
// type: 'Number',
// },
{
title: 'Decimal',
type: 'Decimal',
},
{
title: 'Checkbox',
type: 'Checkbox',
},
{
title: 'Email',
type: 'Email',
},
{
title: 'PhoneNumber',
type: 'PhoneNumber',
},
{
title: 'Url',
type: 'Url',
},
];
test.describe('Duplicate column', () => {
let dashboard: DashboardPage;
let context: any;
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
});
test('Duplicate text field', async () => {
await dashboard.treeView.openTable({ title: 'Film' });
for (const { title, type } of columns) {
await dashboard.grid.column.create({
title,
type,
});
await dashboard.grid.column.duplicateColumn({
title,
});
await dashboard.grid.column.duplicateColumn({
title,
expectedTitle: `${title}_copy_1`,
});
}
await dashboard.closeTab({ title: 'Film' });
});
});
Loading…
Cancel
Save