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