@@ -21,6 +21,7 @@ import { TheiaNotebookCell } from '../theia-notebook-cell';
21
21
import { TheiaNotebookEditor } from '../theia-notebook-editor' ;
22
22
import { TheiaWorkspace } from '../theia-workspace' ;
23
23
import path = require( 'path' ) ;
24
+ import fs = require( 'fs' ) ;
24
25
25
26
// See .github/workflows/playwright.yml for preferred python version
26
27
const preferredKernel = process . env . CI ? 'Python 3.11' : 'Python 3' ;
@@ -39,7 +40,9 @@ test.describe('Theia Notebook Editor interaction', () => {
39
40
} ) ;
40
41
41
42
test . afterAll ( async ( ) => {
42
- await app . page . close ( ) ;
43
+ if ( app . page ) {
44
+ await app . page . close ( ) ;
45
+ }
43
46
} ) ;
44
47
45
48
test . afterEach ( async ( ) => {
@@ -110,9 +113,11 @@ test.describe('Theia Notebook Editor interaction', () => {
110
113
<|>print("Line-2")
111
114
*/
112
115
const line = await cell . editor . lineByLineNumber ( 1 ) ;
113
- await line ?. waitForElementState ( 'visible' ) ;
114
- await line ?. click ( ) ;
115
- await line ?. press ( 'ArrowRight' ) ;
116
+ expect ( line , { message : 'Line number 1 should exists' } ) . toBeDefined ( ) ;
117
+ const box = await line ?. boundingBox ( ) ;
118
+ console . log ( `Split cell test: visible = ${ await line ?. isVisible ( ) } , box = {${ box ?. x } ,${ box ?. y } ,${ box ?. width } ,${ box ?. height } }` ) ;
119
+ await line ! . click ( ) ;
120
+ await line ! . press ( 'ArrowRight' ) ;
116
121
117
122
// split cell
118
123
await cell . splitCell ( ) ;
@@ -134,7 +139,9 @@ test.describe('Theia Notebook Cell interaction', () => {
134
139
} ) ;
135
140
136
141
test . afterAll ( async ( ) => {
137
- await app . page . close ( ) ;
142
+ if ( app . page ) {
143
+ await app . page . close ( ) ;
144
+ }
138
145
} ) ;
139
146
140
147
test . beforeEach ( async ( ) => {
@@ -309,8 +316,9 @@ async function firstCell(editor: TheiaNotebookEditor): Promise<TheiaNotebookCell
309
316
310
317
async function loadApp ( args : TheiaPlaywrightTestConfig & PlaywrightWorkerArgs ) : Promise < TheiaApp > {
311
318
const workingDir = path . resolve ( ) ;
312
- // correct WS path. When running from IDE the path is playwright/configs with CLI it's playwright/
313
- const prefix = workingDir . endsWith ( 'playwright/configs' ) ? '../' : '' ;
319
+ // correct WS path. When running from IDE the path is workspace root or playwright/configs, with CLI it's playwright/
320
+ const isWsRoot = fs . existsSync ( path . join ( workingDir , 'examples' , 'playwright' ) ) ;
321
+ const prefix = isWsRoot ? 'examples/playwright/' : ( workingDir . endsWith ( 'playwright/configs' ) ? '../' : '' ) ;
314
322
const ws = new TheiaWorkspace ( [ prefix + 'src/tests/resources/notebook-files' ] ) ;
315
323
const app = await TheiaAppLoader . load ( args , ws ) ;
316
324
// auto-save are disabled using settings.json file
0 commit comments