diff --git a/tests/playwright/pages/Dashboard/Grid/Column/index.ts b/tests/playwright/pages/Dashboard/Grid/Column/index.ts index 3ca90f1f5d..54448d6f3b 100644 --- a/tests/playwright/pages/Dashboard/Grid/Column/index.ts +++ b/tests/playwright/pages/Dashboard/Grid/Column/index.ts @@ -399,4 +399,20 @@ export class ColumnPageObject extends BasePage { // close sort menu await this.grid.toolbar.clickSort(); } + + async resize(param: { src: string; dst: string }) { + const { src, dst } = param; + const [fromStack, toStack] = await Promise.all([ + this.rootPage.locator(`[data-title="${src}"] >> .resizer`), + this.rootPage.locator(`[data-title="${dst}"] >> .resizer`), + ]); + + await fromStack.dragTo(toStack); + } + + async getWidth(param: { title: string }) { + const { title } = param; + const cell = await this.rootPage.locator(`th[data-title="${title}"]`); + return await cell.evaluate(el => el.getBoundingClientRect().width); + } } diff --git a/tests/playwright/tests/undo-redo.spec.ts b/tests/playwright/tests/undo-redo.spec.ts index 8144dd6496..65d3b88e5a 100644 --- a/tests/playwright/tests/undo-redo.spec.ts +++ b/tests/playwright/tests/undo-redo.spec.ts @@ -315,6 +315,23 @@ test.describe('Undo Redo', () => { await new Promise(resolve => setTimeout(resolve, timeOut)); await verifyRowHeight({ height: '1.5rem' }); }); + + test('Column width', async ({ page }) => { + // close 'Team & Auth' tab + await dashboard.closeTab({ title: 'Team & Auth' }); + await dashboard.treeView.openTable({ title: 'numberBased' }); + + const originalWidth = await dashboard.grid.column.getWidth({ title: 'Number' }); + + await dashboard.grid.column.resize({ src: 'Number', dst: 'Decimal' }); + await dashboard.rootPage.waitForTimeout(100); + + const modifiedWidth = await dashboard.grid.column.getWidth({ title: 'Number' }); + expect(modifiedWidth).toBeGreaterThan(originalWidth); + + await undo({ page }); + expect(await dashboard.grid.column.getWidth({ title: 'Number' })).toBe(originalWidth); + }); }); test.describe('Undo Redo - 2', () => {