44 *--------------------------------------------------------------------------------------------*/
55
66import test , { expect , Locator , Page } from '@playwright/test' ;
7- import { Code , QuickAccess , Console , ContextMenu } from '../infra' ;
7+ import { Code , QuickAccess , Console , ContextMenu , Modals } from '../infra' ;
88import { QuickInput } from './quickInput' ;
99
1010// Lazy getters for environment variables - these will be evaluated when accessed, not at module load time
@@ -46,7 +46,7 @@ export class Sessions {
4646 private consoleInstance = ( sessionId : string ) => this . page . getByTestId ( `console-${ sessionId } ` ) ;
4747 private outputChannel = this . page . getByRole ( 'combobox' ) ;
4848
49- constructor ( private code : Code , private quickaccess : QuickAccess , private quickinput : QuickInput , private console : Console , private contextMenu : ContextMenu ) { }
49+ constructor ( private code : Code , private quickaccess : QuickAccess , private quickinput : QuickInput , private console : Console , private contextMenu : ContextMenu , private modals : Modals ) { }
5050
5151 // -- Actions --
5252
@@ -180,8 +180,8 @@ export class Sessions {
180180 * @param options.waitForIdle - wait for the session to display as "idle" (ready)
181181 * @param options.clearConsole - clear the console before restarting
182182 */
183- async restart ( sessionIdOrName : string , options ?: { waitForIdle ?: boolean ; clearConsole ?: boolean } ) : Promise < void > {
184- const { waitForIdle = true , clearConsole = true } = options || { } ;
183+ async restart ( sessionIdOrName : string , options ?: { waitForIdle ?: boolean ; clearConsole ?: boolean , clickModalButton ?: string } ) : Promise < void > {
184+ const { waitForIdle = true , clearConsole = true , clickModalButton = '' } = options || { } ;
185185
186186 await test . step ( `Restart session: ${ sessionIdOrName } ` , async ( ) => {
187187 await this . console . focus ( ) ;
@@ -197,6 +197,10 @@ export class Sessions {
197197 await this . console . restartButton . click ( ) ;
198198 await this . page . mouse . move ( 0 , 0 ) ;
199199
200+ if ( clickModalButton ) {
201+ await this . modals . clickButton ( clickModalButton ) ;
202+ }
203+
200204 if ( waitForIdle ) {
201205 await expect ( this . page . getByText ( 'restarting.' ) ) . not . toBeVisible ( { timeout : 90000 } ) ;
202206 await expect ( this . page . locator ( '.console-instance[style*="z-index: auto"]' ) . getByText ( 'restarted.' ) ) . toBeVisible ( { timeout : 90000 } ) ;
@@ -878,8 +882,7 @@ export class Sessions {
878882 await test . step ( `Verify runtime is selected: ${ runtimeName } ` , async ( ) => {
879883 const normalizedRuntimeName = runtimeName . replace ( / - \s \d + $ / , '' ) . trim ( ) ;
880884 await expect ( this . sessionPicker ) . toHaveText ( normalizedRuntimeName , { timeout } ) ;
881- }
882- ) ;
885+ } ) ;
883886 }
884887
885888 /**
@@ -945,10 +948,10 @@ export class Sessions {
945948 /**
946949 * Verify: all sessions are "ready" (idle or disconnected)
947950 */
948- async expectAllSessionsToBeReady ( ) {
951+ async expectAllSessionsToBeReady ( { timeout = 15000 } : { timeout ?: number } = { } ) {
949952 await test . step ( 'Expect all sessions to be ready' , async ( ) => {
950953 await this . expectNoStartUpMessaging ( ) ;
951- await expect ( this . activeStatusIcon ) . toHaveCount ( 0 ) ;
954+ await expect ( this . activeStatusIcon ) . toHaveCount ( 0 , { timeout } ) ;
952955 } ) ;
953956 }
954957
0 commit comments