1
1
// Copyright (c) Jupyter Development Team.
2
2
// Distributed under the terms of the Modified BSD License.
3
3
4
- import { expect } from '@playwright/test ' ;
4
+ import { IJupyterLabPage , expect , galata } from '@jupyterlab/galata ' ;
5
5
6
6
import { test } from './fixtures' ;
7
7
8
8
import { hideAddCellButton , waitForKernelReady } from './utils' ;
9
9
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
+ } ) ;
11
17
12
18
test . 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
+
13
30
test ( 'The layout should be more compact on the file browser page' , async ( {
14
31
page,
15
32
tmpPath,
@@ -29,11 +46,14 @@ test.describe('Mobile', () => {
29
46
await page . goto ( `tree/${ tmpPath } ` ) ;
30
47
31
48
// 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 ;
37
57
38
58
// wait for the kernel status animations to be finished
39
59
await waitForKernelReady ( notebook ) ;
0 commit comments