-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from Dataport/test/add-icon-menu-test
add icon menu test
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |