11// Copyright (c) Jupyter Development Team.
22// Distributed under the terms of the Modified BSD License.
33
4- import { expect } from '@playwright/test ' ;
4+ import { IJupyterLabPage , expect , galata } from '@jupyterlab/galata ' ;
55
66import { test } from './fixtures' ;
77
88import { hideAddCellButton , waitForKernelReady } from './utils' ;
99
10- test . use ( { autoGoto : false , viewport : { width : 524 , height : 800 } } ) ;
10+ test . use ( {
11+ autoGoto : false ,
12+ viewport : { width : 524 , height : 800 } ,
13+ // Set a fixed string as Playwright is preventing the unique test name to be too long
14+ // and replaces part of the path with a hash
15+ tmpPath : 'mobile-layout' ,
16+ } ) ;
1117
1218test . describe ( 'Mobile' , ( ) => {
19+ // manually create the test directory since tmpPath is set to a fixed value
20+ test . beforeAll ( async ( { request, tmpPath } ) => {
21+ const contents = galata . newContentsHelper ( request ) ;
22+ await contents . createDirectory ( tmpPath ) ;
23+ } ) ;
24+
25+ test . afterAll ( async ( { request, tmpPath } ) => {
26+ const contents = galata . newContentsHelper ( request ) ;
27+ await contents . deleteDirectory ( tmpPath ) ;
28+ } ) ;
29+
1330 test ( 'The layout should be more compact on the file browser page' , async ( {
1431 page,
1532 tmpPath,
@@ -29,11 +46,14 @@ test.describe('Mobile', () => {
2946 await page . goto ( `tree/${ tmpPath } ` ) ;
3047
3148 // 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- ] ) ;
49+ const notebookPromise = page . waitForEvent ( 'popup' ) ;
50+ await page . click ( 'text="New"' ) ;
51+ await page
52+ . locator (
53+ '[data-command="notebook:create-new"] >> text="Python 3 (ipykernel)"'
54+ )
55+ . click ( ) ;
56+ const notebook = await notebookPromise ;
3757
3858 // wait for the kernel status animations to be finished
3959 await waitForKernelReady ( notebook ) ;
0 commit comments