From f80f4b5d95a4c931534394da1e63aaff29a9e4d8 Mon Sep 17 00:00:00 2001 From: Dennis Sen Date: Thu, 17 Oct 2024 08:29:42 +0200 Subject: [PATCH] add icon menu test --- e2e/iconMenu.spec.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 e2e/iconMenu.spec.ts diff --git a/e2e/iconMenu.spec.ts b/e2e/iconMenu.spec.ts new file mode 100644 index 000000000..494533294 --- /dev/null +++ b/e2e/iconMenu.spec.ts @@ -0,0 +1,26 @@ +import { test, expect, Page } from '@playwright/test' +import { openSnowbox } from './utils/openSnowbox' + +const expectOpenContentWindows = async (page: Page, amount: number) => + expect(await page.locator('.icon-menu-list-item-content')).toHaveCount(amount) + +test('opens and closes children exclusively to each other', async ({ + page, +}) => { + await openSnowbox(page) + + // one window open initially + await expectOpenContentWindows(page, 1) + + // window closed + await page.locator('.icon-menu-list-item button').first().click() + await expectOpenContentWindows(page, 0) + + // window reopened + await page.locator('.icon-menu-list-item button').first().click() + await expectOpenContentWindows(page, 1) + + // opening another window closes the first one + await page.locator('.icon-menu-list-item:nth-child(2) button').first().click() + await expectOpenContentWindows(page, 1) +})