@@ -9,69 +9,70 @@ function item(name: string) {
99 return `.jp-DirListing-item[title^="Name: ${ name } "]` ;
1010}
1111
12+ test . describe . serial ( 'jupyterlab-unfold' , ( ) => {
13+ test ( 'should unfold' , async ( { page } ) => {
14+ await page . goto ( `${ TARGET_URL } /lab` ) ;
15+ await page . waitForSelector ( '#jupyterlab-splash' , { state : 'detached' } ) ;
16+ await page . waitForSelector ( 'div[role="main"] >> text=Launcher' ) ;
1217
13- test ( 'should unfold' , async ( { page } ) => {
14- await page . goto ( `${ TARGET_URL } /lab` ) ;
15- await page . waitForSelector ( '#jupyterlab-splash' , { state : 'detached' } ) ;
16- await page . waitForSelector ( 'div[role="main"] >> text=Launcher' ) ;
18+ // Let time for JupyterLab to finish rendering
19+ await page . waitForTimeout ( 2000 ) ;
1720
18- // Let time for JupyterLab to finish rendering
19- await page . waitForTimeout ( 2000 ) ;
21+ expect (
22+ await page . locator ( TREE_LOCATOR ) . screenshot ( )
23+ ) . toMatchSnapshot ( 'first-render.png' ) ;
2024
21- expect (
22- await page . locator ( TREE_LOCATOR ) . screenshot ( )
23- ) . toMatchSnapshot ( 'first-render.png' ) ;
25+ await page . click ( item ( 'dir1' ) ) ;
26+ await page . waitForSelector ( item ( 'dir2' ) ) ;
2427
25- await page . click ( item ( 'dir1' ) ) ;
26- await page . waitForSelector ( item ( 'dir2' ) ) ;
28+ expect (
29+ await page . locator ( TREE_LOCATOR ) . screenshot ( )
30+ ) . toMatchSnapshot ( 'unfold-dir1.png' ) ;
2731
28- expect (
29- await page . locator ( TREE_LOCATOR ) . screenshot ( )
30- ) . toMatchSnapshot ( 'unfold-dir1.png' ) ;
32+ await page . click ( item ( 'dir2' ) ) ;
33+ await page . waitForSelector ( item ( 'dir3' ) ) ;
3134
32- await page . click ( item ( 'dir2' ) ) ;
33- await page . waitForSelector ( item ( 'dir3' ) ) ;
35+ expect (
36+ await page . locator ( TREE_LOCATOR ) . screenshot ( )
37+ ) . toMatchSnapshot ( 'unfold-dir2.png' ) ;
3438
35- expect (
36- await page . locator ( TREE_LOCATOR ) . screenshot ( )
37- ) . toMatchSnapshot ( 'unfold-dir2.png' ) ;
39+ await page . click ( item ( 'dir3' ) ) ;
40+ await page . waitForSelector ( item ( 'file211.txt' ) ) ;
3841
39- await page . click ( item ( 'dir3' ) ) ;
40- await page . waitForSelector ( item ( 'file211.txt' ) ) ;
42+ expect (
43+ await page . locator ( TREE_LOCATOR ) . screenshot ( )
44+ ) . toMatchSnapshot ( 'unfold-dir3.png' ) ;
4145
42- expect (
43- await page . locator ( TREE_LOCATOR ) . screenshot ( )
44- ) . toMatchSnapshot ( 'unfold-dir3.png' ) ;
46+ await page . click ( item ( 'dir2' ) ) ;
47+ await page . waitForSelector ( item ( 'dir3' ) , { state : 'detached' } ) ;
4548
46- await page . click ( item ( 'dir2' ) ) ;
47- await page . waitForSelector ( item ( 'dir3' ) , { state : 'detached' } ) ;
49+ expect (
50+ await page . locator ( TREE_LOCATOR ) . screenshot ( )
51+ ) . toMatchSnapshot ( 'fold-dir2.png' ) ;
4852
49- expect (
50- await page . locator ( TREE_LOCATOR ) . screenshot ( )
51- ) . toMatchSnapshot ( 'fold-dir2.png' ) ;
53+ await page . click ( item ( 'dir2' ) ) ;
54+ await page . waitForSelector ( item ( 'dir3' ) ) ;
5255
53- await page . click ( item ( 'dir2' ) ) ;
54- await page . waitForSelector ( item ( 'dir3' ) ) ;
55-
56- expect (
57- await page . locator ( TREE_LOCATOR ) . screenshot ( )
58- ) . toMatchSnapshot ( 'unfold-dir2-2.png' ) ;
59- } ) ;
56+ expect (
57+ await page . locator ( TREE_LOCATOR ) . screenshot ( )
58+ ) . toMatchSnapshot ( 'unfold-dir2-2.png' ) ;
59+ } ) ;
6060
6161
62- test ( 'should open file' , async ( { page } ) => {
63- await page . goto ( `${ TARGET_URL } /lab` ) ;
64- await page . waitForSelector ( '#jupyterlab-splash' , { state : 'detached' } ) ;
65- await page . waitForSelector ( 'div[role="main"] >> text=Launcher' ) ;
62+ test ( 'should open file' , async ( { page } ) => {
63+ await page . goto ( `${ TARGET_URL } /lab` ) ;
64+ await page . waitForSelector ( '#jupyterlab-splash' , { state : 'detached' } ) ;
65+ await page . waitForSelector ( 'div[role="main"] >> text=Launcher' ) ;
6666
67- // Let time for JupyterLab to finish rendering
68- await page . waitForTimeout ( 2000 ) ;
67+ // Let time for JupyterLab to finish rendering
68+ await page . waitForTimeout ( 2000 ) ;
6969
70- await page . dblclick ( item ( 'file211.txt' ) ) ;
71- // TODO Use something more reliable
72- await page . waitForTimeout ( 1000 ) ;
70+ await page . dblclick ( item ( 'file211.txt' ) ) ;
71+ // TODO Use something more reliable
72+ await page . waitForTimeout ( 1000 ) ;
7373
74- expect (
75- await page . locator ( TABS_LOCATOR ) . screenshot ( )
76- ) . toMatchSnapshot ( 'open-file211.png' ) ;
74+ expect (
75+ await page . locator ( TABS_LOCATOR ) . screenshot ( )
76+ ) . toMatchSnapshot ( 'open-file211.png' ) ;
77+ } ) ;
7778} ) ;
0 commit comments