@@ -207,11 +207,32 @@ export async function deletePodmanMachine(page: Page, machineVisibleName: string
207
207
}
208
208
await podmanResourceCard . performConnectionAction ( ResourceElementActions . Delete ) ;
209
209
await playExpect ( podmanResourceCard . resourceElement ) . toBeHidden ( { timeout : 30_000 } ) ;
210
+ await handleResetDefaultConnectionDialog ( page ) ;
210
211
} else {
211
212
console . log ( `Podman machine [${ machineVisibleName } ] not present, skipping deletion.` ) ;
212
213
}
213
214
}
214
215
216
+ export async function handleResetDefaultConnectionDialog ( page : Page ) : Promise < void > {
217
+ const connectionDialog = page . getByRole ( 'dialog' , { name : 'Podman' } ) ;
218
+ const dialogMessage = connectionDialog . getByText (
219
+ new RegExp (
220
+ `.* Podman Machine .+ does not match default connection .+ Do you want to update the default connection?` ,
221
+ ) ,
222
+ ) ;
223
+ if ( ( await connectionDialog . isVisible ( ) ) && ( await dialogMessage . isVisible ( ) ) ) {
224
+ const handleButton = connectionDialog . getByRole ( 'button' , { name : 'Yes' } ) ;
225
+ await handleButton . click ( ) ;
226
+ await playExpect ( connectionDialog ) . toBeVisible ( ) ;
227
+ const successDialogMessage = connectionDialog . getByText (
228
+ new RegExp ( `Podman Machine .+ is now the default machine on the CLI.` ) ,
229
+ ) ;
230
+ await playExpect ( successDialogMessage ) . toBeVisible ( ) ;
231
+ const okButton = connectionDialog . getByRole ( 'button' , { name : 'OK' } ) ;
232
+ await okButton . click ( ) ;
233
+ }
234
+ }
235
+
215
236
export function checkForFailedTest ( result : TaskResult , runner : PodmanDesktopRunner ) : void {
216
237
if ( result . errors && result . errors . length > 0 ) runner . setTestPassed ( false ) ;
217
238
}
0 commit comments