File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { test , expect , Page } from '@playwright/test'
2
+ import { openSnowbox } from './utils/openSnowbox'
3
+
4
+ const expectOpenContentWindows = async ( page : Page , amount : number ) =>
5
+ expect ( await page . locator ( '.icon-menu-list-item-content' ) ) . toHaveCount ( amount )
6
+
7
+ test ( 'opens and closes children exclusively to each other' , async ( {
8
+ page,
9
+ } ) => {
10
+ await openSnowbox ( page )
11
+
12
+ // one window open initially
13
+ await expectOpenContentWindows ( page , 1 )
14
+
15
+ // window closed
16
+ await page . locator ( '.icon-menu-list-item button' ) . first ( ) . click ( )
17
+ await expectOpenContentWindows ( page , 0 )
18
+
19
+ // window reopened
20
+ await page . locator ( '.icon-menu-list-item button' ) . first ( ) . click ( )
21
+ await expectOpenContentWindows ( page , 1 )
22
+
23
+ // opening another window closes the first one
24
+ await page . locator ( '.icon-menu-list-item:nth-child(2) button' ) . first ( ) . click ( )
25
+ await expectOpenContentWindows ( page , 1 )
26
+ } )
You can’t perform that action at this time.
0 commit comments