11// Copyright (c) Jupyter Development Team.
22// Distributed under the terms of the Modified BSD License.
33
4- import path from 'path' ;
5-
64import { expect } from '@playwright/test' ;
75
86import { test } from './fixtures' ;
@@ -28,26 +26,29 @@ test.describe('Mobile', () => {
2826 tmpPath,
2927 browserName,
3028 } ) => {
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+ ] ) ;
3737
3838 // wait for the kernel status animations to be finished
39- await waitForKernelReady ( page ) ;
39+ await waitForKernelReady ( notebook ) ;
4040
4141 // force switching back to command mode to avoid capturing the cursor in the screenshot
42- await page . evaluate ( async ( ) => {
42+ await notebook . evaluate ( async ( ) => {
4343 await window . jupyterapp . commands . execute ( 'notebook:enter-command-mode' ) ;
4444 } ) ;
4545
4646 // TODO: remove
4747 if ( browserName === 'firefox' ) {
48- await hideAddCellButton ( page ) ;
48+ await hideAddCellButton ( notebook ) ;
4949 }
5050
51- expect ( await page . screenshot ( ) ) . toMatchSnapshot ( 'notebook.png' ) ;
51+ expect ( await notebook . screenshot ( ) ) . toMatchSnapshot ( 'notebook.png' ) ;
52+ await notebook . close ( ) ;
5253 } ) ;
5354} ) ;
0 commit comments