From 72d1766f0a2dc8e0a1c87ae44e0d24dccae40e17 Mon Sep 17 00:00:00 2001 From: Tomas <63101847+Re1nGer@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:19:34 +0200 Subject: [PATCH] test(playwright): shortcuts-modal improvements (#54104) --- e2e/shortcuts-modal.spec.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/e2e/shortcuts-modal.spec.ts b/e2e/shortcuts-modal.spec.ts index f300805a8f7..99a1ee7e986 100644 --- a/e2e/shortcuts-modal.spec.ts +++ b/e2e/shortcuts-modal.spec.ts @@ -39,6 +39,9 @@ test('User can see list of shortcuts by pressing SHIFT + ?', async ({ 'Skipping on mobile as it does not have a physical keyboard.' ); + const dialogs = page.getByRole('dialog'); + await expect(dialogs).toHaveCount(2); + await expect( page.getByRole('heading', { name: translations.shortcuts.title }) ).toBeVisible(); @@ -69,12 +72,16 @@ test('User can close the modal by pressing ESC', async ({ page, isMobile }) => { isMobile, 'Skipping on mobile as it does not have a physical keyboard.' ); - + const dialogs = page.getByRole('dialog'); + await expect(dialogs).toHaveCount(2); await expect( page.getByRole('heading', { name: translations.shortcuts.title }) ).toBeVisible(); await page.keyboard.press('Escape'); + for (const dialog of await dialogs.all()) { + await expect(dialog).not.toBeVisible(); + } await expect( page.getByRole('heading', { name: translations.shortcuts.title }) ).not.toBeVisible(); @@ -85,13 +92,17 @@ test('User can disable keyboard shortcuts', async ({ page, isMobile }) => { isMobile, 'Skipping on mobile as it does not have a physical keyboard.' ); - + const dialogs = page.getByRole('dialog'); + await expect(dialogs).toHaveCount(2); await expect( page.getByRole('heading', { name: translations.shortcuts.title }) ).toBeVisible(); await page.getByRole('button', { name: translations.buttons.off }).click(); await page.getByRole('button', { name: translations.buttons.close }).click(); + for (const dialog of await dialogs.all()) { + await expect(dialog).not.toBeVisible(); + } await expect( page.getByRole('heading', { name: translations.shortcuts.title }) ).not.toBeVisible();