1
1
// Copyright (c) Jupyter Development Team.
2
2
// Distributed under the terms of the Modified BSD License.
3
3
4
- import path from 'path' ;
5
-
6
4
import { expect } from '@playwright/test' ;
7
5
8
6
import { test } from './fixtures' ;
@@ -28,26 +26,29 @@ test.describe('Mobile', () => {
28
26
tmpPath,
29
27
browserName,
30
28
} ) => {
31
- const notebook = 'empty.ipynb' ;
32
- await page . contents . uploadFile (
33
- path . resolve ( __dirname , `./notebooks/${ notebook } ` ) ,
34
- `${ tmpPath } /${ notebook } `
35
- ) ;
36
- await page . goto ( `notebooks/${ tmpPath } /${ notebook } ` ) ;
29
+ await page . goto ( `tree/${ tmpPath } ` ) ;
30
+
31
+ // Create a new notebook
32
+ const [ notebook ] = await Promise . all ( [
33
+ page . waitForEvent ( 'popup' ) ,
34
+ page . click ( 'text="New"' ) ,
35
+ page . click ( 'text="Python 3 (ipykernel)"' ) ,
36
+ ] ) ;
37
37
38
38
// wait for the kernel status animations to be finished
39
- await waitForKernelReady ( page ) ;
39
+ await waitForKernelReady ( notebook ) ;
40
40
41
41
// force switching back to command mode to avoid capturing the cursor in the screenshot
42
- await page . evaluate ( async ( ) => {
42
+ await notebook . evaluate ( async ( ) => {
43
43
await window . jupyterapp . commands . execute ( 'notebook:enter-command-mode' ) ;
44
44
} ) ;
45
45
46
46
// TODO: remove
47
47
if ( browserName === 'firefox' ) {
48
- await hideAddCellButton ( page ) ;
48
+ await hideAddCellButton ( notebook ) ;
49
49
}
50
50
51
- expect ( await page . screenshot ( ) ) . toMatchSnapshot ( 'notebook.png' ) ;
51
+ expect ( await notebook . screenshot ( ) ) . toMatchSnapshot ( 'notebook.png' ) ;
52
+ await notebook . close ( ) ;
52
53
} ) ;
53
54
} ) ;
0 commit comments