From b7d50799fc2b2439d8ecdae0a942745478ec97cd Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Tue, 13 Jun 2023 08:41:24 +0530 Subject: [PATCH] test: meta block, one copy multiple paste Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../tests/db/keyboardShortcuts.spec.ts | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/tests/playwright/tests/db/keyboardShortcuts.spec.ts b/tests/playwright/tests/db/keyboardShortcuts.spec.ts index 4aaff5ba7d..43b29ae1ad 100644 --- a/tests/playwright/tests/db/keyboardShortcuts.spec.ts +++ b/tests/playwright/tests/db/keyboardShortcuts.spec.ts @@ -309,7 +309,7 @@ test.describe('Clipboard support', () => { }); test('multiple cells - vertical', async ({ page }) => { - const cellText: string[] = ['aaa', 'bbb', 'ccc', 'ddd', 'eee']; + let cellText: string[] = ['aaa', 'bbb', 'ccc', 'ddd', 'eee']; for (let i = 1; i <= 5; i++) { await grid.addNewRow({ index: i, columnHeader: 'SingleLineText', value: cellText[i - 1] }); } @@ -353,23 +353,36 @@ test.describe('Clipboard support', () => { ///////////////////////////////////////////////////////////////////////// - // To be enabled after meta handling fix - - // // Meta for block selection - // await grid.cell.click({ index: 1, columnHeader: 'SingleLineText' }); - // await page.keyboard.press('Shift+Meta+ArrowDown'); - // await page.keyboard.press((await grid.isMacOs()) ? 'Meta+c' : 'Control+c'); - // await grid.cell.click({ index: 1, columnHeader: 'Email' }); - // await page.keyboard.press((await grid.isMacOs()) ? 'Meta+v' : 'Control+v'); - // - // // reload page - // await dashboard.rootPage.reload(); - // - // // verify copied data - // // modified cell text after previous block operation - // cellText = ['aaa', 'bbb', 'ccc', 'aaa', 'bbb']; - // for (let i = 1; i <= 5; i++) { - // await grid.cell.verify({ index: i, columnHeader: 'Email', value: cellText[i - 1] }); - // } + // Meta for block selection + await grid.cell.click({ index: 1, columnHeader: 'SingleLineText' }); + await page.keyboard.press(`Shift+${(await grid.isMacOs()) ? 'Meta' : 'Control'}+ArrowDown`); + await page.keyboard.press((await grid.isMacOs()) ? 'Meta+c' : 'Control+c'); + await grid.cell.click({ index: 1, columnHeader: 'Email' }); + await page.keyboard.press((await grid.isMacOs()) ? 'Meta+v' : 'Control+v'); + + // reload page + await dashboard.rootPage.reload(); + + // verify copied data + // modified cell text after previous block operation + cellText = ['aaa', 'bbb', 'ccc', 'aaa', 'bbb']; + for (let i = 1; i <= 5; i++) { + await grid.cell.verify({ index: i, columnHeader: 'Email', value: cellText[i - 1] }); + } + + // One copy, multiple paste + await grid.cell.click({ index: 0, columnHeader: 'SingleLineText' }); + await page.keyboard.press((await grid.isMacOs()) ? 'Meta+c' : 'Control+c'); + await grid.cell.click({ index: 1, columnHeader: 'SingleLineText' }); + await page.keyboard.press(`Shift+${(await grid.isMacOs()) ? 'Meta' : 'Control'}+ArrowDown`); + await page.keyboard.press((await grid.isMacOs()) ? 'Meta+v' : 'Control+v'); + + // reload page + await dashboard.rootPage.reload(); + + // verify copied data + for (let i = 1; i <= 5; i++) { + await grid.cell.verify({ index: i, columnHeader: 'SingleLineText', value: 'SingleLineText' }); + } }); });