@@ -7,6 +7,7 @@ import { Notebooks } from './notebooks';
7
7
import { Code } from '../infra/code' ;
8
8
import { QuickInput } from './quickInput' ;
9
9
import { QuickAccess } from './quickaccess' ;
10
+ import { Clipboard } from './clipboard.js' ;
10
11
import test , { expect , Locator } from '@playwright/test' ;
11
12
import { HotKeys } from './hotKeys.js' ;
12
13
@@ -49,7 +50,7 @@ export class PositronNotebooks extends Notebooks {
49
50
cellInfoToolTipOrder = this . cellInfoToolTip . getByLabel ( 'Execution order' ) ;
50
51
cellInfoToolTipCompleted = this . cellInfoToolTip . getByLabel ( 'Execution completed' ) ;
51
52
52
- constructor ( code : Code , quickinput : QuickInput , quickaccess : QuickAccess , hotKeys : HotKeys ) {
53
+ constructor ( code : Code , quickinput : QuickInput , quickaccess : QuickAccess , hotKeys : HotKeys , private clipboard : Clipboard ) {
53
54
super ( code , quickinput , quickaccess , hotKeys ) ;
54
55
}
55
56
@@ -124,6 +125,20 @@ export class PositronNotebooks extends Notebooks {
124
125
await this . expectToBeVisible ( ) ;
125
126
}
126
127
128
+ /**
129
+ * Create a new Positron notebook.
130
+ * @param numCellsToAdd - Number of cells to add after creating the notebook (default: 0).
131
+ */
132
+ async newNotebook ( numCellsToAdd = 0 ) : Promise < void > {
133
+ await this . createNewNotebook ( ) ;
134
+ await this . expectToBeVisible ( ) ;
135
+ if ( numCellsToAdd > 0 ) {
136
+ for ( let i = 0 ; i < numCellsToAdd ; i ++ ) {
137
+ await this . addCodeToCell ( i , `# Cell ${ i } ` ) ;
138
+ }
139
+ }
140
+ }
141
+
127
142
/**
128
143
* @override
129
144
* Action: Select a cell at the specified index.
@@ -180,6 +195,7 @@ export class PositronNotebooks extends Notebooks {
180
195
* Action: Move the mouse away from the notebook area to close any open tooltips/popups.
181
196
*/
182
197
async moveMouseAway ( ) : Promise < void > {
198
+ await this . code . driver . page . waitForTimeout ( 500 ) ;
183
199
await this . code . driver . page . mouse . move ( 0 , 0 ) ;
184
200
} ;
185
201
@@ -252,13 +268,13 @@ export class PositronNotebooks extends Notebooks {
252
268
253
269
switch ( action ) {
254
270
case 'copy' :
255
- await this . hotKeys . copy ( ) ;
271
+ await this . clipboard . copy ( ) ;
256
272
break ;
257
273
case 'cut' :
258
- await this . hotKeys . cut ( ) ;
274
+ await this . clipboard . cut ( ) ;
259
275
break ;
260
276
case 'paste' :
261
- await this . hotKeys . paste ( ) ;
277
+ await this . clipboard . paste ( ) ;
262
278
break ;
263
279
case 'undo' :
264
280
await this . hotKeys . undo ( ) ;
0 commit comments